aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--key/box.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/key/box.go b/key/box.go
index 51bc3ff..a93c11a 100644
--- a/key/box.go
+++ b/key/box.go
@@ -4,6 +4,8 @@ import (
"bytes"
"encoding/hex"
"fmt"
+ "github.com/keybase/saltpack"
+ "github.com/keybase/saltpack/basic"
)
// BoxPublicKey is a public NaCl box key.
@@ -67,3 +69,20 @@ func decodeBoxKey(buf []byte) ([32]byte, error) {
}
return key, nil
}
+
+func (key BoxPublicKey) ToKID() []byte {
+ return key[:]
+}
+
+func (key BoxPublicKey) CreateEphemeralKey() (saltpack.BoxSecretKey, error) {
+ return basic.EphemeralKeyCreator{}.CreateEphemeralKey()
+}
+
+func (key BoxPublicKey) ToRawBoxKeyPointer() *saltpack.RawBoxKey {
+ raw := saltpack.RawBoxKey(key)
+ return &raw
+}
+
+func (key BoxPublicKey) HideIdentity() bool {
+ return false
+}