tka: Use strict decoding settings, implement Unserialize()

Signed-off-by: Tom DNetto <tom@tailscale.com>
This commit is contained in:
Tom DNetto
2022-08-12 13:13:38 -07:00
committed by Tom
parent dbcc34981a
commit 06eac9bbff
7 changed files with 89 additions and 10 deletions
+1 -2
View File
@@ -8,7 +8,6 @@ import (
"bytes"
"testing"
"github.com/fxamacker/cbor/v2"
"github.com/google/go-cmp/cmp"
"golang.org/x/crypto/blake2s"
"tailscale.com/types/tkatype"
@@ -165,7 +164,7 @@ func TestSerialization(t *testing.T) {
}
var decodedAUM AUM
if err := cbor.Unmarshal(data, &decodedAUM); err != nil {
if err := decodedAUM.Unserialize(data); err != nil {
t.Fatalf("Unmarshal failed: %v", err)
}
if diff := cmp.Diff(tc.AUM, decodedAUM); diff != "" {