From 478cbd6cbd525e7d8c09f975202e2a8b429e9bce Mon Sep 17 00:00:00 2001 From: Srijan67 Date: Sun, 22 Feb 2026 18:16:17 +0530 Subject: [PATCH] Changed regex for smarter crypto key value extraction --- src/core/utils/decrypt.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/utils/decrypt.ts b/src/core/utils/decrypt.ts index 727ccb7..774b12f 100644 --- a/src/core/utils/decrypt.ts +++ b/src/core/utils/decrypt.ts @@ -21,11 +21,12 @@ export function decrypt(object: DecryptObject, keys: DecryptKeys): any { const dh = crypto.createECDH('prime256v1'); dh.setPrivateKey(keys.privateKey, 'base64'); - + const cryptoKeyMatch = cryptoKey.value.match(/dh=([^;]+)/); + if (!cryptoKeyMatch) throw new Error('dh parameter is missing from crypto-key'); const params = { version: 'aesgcm', authSecret: keys.authSecret, - dh: cryptoKey.value.slice(3), + dh: cryptoKeyMatch[1], privateKey: dh, salt: salt.value.slice(5), };