Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: 💥 update to secp256k1 v2.1.0 w/ breaking changes #39

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions dashhd.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ var DashHd = ("object" === typeof module && exports) || {};
let Secp256k1 =
//@ts-ignore
window.nobleSecp256k1 || require("@dashincubator/secp256k1");
let p = Secp256k1.utils._normalizePrivateKey(privateKeyCopy);
let t = Secp256k1.utils._normalizePrivateKey(tweak);
return Secp256k1.utils._bigintTo32Bytes(
Secp256k1.utils.mod(p + t, Secp256k1.CURVE.n),
let p = Secp256k1.utils.normPrivateKeyToScalar(privateKeyCopy);
let t = Secp256k1.utils.normPrivateKeyToScalar(tweak);
return Secp256k1.etc.numberToBytesBE(
Secp256k1.etc.mod(p + t, Secp256k1.CURVE.n),
);
};

Expand All @@ -161,7 +161,7 @@ var DashHd = ("object" === typeof module && exports) || {};
window.nobleSecp256k1 || require("@dashincubator/secp256k1");

try {
let point = Secp256k1.Point.fromHex(pubBytes);
let point = Secp256k1.ProjectivePoint.fromHex(pubBytes);
pubBytes = point.toRawBytes(COMPRESSED);
} catch (e) {
throw new Error("Invalid public key");
Expand All @@ -176,9 +176,9 @@ var DashHd = ("object" === typeof module && exports) || {};
//@ts-ignore
window.nobleSecp256k1 || require("@dashincubator/secp256k1");

let P = Secp256k1.Point.fromHex(publicKeyCopy);
let t = Secp256k1.utils._normalizePrivateKey(tweak);
let Q = Secp256k1.Point.BASE.multiplyAndAddUnsafe(P, t, 1n);
let P = Secp256k1.ProjectivePoint.fromHex(publicKeyCopy);
let t = Secp256k1.utils.normPrivateKeyToScalar(tweak);
let Q = Secp256k1.ProjectivePoint.BASE.mulAddQUns(P, t, 1n);
if (!Q) {
throw new Error("Tweaked point at infinity");
}
Expand Down
Loading
Loading