Documentation
¶
Overview ¶
Package head defines the contents to be used in envelope headers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DetectDuplicateStamps = validation.By(duplicateDuplicateStamps)
DetectDuplicateStamps checks if the list of stamps contains duplicate provider keys.
Functions ¶
Types ¶
type CorrectionOptions ¶
type CorrectionOptions struct {
Head *Header `json:"-"` // copy of the original document header
}
CorrectionOptions is used to define base correction options that can be shared between documents.
type Header ¶
type Header struct { // Unique UUIDv1 identifier for the envelope. UUID uuid.UUID `json:"uuid" jsonschema:"title=UUID"` // Digest of the canonical JSON body. Digest *dsig.Digest `json:"dig" jsonschema:"title=Digest"` // Seals of approval from other organisations that can only be added to // non-draft envelopes. Stamps []*Stamp `json:"stamps,omitempty" jsonschema:"title=Stamps"` // Set of labels that describe but have no influence on the data. Tags []string `json:"tags,omitempty" jsonschema:"title=Tags"` // Additional semi-structured information about this envelope. Meta cbc.Meta `json:"meta,omitempty" jsonschema:"title=Meta"` // Any information that may be relevant to other humans about this envelope Notes string `json:"notes,omitempty" jsonschema:"title=Notes"` // When true, implies that this document should not be considered final. Digital signatures are optional. Draft bool `json:"draft,omitempty" jsonschema:"title=Draft"` }
Header defines the metadata of the body. The header is used as the payload for the JSON Web Signatures, so we want this to be as compact as possible.
func NewHeader ¶
func NewHeader() *Header
NewHeader creates a new header and automatically assigns a UUIDv1.
func (*Header) AddStamp ¶
AddStamp adds a new stamp to the header. If the stamp already exists, it will be overwritten.
func (*Header) Contains ¶ added in v0.66.1
Contains compares the provided header to ensure that all the fields and properties are contained within the base header. Only a subset of the most important fields are compared.
type Stamp ¶
type Stamp struct { // Identity of the agency used to create the stamp usually defined by each region. Provider cbc.Key `json:"prv" jsonschema:"title=Provider"` // The serialized stamp value generated for or by the external agency Value string `json:"val" jsonschema:"title=Value"` }
Stamp defines an official seal of approval from a third party like a governmental agency or intermediary and should thus be included in any official envelopes.
func AddStamp ¶
AddStamp makes it easier to add a new Stamp by replacing a previous entry with a matching Key.
func NormalizeStamps ¶ added in v0.67.10
NormalizeStamps will try to clean the stamps by removing rows with empty providers or values. If empty, the function will return nil.