Mark Spanbroek 19b82c93cb replace constantine with blscurve and nimcrypto
reason: slow build times with constantine
2024-12-04 10:08:59 +01:00

22 lines
515 B
Nim

import pkg/blscurve
import pkg/nimcrypto
export blscurve.Signature
export blscurve.sign
export blscurve.verify
type
Identity* = SecretKey
Identifier* = PublicKey
proc random*(_: type Identity, identity: var Identity) =
var randomness: array[32, byte]
var done = false
while not done:
doAssert randomBytes(randomness) == randomness.len
done = fromBytes(identity, randomness)
burnMem(randomness)
func identifier*(identity: Identity): Identifier =
doAssert publicFromSecret(result, identity)