aboutsummaryrefslogtreecommitdiffstats
path: root/key/key.go
diff options
context:
space:
mode:
Diffstat (limited to 'key/key.go')
-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[:])
+}