aboutsummaryrefslogtreecommitdiffstats
path: root/key
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2025-04-14 19:13:50 -0400
committerSam Anthony <sam@samanthony.xyz>2025-04-14 19:13:50 -0400
commitc956e49d44545ebc0d8455ff8903cc3e40d7547a (patch)
tree88a87de4264e441ad4260cbe7d5bd812d53d17b4 /key
parent02ace55f4cd39b7b9c97a361393a09fcaa1bd9a3 (diff)
downloadhose-c956e49d44545ebc0d8455ff8903cc3e40d7547a.zip
store signature verification key in known hosts file
Diffstat (limited to 'key')
-rw-r--r--key/key.go15
1 files changed, 15 insertions, 0 deletions
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[:])
+}