Added PrivateKey.toKeyPair

This commit is contained in:
Zahary Karadjov 2020-01-21 18:58:26 +02:00
parent b7ebf8ed54
commit fc327718fb
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
1 changed files with 3 additions and 0 deletions

View File

@ -135,6 +135,9 @@ proc getPublicKey*(seckey: PrivateKey): PublicKey =
cast[ptr cuchar](unsafeAddr seckey)) != 1:
raiseSecp256k1Error()
proc toKeyPair*(key: PrivateKey): KeyPair =
KeyPair(seckey: key, pubkey: key.getPublicKey())
proc newKeyPair*(): KeyPair =
## Generates new private and public key.
result.seckey = newPrivateKey()