@@ -147,10 +147,10 @@ var DashHd = ("object" === typeof module && exports) || {};
147
147
let Secp256k1 =
148
148
//@ts -ignore
149
149
window . nobleSecp256k1 || require ( "@dashincubator/secp256k1" ) ;
150
- let p = Secp256k1 . utils . _normalizePrivateKey ( privateKeyCopy ) ;
151
- let t = Secp256k1 . utils . _normalizePrivateKey ( tweak ) ;
152
- return Secp256k1 . utils . _bigintTo32Bytes (
153
- Secp256k1 . utils . mod ( p + t , Secp256k1 . CURVE . n ) ,
150
+ let p = Secp256k1 . utils . normPrivateKeyToScalar ( privateKeyCopy ) ;
151
+ let t = Secp256k1 . utils . normPrivateKeyToScalar ( tweak ) ;
152
+ return Secp256k1 . etc . numberToBytesBE (
153
+ Secp256k1 . etc . mod ( p + t , Secp256k1 . CURVE . n ) ,
154
154
) ;
155
155
} ;
156
156
@@ -161,7 +161,7 @@ var DashHd = ("object" === typeof module && exports) || {};
161
161
window . nobleSecp256k1 || require ( "@dashincubator/secp256k1" ) ;
162
162
163
163
try {
164
- let point = Secp256k1 . Point . fromHex ( pubBytes ) ;
164
+ let point = Secp256k1 . ProjectivePoint . fromHex ( pubBytes ) ;
165
165
pubBytes = point . toRawBytes ( COMPRESSED ) ;
166
166
} catch ( e ) {
167
167
throw new Error ( "Invalid public key" ) ;
@@ -176,9 +176,9 @@ var DashHd = ("object" === typeof module && exports) || {};
176
176
//@ts -ignore
177
177
window . nobleSecp256k1 || require ( "@dashincubator/secp256k1" ) ;
178
178
179
- let P = Secp256k1 . Point . fromHex ( publicKeyCopy ) ;
180
- let t = Secp256k1 . utils . _normalizePrivateKey ( tweak ) ;
181
- let Q = Secp256k1 . Point . BASE . multiplyAndAddUnsafe ( P , t , 1n ) ;
179
+ let P = Secp256k1 . ProjectivePoint . fromHex ( publicKeyCopy ) ;
180
+ let t = Secp256k1 . utils . normPrivateKeyToScalar ( tweak ) ;
181
+ let Q = Secp256k1 . ProjectivePoint . BASE . mulAddQUns ( P , t , 1n ) ;
182
182
if ( ! Q ) {
183
183
throw new Error ( "Tweaked point at infinity" ) ;
184
184
}
0 commit comments