aboutsummaryrefslogtreecommitdiffstats
path: root/identity/key_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'identity/key_test.go')
-rw-r--r--identity/key_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/identity/key_test.go b/identity/key_test.go
new file mode 100644
index 00000000..3206c34e
--- /dev/null
+++ b/identity/key_test.go
@@ -0,0 +1,21 @@
+package identity
+
+import (
+ "encoding/json"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+)
+
+func TestKeyJSON(t *testing.T) {
+ k := generatePublicKey()
+
+ data, err := json.Marshal(k)
+ require.NoError(t, err)
+
+ var read Key
+ err = json.Unmarshal(data, &read)
+ require.NoError(t, err)
+
+ require.Equal(t, k, &read)
+}