From b2d1a618c205a5c8a66ab00ac848cea6db71570c Mon Sep 17 00:00:00 2001 From: feri42 Date: Tue, 24 Sep 2024 16:45:28 +0200 Subject: [PATCH] feat: allow "pers" EC option --- features/keychain/module/crypto/secp256k1.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/features/keychain/module/crypto/secp256k1.js b/features/keychain/module/crypto/secp256k1.js index 910a5568..c6723dc3 100644 --- a/features/keychain/module/crypto/secp256k1.js +++ b/features/keychain/module/crypto/secp256k1.js @@ -1,12 +1,12 @@ import assert from 'minimalistic-assert' import elliptic from '@exodus/elliptic' -import { mapValues, pick } from '@exodus/basic-utils' +import { mapValues } from '@exodus/basic-utils' import ecc from '@exodus/bitcoinerlab-secp256k1' import { tweakPrivateKey } from './tweak.js' const isValidEcOptions = (ecOptions) => - !ecOptions || Object.keys(ecOptions).every((key) => ['canonical'].includes(key)) + !ecOptions || Object.keys(ecOptions).every((key) => ['canonical', 'pers'].includes(key)) const encodeSignature = ({ signature, enc }) => { if (enc === 'der') return Buffer.from(signature.toDER()) @@ -31,7 +31,7 @@ export const create = ({ getPrivateHDKey }) => { assert(['der', 'raw', 'binary'].includes(enc), 'signBuffer: invalid enc') assert(isValidEcOptions(ecOptions), 'signBuffer: invalid EC option') const { privateKey } = getPrivateHDKey({ seedId, keyId }) - const signature = curve.sign(data, privateKey, pick(ecOptions, ['canonical'])) + const signature = curve.sign(data, privateKey, ecOptions) return encodeSignature({ signature, enc }) }, signSchnorr: async ({ seedId, keyId, data, tweak, extraEntropy }) => {