🤖 Merge PR #45493 fix(sawtooth-sdk): use correct return types on secp256k1 functions by @Patrick-Erichsen

* fix: use correct return types on secp256k1 functions

Signed-off-by: Patrick-Erichsen <Patrick.Erichsen@target.com>

* fix(sawtooth-sdk): update tests

Signed-off-by: Patrick-Erichsen <Patrick.Erichsen@target.com>
This commit is contained in:
Patrick Erichsen 2020-06-15 10:56:11 -05:00 committed by GitHub
parent f9f8e5ac0f
commit c6091aad00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 12 deletions

View File

@ -43,13 +43,13 @@ export class Secp256k1PrivateKey extends PrivateKey {
* @return a private key instance
* @throws if the private key is not valid
*/
static fromHex(privateKeyHex: string): PrivateKey;
static fromHex(privateKeyHex: string): Secp256k1PrivateKey;
/**
* @return generates a random PrivateKey
*
*/
static newRandom(): PrivateKey;
static newRandom(): Secp256k1PrivateKey;
}
/**
@ -75,10 +75,7 @@ export class Secp256k1PublicKey extends PublicKey {
* @return a public key instance
* @throws if the public key is not valid
*/
static fromHex(publicKeyHex: string): PublicKey;
/** Generate a new random public key */
static newRandom(): PublicKey;
static fromHex(publicKeyHex: string): Secp256k1PublicKey;
}
export class Secp256k1Context extends Context {

View File

@ -66,10 +66,10 @@ const privAlgoName = privateKey.getAlgorithmName();
// $ExpectType Buffer
const privAsBytes = privateKey.asBytes();
// $ExpectType PrivateKey
// $ExpectType Secp256k1PrivateKey
const privFromHex = Secp256k1PrivateKey.fromHex('test');
// $ExpectType PrivateKey
// $ExpectType Secp256k1PrivateKey
const privNewRandom = Secp256k1PrivateKey.newRandom();
// $ExpectType Buffer
@ -81,12 +81,9 @@ const pubAlgoName = publicKey.getAlgorithmName();
// $ExpectType Buffer
const pubAsBytes = publicKey.asBytes();
// $ExpectType PublicKey
// $ExpectType Secp256k1PublicKey
const pubFromHex = Secp256k1PublicKey.fromHex('test');
// $ExpectType PublicKey
const pubNewRandom = Secp256k1PublicKey.newRandom();
// $ExpectType string
const contextAlgoName = cryptoContext.getAlgorithmName();