diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2025-04-14 19:13:50 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2025-04-14 19:13:50 -0400 |
| commit | c956e49d44545ebc0d8455ff8903cc3e40d7547a (patch) | |
| tree | 88a87de4264e441ad4260cbe7d5bd812d53d17b4 /key | |
| parent | 02ace55f4cd39b7b9c97a361393a09fcaa1bd9a3 (diff) | |
| download | hose-c956e49d44545ebc0d8455ff8903cc3e40d7547a.zip | |
store signature verification key in known hosts file
Diffstat (limited to 'key')
| -rw-r--r-- | key/key.go | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -1,6 +1,7 @@ package key import ( + "bytes" "encoding/hex" "fmt" "io" @@ -13,6 +14,12 @@ type BoxPublicKey [32]byte // BoxPrivateKey is a private NaCl box key. type BoxPrivateKey [32]byte +// SigPublicKey is a public NaCl signature verification key. +type SigPublicKey [32]byte + +// SigPrivateKey is a private NaCl signing key. +type SigPrivateKey [64]byte + // LoadBoxKeypair reads the public and private NaCl box keys from disc, // or generates a new keypair if it does not already exist. // These keys can be used for NaCl box (encryption/decryption) operations. @@ -67,3 +74,11 @@ func loadBoxKey(filename string) ([32]byte, error) { return key, nil } + +func (bpk1 BoxPublicKey) Compare(bpk2 BoxPublicKey) int { + return bytes.Compare(bpk1[:], bpk2[:]) +} + +func (spk1 SigPublicKey) Compare(spk2 SigPublicKey) int { + return bytes.Compare(spk1[:], spk2[:]) +} |