MCPcopy Create free account
hub / github.com/WICG/webpackage / TestIntegritySignature

Function TestIntegritySignature

go/integrityblock/integrityblock_test.go:57–81  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

55}
56
57func TestIntegritySignature(t *testing.T) {
58 var integritySignature *IntegritySignature
59 attributes := SignatureAttributesMap{Ed25519publicKeyAttributeName: []byte("publickey")}
60
61 integritySignature = &IntegritySignature{
62 SignatureAttributes: attributes,
63 Signature: []byte("signature"),
64 }
65
66 var integritySignatureBuf bytes.Buffer
67 enc := cbor.NewEncoder(&integritySignatureBuf)
68 if err := integritySignature.cborBytes(enc); err != nil {
69 t.Errorf("integritySignature.cborBytes. err: %v", err)
70 }
71
72 want := `[map["ed25519PublicKey":"publickey"] "signature"]`
73
74 got, err := testhelper.CborBinaryToReadableString(integritySignatureBuf.Bytes())
75 if err != nil {
76 t.Fatal(err)
77 }
78 if got != want {
79 t.Errorf("integrityblock: got: %s\nwant: %s", got, want)
80 }
81}
82
83func TestComputeWebBundleSha512(t *testing.T) {
84 bundleFile, err := os.Open("./testfile.wbn")

Callers

nothing calls this directly

Calls 3

cborBytesMethod · 0.95
NewEncoderFunction · 0.92

Tested by

no test coverage detected