diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2025-04-18 14:39:52 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2025-04-18 14:39:52 -0400 |
| commit | 466488d4eedcfc408b2e374a4d8b54db1ee0bf85 (patch) | |
| tree | 3683654a249cbc87abb7dd48ab82e26d1fe77ada /key | |
| parent | f33d9227f7e49e7818b4d3771b6d1126a71bdce5 (diff) | |
| download | hose-466488d4eedcfc408b2e374a4d8b54db1ee0bf85.zip | |
load signature keypair
Diffstat (limited to 'key')
| -rw-r--r-- | key/sig.go | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -12,6 +12,24 @@ type SigPublicKey [32]byte // SigPrivateKey is a private NaCl signing key. type SigPrivateKey [64]byte +// LoadSigKeypair reads the public and private NaCl signature keys from disc, +// or generates a new keypair if it does not already exist. +func LoadSigKeypair() (pub SigPublicKey, priv SigPrivateKey, err error) { + err = generateSigKeypairIfNotExist() + if err != nil { + return + } + + pub, err = loadKey(sigPubKeyFile, DecodeSigPublicKey) + if err != nil { + return + } + + priv, err = loadKey(sigPrivKeyFile, DecodeSigPrivateKey) + + return +} + // LoadSigPublicKey reads the public signature verification key from disc, // or generates a new keypair if it does not already exist. func LoadSigPublicKey() (SigPublicKey, error) { |