Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
19 changes: 18 additions & 1 deletion dist/ethers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6801,6 +6801,23 @@ class Signature {
}
return result;
}
/**
* Returns the bound signature, binding `v`
*
* Bound signatures are valid for ecrecover but may be invalid for transactions.
* They are used for ERC-XXXX signature compression.
*/
bind(v = 27) {
if (this.#v === v) {
return this;
}
const s = BN_N - BigInt(this._s);
const bound = new Signature(_guard$3, this.r, toUint256(s), v);
if (this.networkV) {
bound.#networkV = this.networkV;
}
return bound;
}
/**
* Returns a new identical [[Signature]].
*/
Expand Down Expand Up @@ -7126,7 +7143,7 @@ class SigningKey {
static recoverPublicKey(digest, signature) {
assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest);
const sig = Signature.from(signature);
let secpSig = secp256k1.Signature.fromCompact(getBytesCopy(concat([sig.r, sig.s])));
let secpSig = secp256k1.Signature.fromCompact(getBytesCopy(concat([sig.r, sig._s])));
secpSig = secpSig.addRecoveryBit(sig.yParity);
const pubKey = secpSig.recoverPublicKey(getBytesCopy(digest));
assertArgument(pubKey != null, "invalid signature for digest", "signature", signature);
Expand Down
2 changes: 1 addition & 1 deletion dist/ethers.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ethers.min.js

Large diffs are not rendered by default.

19 changes: 18 additions & 1 deletion dist/ethers.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -6807,6 +6807,23 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
}
return result;
}
/**
* Returns the bound signature, binding `v`
*
* Bound signatures are valid for ecrecover but may be invalid for transactions.
* They are used for ERC-XXXX signature compression.
*/
bind(v = 27) {
if (this.#v === v) {
return this;
}
const s = BN_N - BigInt(this._s);
const bound = new Signature(_guard$3, this.r, toUint256(s), v);
if (this.networkV) {
bound.#networkV = this.networkV;
}
return bound;
}
/**
* Returns a new identical [[Signature]].
*/
Expand Down Expand Up @@ -7132,7 +7149,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
static recoverPublicKey(digest, signature) {
assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest);
const sig = Signature.from(signature);
let secpSig = secp256k1.Signature.fromCompact(getBytesCopy(concat([sig.r, sig.s])));
let secpSig = secp256k1.Signature.fromCompact(getBytesCopy(concat([sig.r, sig._s])));
secpSig = secpSig.addRecoveryBit(sig.yParity);
const pubKey = secpSig.recoverPublicKey(getBytesCopy(digest));
assertArgument(pubKey != null, "invalid signature for digest", "signature", signature);
Expand Down
2 changes: 1 addition & 1 deletion dist/ethers.umd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ethers.umd.min.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions lib.commonjs/_tests/test-crypto.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib.commonjs/_tests/test-crypto.js.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions lib.commonjs/crypto/signature.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ export declare class Signature {
* developers should never require this.
*/
getCanonical(): Signature;
/**
* Returns the bound signature, binding `v`
*
* Bound signatures are valid for ecrecover but may be invalid for transactions.
* They are used for ERC-XXXX signature compression.
*/
bind(v?: 27 | 28): Signature;
/**
* Returns a new identical [[Signature]].
*/
Expand Down
2 changes: 1 addition & 1 deletion lib.commonjs/crypto/signature.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions lib.commonjs/crypto/signature.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib.commonjs/crypto/signature.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib.commonjs/crypto/signing-key.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib.commonjs/crypto/signing-key.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 27 additions & 1 deletion lib.esm/_tests/test-crypto.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading