Skip to content

Commit

Permalink
Update src/helpers/metadataUtils.ts
Browse files Browse the repository at this point in the history
Co-authored-by: matthiasgeihs <[email protected]>
  • Loading branch information
himanshuchawla009 and matthiasgeihs authored Sep 27, 2024
1 parent 366ead0 commit d7434a0
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/helpers/metadataUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,8 @@ export const decryptSeedData = async (seedBase64: string, finalUserKey: BN) => {
const seedUtf8 = Buffer.from(seedBase64, "base64").toString("utf-8");
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 equal to 32. got ${paddedDecryptionKey.length}`);
}
const decText = await decrypt(paddedDecryptionKey, {
const bufferKey = decryptionKey.scalar.toArrayLike(Buffer, "be", 32);
const decText = await decrypt(bufferKey, {
...bufferMetadata,
ciphertext: Buffer.from(seedJson.enc_text, "hex"),
});
Expand Down

0 comments on commit d7434a0

Please sign in to comment.