From 366ead0a34f3760f9bd770b8d805702f6bfb2745 Mon Sep 17 00:00:00 2001 From: himanshu Date: Fri, 27 Sep 2024 12:00:05 +0530 Subject: [PATCH] fix error msg --- src/helpers/metadataUtils.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/helpers/metadataUtils.ts b/src/helpers/metadataUtils.ts index fe769b5..d7a7d14 100644 --- a/src/helpers/metadataUtils.ts +++ b/src/helpers/metadataUtils.ts @@ -35,8 +35,8 @@ export const getSecpKeyFromEd25519 = ( const secpKeyPair = secp256k1Curve.keyFromPrivate(bufferKey); - if (bufferKey.length < 32) { - throw new Error(`Key length must be less than 32. got ${bufferKey.length}`); + if (bufferKey.length !== 32) { + throw new Error(`Key length must be equal to 32. got ${bufferKey.length}`); } return { scalar: secpKeyPair.getPrivate(), @@ -215,8 +215,8 @@ export const decryptSeedData = async (seedBase64: string, finalUserKey: BN) => { const seedJson = JSON.parse(seedUtf8) as EncryptedSeed; const bufferMetadata = { ...encParamsHexToBuf(seedJson.metadata), mode: "AES256" }; const paddedDecryptionKey = Buffer.from(decryptionKey.scalar.toString("hex", 64), "hex"); - if (paddedDecryptionKey.length < 32) { - throw new Error(`decryption Key length must be less than 32. got ${paddedDecryptionKey.length}`); + if (paddedDecryptionKey.length !== 32) { + throw new Error(`decryption Key length must be equal to 32. got ${paddedDecryptionKey.length}`); } const decText = await decrypt(paddedDecryptionKey, { ...bufferMetadata,