Skip to content

Commit

Permalink
Fix/default crypto bug (#335)
Browse files Browse the repository at this point in the history
* fix default case in switch statement, and remove `0x` prefix from keys if present.

* add in replace for auto formatting.
  • Loading branch information
Bean authored Jan 30, 2024
1 parent f212792 commit 706795d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/crypto/src/lib/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,14 @@ export const computeHDPubKey = (
try {
switch (sigType) {
case SIGTYPE.EcdsaCaitSith:
// a bit of pre processing to remove characters which will cause our wasm module to reject the values.
pubkeys = pubkeys.map((value: string) => {
return value.replace('0x', '');
});
keyId = keyId.replace('0x', '');
return ecdsaSdk.compute_public_key(keyId, pubkeys, 2);
defualt: throw new Error('Non supported signature type');
default:
throw new Error('Non supported signature type');
}
} catch (e) {
log('Failed to derive public key', e);
Expand Down

0 comments on commit 706795d

Please sign in to comment.