summaryrefslogtreecommitdiff
path: root/asserts
diff options
authorPawel Stolowski <stolowski@gmail.com>2017-02-20 16:50:22 +0100
committerPawel Stolowski <stolowski@gmail.com>2017-02-20 16:50:22 +0100
commit106f719673b2f0b8e6cf291e593729095c3baf0b (patch)
tree1bdaa13f12258d1c6cea962e587a6376ccba2f2c /asserts
parent17013d2ea74ce5d8a27e9ce9a10d64d8f9efaabb (diff)
parentc9d7fc3ed23ddd4d4d5da856ea722cd332a187f8 (diff)
Merge branch 'master' into kmod-speckmod-spec
Diffstat (limited to 'asserts')
-rw-r--r--asserts/asserts.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/asserts/asserts.go b/asserts/asserts.go
index 32d7ca9b78..7616429623 100644
--- a/asserts/asserts.go
+++ b/asserts/asserts.go
@@ -331,15 +331,17 @@ var _ Assertion = (*assertionBase)(nil)
// where:
//
// HEADER is a set of header entries separated by "\n"
-// BODY can be arbitrary,
+// BODY can be arbitrary text,
// SIGNATURE is the signature
//
+// Both BODY and HEADER must be UTF8.
+//
// A header entry for a single line value (no '\n' in it) looks like:
//
// NAME ": " SIMPLEVALUE
//
// The format supports multiline text values (with '\n's in them) and
-// lists possibly nested with string scalars in them.
+// lists or maps, possibly nested, with string scalars in them.
//
// For those a header entry looks like:
//
@@ -348,12 +350,17 @@ var _ Assertion = (*assertionBase)(nil)
// where MULTI can be
//
// * (baseindent + 4)-space indented value (multiline text)
+//
// * entries of a list each of the form:
//
-// " "*baseindent " -" ( " " SIMPLEVALUE | "\n" MULTI )
+// " "*baseindent " -" ( " " SIMPLEVALUE | "\n" MULTI )
+//
+// * entries of map each of the form:
+//
+// " "*baseindent " " NAME ":" ( " " SIMPLEVALUE | "\n" MULTI )
//
// baseindent starts at 0 and then grows with nesting matching the
-// previous level introduction (the " "*baseindent " -" bit)
+// previous level introduction (e.g. the " "*baseindent " -" bit)
// length minus 1.
//
// In general the following headers are mandatory:
@@ -369,8 +376,10 @@ var _ Assertion = (*assertionBase)(nil)
//
// revision (a positive int)
// body-length (expected to be equal to the length of BODY)
+// format (a positive int for the format iteration of the type used)
//
// Times are expected to be in the RFC3339 format: "2006-01-02T15:04:05Z07:00".
+//
func Decode(serializedAssertion []byte) (Assertion, error) {
// copy to get an independent backstorage that can't be mutated later
assertionSnapshot := make([]byte, len(serializedAssertion))