diff --git a/beacon_chain/spec/crypto.nim b/beacon_chain/spec/crypto.nim index 0f321a708..fbd8830f0 100644 --- a/beacon_chain/spec/crypto.nim +++ b/beacon_chain/spec/crypto.nim @@ -328,7 +328,15 @@ proc readValue*(reader: var JsonReader, value: var Signature) {.inline.} = template fromSszBytes*(T: type BlsValue, bytes: openarray[byte]): auto = fromBytes(T, bytes) +# Initialization +# ---------------------------------------------------------------------- + # For confutils func init*(T: typedesc[ValidatorPrivKey], hex: string): T {.inline.} = let success = result.fromHex(hex) doAssert success, "Private key is invalid" # Don't display private keys even if invalid + +# For mainchain monitor +func init*(T: typedesc[ValidatorPubKey], data: array[48, byte]): T {.inline.} = + let success = result.fromBytes(data) + doAssert success, "Public key is invalid" # Don't display private keys even if invalid