move some native procs from the libsecp256k1 module to main native module

This commit is contained in:
Zahary Karadjov 2018-07-20 20:01:43 +03:00
parent ac8cb31178
commit e6a619b0bf
2 changed files with 14 additions and 13 deletions

View File

@ -25,6 +25,20 @@ when not defined(native):
## Return current error message.
result = libsecp256k1ErrorMsg()
proc isZeroKey*(seckey: PrivateKey): bool =
## Check if private key `seckey` contains only 0 bytes.
result = true
for i in seckey.data:
if i != byte(0):
result = false
proc isZeroKey*(pubkey: PublicKey): bool =
## Check if public key `pubkey` contains only 0 bytes.
result = true
for i in pubkey.data:
if i != byte(0):
result = false
proc signMessage*(seckey: PrivateKey,
data: openarray[byte]): Signature {.inline.} =
## Sign message of arbitrary length `data` using private key `seckey`.

View File

@ -319,16 +319,3 @@ proc signRawMessage*(data: openarray[byte], seckey: PrivateKey,
return(EthKeysStatus.Error)
return(EthKeysStatus.Success)
proc isZeroKey*(seckey: PrivateKey): bool =
## Check if private key `seckey` contains only 0 bytes.
result = true
for i in seckey.data:
if i != byte(0):
result = false
proc isZeroKey*(pubkey: PublicKey): bool =
## Check if public key `pubkey` contains only 0 bytes.
result = true
for i in pubkey.data:
if i != byte(0):
result = false