From 7a36c249f8fb198f1f601de426adf4c604c0205c Mon Sep 17 00:00:00 2001 From: Gruruya Date: Mon, 3 Apr 2023 22:43:37 -0400 Subject: [PATCH] Re-order --- secp256k1.nim | 4 ++-- tests/test_secp256k1.nim | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/secp256k1.nim b/secp256k1.nim index 9d3a132..5d4433f 100644 --- a/secp256k1.nim +++ b/secp256k1.nim @@ -410,6 +410,8 @@ func seckey*(kp: SkKeyPair): SkSecretKey = doAssert res == 1, "Can't fail, per documentation" SkSecretKey(data: key) +func `pubkey=`*(kp: var SkKeyPair, sk: SkPublicKey) {.deprecated: "Set the seckey instead".} = discard + func `seckey=`*(kp: var SkKeyPair, sk: SkSecretKey) = var newKp: SkKeyPair let res = secp256k1_keypair_create(getContext(), addr newKp.data, sk.data.baseAddr) @@ -419,8 +421,6 @@ func `seckey=`*(kp: var SkKeyPair, sk: SkSecretKey) = #TODO: Raise an exception? Old behaviour would just set the secret key to an invalid key. discard -func `pubkey=`*(kp: var SkKeyPair, sk: SkPublicKey) {.deprecated: "Set the seckey instead".} = discard - proc random*(T: type SkKeyPair, rng: Rng): SkResult[T] = ## Generates new random key pair. let seckey = ? SkSecretKey.random(rng) diff --git a/tests/test_secp256k1.nim b/tests/test_secp256k1.nim index d569df5..7794e22 100644 --- a/tests/test_secp256k1.nim +++ b/tests/test_secp256k1.nim @@ -36,6 +36,10 @@ suite "secp256k1": SkPublicKey.fromHex(pk.toHex())[].toHex() == pk.toHex() SkSecretKey.random(brokenRng).isErr + test "Keypairs": + check: + SkKeyPair.random(workingRng).isOk() + test "Signatures": let sk = SkSecretKey.random(workingRng)[] @@ -57,7 +61,3 @@ suite "secp256k1": SkMessage.fromBytes([]).isErr() SkMessage.fromBytes([0'u8]).isErr() SkMessage.fromBytes(array[32, byte](msg0)).isOk() - - test "Keypairs": - check: - SkKeyPair.random(workingRng).isOk()