Fixed spelling of recid in secp256k1 (#43838)

* Update index.d.ts

* secp256k1: fixed spelling and added test

* secp256k1: fixed missing semicolon in test

* Empty commit to retrigger CI
This commit is contained in:
Attila Gazso 2020-04-17 03:01:35 +05:30 committed by GitHub
parent 22e6c701e7
commit 3ce60aa3be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -115,7 +115,7 @@ export function signatureImport(signature: Uint8Array): Uint8Array;
* - Compose 32-byte scalar `s = k^-1 * (r * d + m)`. Reject nonce if `s` is zero.
* - The signature is `(r, s)`.
*/
export function ecdsaSign(message: Uint8Array, privateKey: Uint8Array, options?: SignOptions): {signature: Uint8Array, recId: number};
export function ecdsaSign(message: Uint8Array, privateKey: Uint8Array, options?: SignOptions): {signature: Uint8Array, recid: number};
/**
* Verify an ECDSA signature.
@ -133,7 +133,7 @@ export function ecdsaVerify(signature: Uint8Array, message: Uint8Array, publicKe
/**
* Recover an ECDSA public key from a signature.
*/
export function ecdsaRecover(signature: Uint8Array, recId: number, message: Uint8Array, compressed?: boolean): Uint8Array;
export function ecdsaRecover(signature: Uint8Array, recid: number, message: Uint8Array, compressed?: boolean): Uint8Array;
/**
* Compute an EC Diffie-Hellman secret and applied sha256 to compressed public key.

View File

@ -1,4 +1,4 @@
import { SignOptions, ecdsaSign } from "secp256k1";
import { SignOptions, ecdsaSign, ecdsaRecover } from "secp256k1";
const opts: SignOptions = {
data: Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72])
@ -8,4 +8,6 @@ const message = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
const prvKey = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
ecdsaSign(message, prvKey, opts);
const ret = ecdsaSign(message, prvKey, opts);
const recovered = ecdsaRecover(ret.signature, ret.recid, message);