coserv

package
v1.1.3-0...-6985b7f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package coserv provides an implementation of draft-howard-rats-coserv

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AKQuad

type AKQuad struct {
	Authorities *comid.CryptoKeys `cbor:"1,keyasint"`
	AKTriple    *comid.KeyTriple  `cbor:"2,keyasint"`
}

type ArtifactType

type ArtifactType uint8
const (
	ArtifactTypeEndorsedValues ArtifactType = iota
	ArtifactTypeTrustAnchors
	ArtifactTypeReferenceValues
)

func (ArtifactType) String

func (a ArtifactType) String() string

String returns the string representation of the target ArtifactType

type CoTSStmt

type CoTSStmt struct {
	Authorities *comid.CryptoKeys    `cbor:"1,keyasint"`
	CoTS        *cots.ConciseTaStore `cbor:"2,keyasint"`
}

type Coserv

type Coserv struct {
	Profile eat.Profile `cbor:"0,keyasint"`
	Query   Query       `cbor:"1,keyasint"`
	Results *ResultSet  `cbor:"2,keyasint,omitempty"`
}

Coserv is the internal representation of a CoSERV data item

func NewCoserv

func NewCoserv(profile string, query Query) (*Coserv, error)

NewCoserv creates a new Coserv instance. An error is returned if the supplied profile or query are invalid

func (*Coserv) AddResults

func (o *Coserv) AddResults(v ResultSet) error

AddResults add the result set to the Coserv target after validating it

func (*Coserv) FromBase64Url

func (o *Coserv) FromBase64Url(s string) error

FromBase64Url deserializes from base64url-encoded into the target Coserv An error is returned if either decoding or validation of the CoSERV payload fails

func (*Coserv) FromCBOR

func (o *Coserv) FromCBOR(data []byte) error

FromCBOR deserializes from CBOR into the target Coserv An error is returned if either decoding or validation of the CoSERV payload fails

func (*Coserv) Sign

func (o *Coserv) Sign(signer cose.Signer) ([]byte, error)

Sign signs and serializes the target Coserv using the supplied go-cose Signer

func (Coserv) ToBase64Url

func (o Coserv) ToBase64Url() (string, error)

ToBase64Url validates and serializes to base64url the target Coserv An error is returned if either validation or encoding of the Coserv target fails

func (Coserv) ToCBOR

func (o Coserv) ToCBOR() ([]byte, error)

ToCBOR validates and serializes to CBOR the target Coserv An error is returned if either validation or encoding of the Coserv target fails

func (Coserv) ToEDN

func (o Coserv) ToEDN() (string, error)

ToEDN encodes the target Coserv to CBOR Extended Diagnostic Notation (EDN)

func (Coserv) Valid

func (o Coserv) Valid() error

Valid ensures that the Coserv target is correctly populated

func (*Coserv) Verify

func (o *Coserv) Verify(verifier cose.Verifier, data []byte) error

Verify verifies the signature of a signed Coserv object using the supplied go-cose Verifier

type EnvironmentSelector

type EnvironmentSelector struct {
	Classes   *[]StatefulClass    `cbor:"0,keyasint,omitempty"`
	Instances *[]StatefulInstance `cbor:"1,keyasint,omitempty"`
	Groups    *[]StatefulGroup    `cbor:"2,keyasint,omitempty"`
}

func NewEnvironmentSelector

func NewEnvironmentSelector() *EnvironmentSelector

NewEnvironmentSelector creates a new EnvironmentSelector instance

func (*EnvironmentSelector) AddClass

AddClass adds the supplied CoMID class to the target EnvironmentSelector

func (*EnvironmentSelector) AddGroup

AddGroup adds the supplied CoMID group to the target EnvironmentSelector

func (*EnvironmentSelector) AddInstance

AddInstance adds the supplied CoMID instance to the target EnvironmentSelector

func (EnvironmentSelector) Valid

func (o EnvironmentSelector) Valid() error

Valid ensures that the target EnvironmentSelector is correctly populated

type Query

type Query struct {
	ArtifactType        ArtifactType        `cbor:"0,keyasint"`
	EnvironmentSelector EnvironmentSelector `cbor:"1,keyasint"`
	ResultType          ResultType          `cbor:"2,keyasint"`
}

Query is the internal representation of a Query data item

func NewQuery

func NewQuery(
	artifactType ArtifactType,
	envSelector EnvironmentSelector,
	resultType ResultType,
) (*Query, error)

NewQuery creates a new Query instance. An error is returned if the supplied environment selector is invalid.

func (Query) Valid

func (o Query) Valid() error

Valid ensures that the Query target is correctly populated

type RefValQuad

type RefValQuad struct {
	Authorities *comid.CryptoKeys  `cbor:"1,keyasint"`
	RVTriple    *comid.ValueTriple `cbor:"2,keyasint"`
}

type ResultSet

type ResultSet struct {
	RVQ *[]RefValQuad `cbor:"0,keyasint,omitempty"`
	AKQ *[]AKQuad     `cbor:"3,keyasint,omitempty"`
	TAS *[]CoTSStmt   `cbor:"4,keyasint,omitempty"`
	// TODO(tho) add endorsed values
	Expiry          *time.Time `cbor:"10,keyasint"`
	SourceArtifacts *[]cmw.CMW `cbor:"11,keyasint,omitempty"`
}

func NewResultSet

func NewResultSet() *ResultSet

NewResultSet instantiates a new ResultSet

func (*ResultSet) AddAttestationKeys

func (o *ResultSet) AddAttestationKeys(v AKQuad) *ResultSet

AddAttestationKeys adds the supplied ak quad to the target ResultSet

func (*ResultSet) AddCoTS

func (o *ResultSet) AddCoTS(v CoTSStmt) *ResultSet

AddCoTS adds the supplied CoTS statement to the target ResultSet

func (*ResultSet) AddReferenceValues

func (o *ResultSet) AddReferenceValues(v RefValQuad) *ResultSet

AddReferenceValues adds the supplied ref-val quad to the target ResultSet

func (*ResultSet) AddSourceArtifacts

func (o *ResultSet) AddSourceArtifacts(v cmw.CMW) *ResultSet

AddSourceArtifacts adds the supplied CMW to the target ResultSet

func (*ResultSet) SetExpiry

func (o *ResultSet) SetExpiry(exp time.Time) *ResultSet

SetExpiry sets the Expiry attribute of the target ResultSet to the supplied time

func (ResultSet) Valid

func (o ResultSet) Valid() error

Valid checks that the supplied ResultSet is syntactically correct

type ResultType

type ResultType uint8
const (
	ResultTypeCollectedArtifacts ResultType = iota
	ResultTypeSourceArtifacts
	ResultTypeBoth
)

func (ResultType) String

func (a ResultType) String() string

String returns the string representation of the target ResultType

type StatefulClass

type StatefulClass struct {
	Class        *comid.Class
	Measurements *comid.Measurements
}

func (StatefulClass) MarshalCBOR

func (o StatefulClass) MarshalCBOR() ([]byte, error)

func (*StatefulClass) UnmarshalCBOR

func (o *StatefulClass) UnmarshalCBOR(data []byte) error

type StatefulGroup

type StatefulGroup struct {
	Group        *comid.Group
	Measurements *comid.Measurements
}

func (StatefulGroup) MarshalCBOR

func (o StatefulGroup) MarshalCBOR() ([]byte, error)

func (*StatefulGroup) UnmarshalCBOR

func (o *StatefulGroup) UnmarshalCBOR(data []byte) error

type StatefulInstance

type StatefulInstance struct {
	Instance     *comid.Instance
	Measurements *comid.Measurements
}

func (StatefulInstance) MarshalCBOR

func (o StatefulInstance) MarshalCBOR() ([]byte, error)

func (*StatefulInstance) UnmarshalCBOR

func (o *StatefulInstance) UnmarshalCBOR(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL