avoid `ProveField` warning in `crypto.init` (#915)
This commit is contained in:
parent
43359dd9d1
commit
81b861b34e
|
@ -455,7 +455,8 @@ proc getBytes*(sig: Signature): seq[byte] =
|
||||||
## Return signature ``sig`` in binary form.
|
## Return signature ``sig`` in binary form.
|
||||||
result = sig.data
|
result = sig.data
|
||||||
|
|
||||||
proc init*[T: PrivateKey|PublicKey](key: var T, data: openArray[byte]): bool =
|
template initImpl[T: PrivateKey|PublicKey](
|
||||||
|
key: var T, data: openArray[byte]): bool =
|
||||||
## Initialize private key ``key`` from libp2p's protobuf serialized raw
|
## Initialize private key ``key`` from libp2p's protobuf serialized raw
|
||||||
## binary form.
|
## binary form.
|
||||||
##
|
##
|
||||||
|
@ -517,6 +518,14 @@ proc init*[T: PrivateKey|PublicKey](key: var T, data: openArray[byte]): bool =
|
||||||
else:
|
else:
|
||||||
false
|
false
|
||||||
|
|
||||||
|
{.push warning[ProveField]:off.} # https://github.com/nim-lang/Nim/issues/22060
|
||||||
|
proc init*(key: var PrivateKey, data: openArray[byte]): bool =
|
||||||
|
initImpl(key, data)
|
||||||
|
|
||||||
|
proc init*(key: var PublicKey, data: openArray[byte]): bool =
|
||||||
|
initImpl(key, data)
|
||||||
|
{.pop.}
|
||||||
|
|
||||||
proc init*(sig: var Signature, data: openArray[byte]): bool =
|
proc init*(sig: var Signature, data: openArray[byte]): bool =
|
||||||
## Initialize signature ``sig`` from raw binary form.
|
## Initialize signature ``sig`` from raw binary form.
|
||||||
##
|
##
|
||||||
|
|
Loading…
Reference in New Issue