@noble/secp256k1
Advanced tools
Comparing version 1.6.2 to 1.6.3
@@ -112,4 +112,6 @@ /*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */ | ||
multiplyUnsafe(scalar) { | ||
const P0 = JacobianPoint.ZERO; | ||
if (typeof scalar === 'bigint' && scalar === _0n) | ||
return P0; | ||
let n = normalizeScalar(scalar); | ||
const P0 = JacobianPoint.ZERO; | ||
if (n === _1n) | ||
@@ -306,4 +308,2 @@ return this; | ||
} | ||
if (h === _0n) | ||
throw new Error('Cannot recover signature: msgHash cannot be 0'); | ||
const prefix = recovery & 1 ? '03' : '02'; | ||
@@ -888,4 +888,2 @@ const R = Point.fromHex(prefix + numTo32bStr(r)); | ||
const u2 = mod(r * sinv, n); | ||
if (u1 === _0n) | ||
return false; | ||
const R = Point.BASE.multiplyAndAddUnsafe(P, u1, u2); | ||
@@ -1050,3 +1048,3 @@ if (!R) | ||
const p = normalizePrivateKey(privateKey); | ||
const t = bytesToNumber(ensureBytes(tweak)); | ||
const t = normalizePrivateKey(tweak); | ||
return numTo32b(mod(p + t, CURVE.n)); | ||
@@ -1060,3 +1058,3 @@ }, | ||
const P = Point.fromHex(p); | ||
const t = bytesToNumber(ensureBytes(tweak)); | ||
const t = normalizePrivateKey(tweak); | ||
const Q = Point.BASE.multiplyAndAddUnsafe(P, t, _1n); | ||
@@ -1063,0 +1061,0 @@ if (!Q) |
@@ -115,4 +115,6 @@ "use strict"; | ||
multiplyUnsafe(scalar) { | ||
const P0 = JacobianPoint.ZERO; | ||
if (typeof scalar === 'bigint' && scalar === _0n) | ||
return P0; | ||
let n = normalizeScalar(scalar); | ||
const P0 = JacobianPoint.ZERO; | ||
if (n === _1n) | ||
@@ -309,4 +311,2 @@ return this; | ||
} | ||
if (h === _0n) | ||
throw new Error('Cannot recover signature: msgHash cannot be 0'); | ||
const prefix = recovery & 1 ? '03' : '02'; | ||
@@ -897,4 +897,2 @@ const R = Point.fromHex(prefix + numTo32bStr(r)); | ||
const u2 = mod(r * sinv, n); | ||
if (u1 === _0n) | ||
return false; | ||
const R = Point.BASE.multiplyAndAddUnsafe(P, u1, u2); | ||
@@ -1060,3 +1058,3 @@ if (!R) | ||
const p = normalizePrivateKey(privateKey); | ||
const t = bytesToNumber(ensureBytes(tweak)); | ||
const t = normalizePrivateKey(tweak); | ||
return numTo32b(mod(p + t, CURVE.n)); | ||
@@ -1070,3 +1068,3 @@ }, | ||
const P = Point.fromHex(p); | ||
const t = bytesToNumber(ensureBytes(tweak)); | ||
const t = normalizePrivateKey(tweak); | ||
const Q = Point.BASE.multiplyAndAddUnsafe(P, t, _1n); | ||
@@ -1073,0 +1071,0 @@ if (!Q) |
{ | ||
"name": "@noble/secp256k1", | ||
"version": "1.6.2", | ||
"version": "1.6.3", | ||
"description": "Fastest JS implementation of secp256k1. Independently audited, high-security, 0-dependency ECDSA & Schnorr signatures", | ||
@@ -12,3 +12,3 @@ "files": [ | ||
"scripts": { | ||
"build": "tsc -d && tsc -p tsconfig.esm.json", | ||
"build": "tsc && tsc -p tsconfig.esm.json", | ||
"build:release": "rollup -c rollup.config.js", | ||
@@ -15,0 +15,0 @@ "lint": "prettier --print-width 100 --single-quote --check index.ts", |
@@ -83,3 +83,3 @@ # noble-secp256k1 ![Node CI](https://github.com/paulmillr/noble-secp256k1/workflows/Node%20CI/badge.svg) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) | ||
Creates public key for the corresponding private key. | ||
Creates public key for the corresponding private key. The default is full 65-byte key. | ||
@@ -171,2 +171,5 @@ - `isCompressed = false` determines whether to return compact (33-byte), or full (65-byte) key. | ||
``` | ||
Recovers public key from message hash, signature & recovery bit. The default is full 65-byte key. | ||
- `msgHash: Uint8Array | string` - message hash which would be signed | ||
@@ -173,0 +176,0 @@ - `signature: Uint8Array | string | { r: bigint, s: bigint }` - object returned by the `sign` function |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
358
106104
2450