Skip to content

Commit

Permalink
secp: use upstream convenience API (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnetheduck authored Apr 17, 2020
1 parent ee5c961 commit 7c70955
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 514 deletions.
7 changes: 4 additions & 3 deletions eth/keys.nim
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
{.push raises: [Defect].}

import
nimcrypto/hash, nimcrypto/keccak, ./keys/secp,
secp256k1,
nimcrypto/hash, nimcrypto/keccak,
stew/[byteutils, objects, results], strformat

from nimcrypto/utils import burnMem

export secp, results
export secp256k1, results

const
KeyLength* = SkEcdhRawSecretSize - 1
Expand Down Expand Up @@ -66,7 +67,7 @@ proc toPublicKey*(seckey: PrivateKey): SkResult[PublicKey] =
proc verify*(seckey: PrivateKey): bool {.borrow.}

proc fromRaw*(T: type PublicKey, data: openArray[byte]): SkResult[T] =
if data.len() == SkRawCompressedPubKeySize:
if data.len() == SkRawCompressedPublicKeySize:
return SkPublicKey.fromRaw(data).mapConvert(PublicKey)

if len(data) < SkRawPublicKeySize - 1:
Expand Down
Loading

0 comments on commit 7c70955

Please sign in to comment.