Skip to content

Commit

Permalink
run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
zkharit committed Dec 20, 2024
1 parent b4bb09c commit 4cfe663
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion packages/api-key-stamper/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export function convertTurnkeyApiKeyToJwk(input: {
try {
jwk = pointDecode(uint8ArrayFromHexString(compressedPublicKeyHex));
} catch (e) {
throw new Error(`invalid API key: Ensure that you are using a valid public and private key in compressed or uncompressed format and they are not switched`);
throw new Error(
`invalid API key: Ensure that you are using a valid public and private key in compressed or uncompressed format and they are not switched`
);
}

// Ensure that d is sufficiently padded
Expand Down
10 changes: 6 additions & 4 deletions packages/sdk-browser/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ export const createEmbeddedAPIKey = async (
const targetKeyBytes = uint8ArrayFromHexString(targetPublicKey);

let jwk;
try {
jwk = pointDecode(targetKeyBytes);
} catch (e) {
try {
jwk = pointDecode(targetKeyBytes);
} catch (e) {
// provide more context about the error that is being thrown
throw new Error(`target public key is not a valid compressed public key: ${targetPublicKey}`);
throw new Error(
`target public key is not a valid compressed public key: ${targetPublicKey}`
);
}

const targetKey = await crypto.subtle.importKey(
Expand Down

0 comments on commit 4cfe663

Please sign in to comment.