Files
did-it/verifiers/_methods/multikey/multikey_test.go
2025-07-10 16:51:46 +02:00

30 lines
756 B
Go

package multikey_test
import (
"encoding/json"
"testing"
"github.com/stretchr/testify/require"
_ "github.com/ucan-wg/go-did-it/verifiers/did-key"
"github.com/ucan-wg/go-did-it/verifiers/_methods/multikey"
)
func TestJsonRoundTrip(t *testing.T) {
data := `{
"id": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK#z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK",
"type": "Multikey",
"controller": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK",
"publicKeyMultibase": "z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK"
}`
var mk multikey.MultiKey
err := json.Unmarshal([]byte(data), &mk)
require.NoError(t, err)
bytes, err := json.Marshal(mk)
require.NoError(t, err)
require.JSONEq(t, data, string(bytes))
}