Skip to content

Commit e40fadc

Browse files
committed
Add warning for undefined 'e' in signSchnorr function (#3)
This commit introduces a console warning when 'e' (auxRand equivalent) is undefined during a Schnorr signing operation. The warning informs users of potential discrepancies between our library and tiny-secp256k1 due to differences in how 'e' is handled when it's not provided. This is a response to issue #3.
1 parent 73bf983 commit e40fadc

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,12 @@ export function sign(h, d, e) {
310310
return necc.signSync(h, d, { der: false, extraEntropy: e });
311311
}
312312

313-
export function signSchnorr(h, d, e = Buffer.alloc(32, 0x00)) {
313+
export function signSchnorr(h, d, e) {
314+
if (e === undefined) {
315+
console.warn(
316+
`Warning: The extra data 'e' is not defined. This library defaults to a random value when 'e' is undefined, which is different from the deterministic approach in tiny-secp256k1. This might lead to discrepancies in the Schnorr signatures between the two libraries.`
317+
);
318+
}
314319
if (!isPrivate(d)) {
315320
throw new Error('Expected Private');
316321
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@bitcoinerlab/secp256k1",
33
"homepage": "https://bitcoinerlab.com/secp256k1",
4-
"version": "1.0.2",
4+
"version": "1.0.3",
55
"description": "A library for performing elliptic curve operations on the secp256k1 curve. It is designed to integrate into the BitcoinJS & BitcoinerLAB ecosystems and uses the audited noble-secp256k1 library. It is compatible with environments that do not support WASM, such as React Native.",
66
"main": "dist/index.js",
77
"types": "types/index.d.ts",

0 commit comments

Comments
 (0)