aboutsummaryrefslogtreecommitdiffstats
path: root/identity/key_test.go
blob: 3206c34eea8f7c87e3ca2652f171174b603d150e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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)
}