From c956e49d44545ebc0d8455ff8903cc3e40d7547a Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Mon, 14 Apr 2025 19:13:50 -0400 Subject: store signature verification key in known hosts file --- key/key.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'key') diff --git a/key/key.go b/key/key.go index 38b4bad..b3dd393 100644 --- a/key/key.go +++ b/key/key.go @@ -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[:]) +} -- cgit v1.2.3