Documentation ¶
Overview ¶
Package asserts implements snappy assertions and a database abstraction for managing and holding them.
Index ¶
- Constants
- Variables
- func CheckCrossConsistency(assert Assertion, signature Signature, signingKey *AccountKey, roDB RODatabase, ...) error
- func CheckSignature(assert Assertion, signature Signature, signingKey *AccountKey, roDB RODatabase, ...) error
- func CheckSigningKeyIsNotExpired(assert Assertion, signature Signature, signingKey *AccountKey, roDB RODatabase, ...) error
- func CheckTimestampVsSigningKeyValidity(assert Assertion, signature Signature, signingKey *AccountKey, roDB RODatabase, ...) error
- func Encode(assert Assertion) []byte
- func EncodeDigest(hash crypto.Hash, hashDigest []byte) (string, error)
- func EncodePublicKey(pubKey PublicKey) ([]byte, error)
- type Account
- func (acc *Account) AccountID() string
- func (ab *Account) AuthorityID() string
- func (ab *Account) Body() []byte
- func (acc *Account) DisplayName() string
- func (ab *Account) Header(name string) string
- func (ab *Account) Headers() map[string]string
- func (acc *Account) IsCertified() bool
- func (ab *Account) Revision() int
- func (ab *Account) Signature() (content, signature []byte)
- func (acc *Account) Timestamp() time.Time
- func (ab *Account) Type() *AssertionType
- func (acc *Account) Username() string
- type AccountKey
- func (ak *AccountKey) AccountID() string
- func (ab *AccountKey) AuthorityID() string
- func (ab *AccountKey) Body() []byte
- func (ab *AccountKey) Header(name string) string
- func (ab *AccountKey) Headers() map[string]string
- func (ak *AccountKey) PublicKeyFingerprint() string
- func (ak *AccountKey) PublicKeyID() string
- func (ab *AccountKey) Revision() int
- func (ab *AccountKey) Signature() (content, signature []byte)
- func (ak *AccountKey) Since() time.Time
- func (ab *AccountKey) Type() *AssertionType
- func (ak *AccountKey) Until() time.Time
- type Assertion
- type AssertionType
- type Backstore
- type Checker
- type Database
- func (db *Database) Add(assert Assertion) error
- func (db *Database) Check(assert Assertion) error
- func (db *Database) Find(assertionType *AssertionType, headers map[string]string) (Assertion, error)
- func (db *Database) FindMany(assertionType *AssertionType, headers map[string]string) ([]Assertion, error)
- func (db *Database) ImportKey(authorityID string, privKey PrivateKey) error
- func (db *Database) IsTrustedAccount(accountID string) bool
- func (db *Database) PublicKey(authorityID string, keyID string) (PublicKey, error)
- func (db *Database) Sign(assertType *AssertionType, headers map[string]string, body []byte, ...) (Assertion, error)
- type DatabaseConfig
- type Decoder
- type Encoder
- type KeypairManager
- type Model
- func (mod *Model) AllowedModes() []string
- func (mod *Model) Architecture() string
- func (ab *Model) AuthorityID() string
- func (ab *Model) Body() []byte
- func (mod *Model) BrandID() string
- func (mod *Model) Class() string
- func (mod *Model) Core() string
- func (mod *Model) Gadget() string
- func (ab *Model) Header(name string) string
- func (ab *Model) Headers() map[string]string
- func (mod *Model) Kernel() string
- func (mod *Model) Model() string
- func (mod *Model) RequiredSnaps() []string
- func (ab *Model) Revision() int
- func (mod *Model) Series() string
- func (ab *Model) Signature() (content, signature []byte)
- func (mod *Model) Store() string
- func (mod *Model) Timestamp() time.Time
- func (ab *Model) Type() *AssertionType
- type PrivateKey
- type PublicKey
- type RODatabase
- type RevisionError
- type Serial
- func (ab *Serial) AuthorityID() string
- func (ab *Serial) Body() []byte
- func (ser *Serial) BrandID() string
- func (ser *Serial) DeviceKey() PublicKey
- func (ab *Serial) Header(name string) string
- func (ab *Serial) Headers() map[string]string
- func (ser *Serial) Model() string
- func (ab *Serial) Revision() int
- func (ser *Serial) Serial() string
- func (ab *Serial) Signature() (content, signature []byte)
- func (ser *Serial) Timestamp() time.Time
- func (ab *Serial) Type() *AssertionType
- type Signature
- type SnapBuild
- func (ab *SnapBuild) AuthorityID() string
- func (ab *SnapBuild) Body() []byte
- func (snapbld *SnapBuild) Grade() string
- func (ab *SnapBuild) Header(name string) string
- func (ab *SnapBuild) Headers() map[string]string
- func (ab *SnapBuild) Revision() int
- func (snapbld *SnapBuild) Series() string
- func (ab *SnapBuild) Signature() (content, signature []byte)
- func (snapbld *SnapBuild) SnapDigest() string
- func (snapbld *SnapBuild) SnapID() string
- func (snapbld *SnapBuild) SnapSize() uint64
- func (snapbld *SnapBuild) Timestamp() time.Time
- func (ab *SnapBuild) Type() *AssertionType
- type SnapDeclaration
- func (ab *SnapDeclaration) AuthorityID() string
- func (ab *SnapDeclaration) Body() []byte
- func (snapdcl *SnapDeclaration) Gates() []string
- func (ab *SnapDeclaration) Header(name string) string
- func (ab *SnapDeclaration) Headers() map[string]string
- func (snapdcl *SnapDeclaration) PublisherID() string
- func (ab *SnapDeclaration) Revision() int
- func (snapdcl *SnapDeclaration) Series() string
- func (ab *SnapDeclaration) Signature() (content, signature []byte)
- func (snapdcl *SnapDeclaration) SnapID() string
- func (snapdcl *SnapDeclaration) SnapName() string
- func (snapdcl *SnapDeclaration) Timestamp() time.Time
- func (ab *SnapDeclaration) Type() *AssertionType
- type SnapRevision
- func (ab *SnapRevision) AuthorityID() string
- func (ab *SnapRevision) Body() []byte
- func (snaprev *SnapRevision) DeveloperID() string
- func (ab *SnapRevision) Header(name string) string
- func (ab *SnapRevision) Headers() map[string]string
- func (ab *SnapRevision) Revision() int
- func (snaprev *SnapRevision) Series() string
- func (ab *SnapRevision) Signature() (content, signature []byte)
- func (snaprev *SnapRevision) SnapDigest() string
- func (snaprev *SnapRevision) SnapID() string
- func (snaprev *SnapRevision) SnapRevision() uint64
- func (snaprev *SnapRevision) SnapSize() uint64
- func (snaprev *SnapRevision) Timestamp() time.Time
- func (ab *SnapRevision) Type() *AssertionType
Constants ¶
const ( MaxBodySize = 2 * 1024 * 1024 MaxHeadersSize = 128 * 1024 MaxSignatureSize = 128 * 1024 )
Maximum assertion component sizes.
const MediaType = "application/x.ubuntu.assertion"
MediaType is the media type for encoded assertions on the wire.
Variables ¶
var ( AccountType = &AssertionType{"account", []string{"account-id"}, assembleAccount} AccountKeyType = &AssertionType{"account-key", []string{"account-id", "public-key-id"}, assembleAccountKey} ModelType = &AssertionType{"model", []string{"series", "brand-id", "model"}, assembleModel} SerialType = &AssertionType{"serial", []string{"brand-id", "model", "serial"}, assembleSerial} SnapDeclarationType = &AssertionType{"snap-declaration", []string{"series", "snap-id"}, assembleSnapDeclaration} SnapBuildType = &AssertionType{"snap-build", []string{"series", "snap-id", "snap-digest"}, assembleSnapBuild} SnapRevisionType = &AssertionType{"snap-revision", []string{"series", "snap-id", "snap-digest"}, assembleSnapRevision} )
Understood assertion types.
var DefaultCheckers = []Checker{ CheckSigningKeyIsNotExpired, CheckSignature, CheckTimestampVsSigningKeyValidity, CheckCrossConsistency, }
DefaultCheckers lists the default and recommended assertion checkers used by Database if none are specified in the DatabaseConfig.Checkers.
var (
ErrNotFound = errors.New("assertion not found")
)
Well-known errors
Functions ¶
func CheckCrossConsistency ¶
func CheckCrossConsistency(assert Assertion, signature Signature, signingKey *AccountKey, roDB RODatabase, checkTime time.Time) error
CheckCrossConsistency verifies that the assertion is consistent with the other statements in the database.
func CheckSignature ¶
func CheckSignature(assert Assertion, signature Signature, signingKey *AccountKey, roDB RODatabase, checkTime time.Time) error
CheckSignature checks that the signature is valid.
func CheckSigningKeyIsNotExpired ¶
func CheckSigningKeyIsNotExpired(assert Assertion, signature Signature, signingKey *AccountKey, roDB RODatabase, checkTime time.Time) error
CheckSigningKeyIsNotExpired checks that the signing key is not expired.
func CheckTimestampVsSigningKeyValidity ¶
func CheckTimestampVsSigningKeyValidity(assert Assertion, signature Signature, signingKey *AccountKey, roDB RODatabase, checkTime time.Time) error
CheckTimestampVsSigningKeyValidity verifies that the timestamp of the assertion is within the signing key validity.
func EncodeDigest ¶
EncodeDigest encodes a hash algorithm and a digest to be put in an assertion header.
func EncodePublicKey ¶
EncodePublicKey serializes a public key, typically for embedding in an assertion.
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
Account holds an account assertion, which ties a name for an account to its identifier and provides the authority's confidence in the name's validity.
func (*Account) AuthorityID ¶
func (ab *Account) AuthorityID() string
AuthorityID returns the authority-id a.k.a the signer id of the assertion.
func (*Account) DisplayName ¶
DisplayName returns the human-friendly name for the account.
func (*Account) IsCertified ¶
IsCertified returns true if the authority has confidence in the account's name.
func (*Account) Revision ¶
func (ab *Account) Revision() int
Revision returns the assertion revision.
func (*Account) Signature ¶
func (ab *Account) Signature() (content, signature []byte)
Signature returns the signed content and its unprocessed signature.
type AccountKey ¶
type AccountKey struct {
// contains filtered or unexported fields
}
AccountKey holds an account-key assertion, asserting a public key belonging to the account.
func (*AccountKey) AccountID ¶
func (ak *AccountKey) AccountID() string
AccountID returns the account-id of this account-key.
func (*AccountKey) AuthorityID ¶
func (ab *AccountKey) AuthorityID() string
AuthorityID returns the authority-id a.k.a the signer id of the assertion.
func (*AccountKey) Body ¶
func (ab *AccountKey) Body() []byte
Body returns the body of the assertion.
func (*AccountKey) PublicKeyFingerprint ¶
func (ak *AccountKey) PublicKeyFingerprint() string
PublicKeyFingerprint returns the fingerprint of the account key.
func (*AccountKey) PublicKeyID ¶
func (ak *AccountKey) PublicKeyID() string
PublicKeyID returns the key id (as used to match signatures to signing keys) for the account key.
func (*AccountKey) Revision ¶
func (ab *AccountKey) Revision() int
Revision returns the assertion revision.
func (*AccountKey) Signature ¶
func (ab *AccountKey) Signature() (content, signature []byte)
Signature returns the signed content and its unprocessed signature.
func (*AccountKey) Since ¶
func (ak *AccountKey) Since() time.Time
Since returns the time when the account key starts being valid.
func (*AccountKey) Type ¶
func (ab *AccountKey) Type() *AssertionType
Type returns the assertion type.
func (*AccountKey) Until ¶
func (ak *AccountKey) Until() time.Time
Until returns the time when the account key stops being valid.
type Assertion ¶
type Assertion interface { // Type returns the type of this assertion Type() *AssertionType // Revision returns the revision of this assertion Revision() int // AuthorityID returns the authority that signed this assertion AuthorityID() string // Header retrieves the header with name Header(name string) string // Headers returns the complete headers Headers() map[string]string // Body returns the body of this assertion Body() []byte // Signature returns the signed content and its unprocessed signature Signature() (content, signature []byte) }
Assertion represents an assertion through its general elements.
func Decode ¶
Decode parses a serialized assertion.
The expected serialisation format looks like:
HEADER ("\n\n" BODY?)? "\n\n" SIGNATURE
where:
HEADER is a set of header entries separated by "\n" BODY can be arbitrary, SIGNATURE is the signature
A header entry for a single line value (no '\n' in it) looks like:
NAME ": " VALUE
A header entry for a multiline value (a value with '\n's in it) looks like:
NAME ":\n" 1-space indented VALUE
The following headers are mandatory:
type authority-id (the signer id)
Further for a given assertion type all the primary key headers must be non empty and must not contain '/'.
The following headers expect integer values and if omitted otherwise are assumed to be 0:
revision (a positive int) body-length (expected to be equal to the length of BODY)
Typically list values in headers are expected to be comma separated. Times are expected to be in the RFC3339 format: "2006-01-02T15:04:05Z07:00".
type AssertionType ¶
type AssertionType struct { // Name of the type. Name string // PrimaryKey holds the names of the headers that constitute the // unique primary key for this assertion type. PrimaryKey []string // contains filtered or unexported fields }
AssertionType describes a known assertion type with its name and metadata.
type Backstore ¶
type Backstore interface { // Put stores an assertion. // It is responsible for checking that assert is newer than a // previously stored revision with the same primary key headers. Put(assertType *AssertionType, assert Assertion) error // Get returns the assertion with the given unique key for its primary key headers. // If none is present it returns ErrNotFound. Get(assertType *AssertionType, key []string) (Assertion, error) // Search returns assertions matching the given headers. // It invokes foundCb for each found assertion. Search(assertType *AssertionType, headers map[string]string, foundCb func(Assertion)) error }
A Backstore stores assertions. It can store and retrieve assertions by type under unique primary key headers (whose names are available from assertType.PrimaryKey). Plus it supports searching by headers.
func NewMemoryBackstore ¶
func NewMemoryBackstore() Backstore
NewMemoryBackstore creates a memory backed assertions backstore.
func OpenFSBackstore ¶
OpenFSBackstore opens a filesystem backed assertions backstore under path.
type Checker ¶
type Checker func(assert Assertion, signature Signature, signingKey *AccountKey, roDB RODatabase, checkTime time.Time) error
A Checker defines a check on an assertion considering aspects such as its signature, the signing key, and consistency with other assertions in the database.
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database holds assertions and can be used to sign or check further assertions.
func OpenDatabase ¶
func OpenDatabase(cfg *DatabaseConfig) (*Database, error)
OpenDatabase opens the assertion database based on the configuration.
func (*Database) Add ¶
Add persists the assertion after ensuring it is properly signed and consistent with all the stored knowledge. It will return an error when trying to add an older revision of the assertion than the one currently stored.
func (*Database) Check ¶
Check tests whether the assertion is properly signed and consistent with all the stored knowledge.
func (*Database) Find ¶
func (db *Database) Find(assertionType *AssertionType, headers map[string]string) (Assertion, error)
Find an assertion based on arbitrary headers. Provided headers must contain the primary key for the assertion type. It returns ErrNotFound if the assertion cannot be found.
func (*Database) FindMany ¶
func (db *Database) FindMany(assertionType *AssertionType, headers map[string]string) ([]Assertion, error)
FindMany finds assertions based on arbitrary headers. It returns ErrNotFound if no assertion can be found.
func (*Database) ImportKey ¶
func (db *Database) ImportKey(authorityID string, privKey PrivateKey) error
ImportKey stores the given private/public key pair for identity.
func (*Database) IsTrustedAccount ¶
IsTrustedAccount returns whether the account is part of the trusted set.
func (*Database) PublicKey ¶
PublicKey returns the public key owned by authorityID that has the given key id.
func (*Database) Sign ¶
func (db *Database) Sign(assertType *AssertionType, headers map[string]string, body []byte, keyID string) (Assertion, error)
Sign assembles an assertion with the provided information and signs it with the private key from `headers["authority-id"]` that has the provided key id.
type DatabaseConfig ¶
type DatabaseConfig struct { // trusted assertions (account and account-key supported) Trusted []Assertion // backstore for assertions, left unset storing assertions will error Backstore Backstore // manager/backstore for keypairs, mandatory KeypairManager KeypairManager // assertion checkers used by Database.Check, left unset DefaultCheckers will be used which is recommended Checkers []Checker }
DatabaseConfig for an assertion database.
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder parses a stream of assertions bundled by separating them with double newlines.
func NewDecoder ¶
NewDecoder returns a Decoder to parse the stream of assertions from the reader.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder emits a stream of assertions bundled by separating them with double newlines.
func NewEncoder ¶
NewEncoder returns a Encoder to emit a stream of assertions to a writer.
type KeypairManager ¶
type KeypairManager interface { // Put stores the given private/public key pair for identity, // making sure it can be later retrieved by authority-id and // key id with Get(). // Trying to store a key with an already present key id should // result in an error. Put(authorityID string, privKey PrivateKey) error // Get returns the private/public key pair with the given key id. Get(authorityID, keyID string) (PrivateKey, error) }
A KeypairManager is a manager and backstore for private/public key pairs.
func NewGPGKeypairManager ¶
func NewGPGKeypairManager(homedir string) KeypairManager
NewGPGKeypairManager creates a new key pair manager backed by a local GnuPG setup using the given GPG homedir, and asking GPG to fallback "~/.gnupg" to default if empty. Importing keys through the keypair manager interface is not suppored. Main purpose is allowing signing using keys from a GPG setup.
func NewMemoryKeypairManager ¶
func NewMemoryKeypairManager() KeypairManager
NewMemoryKeypairManager creates a new key pair manager with a memory backstore.
func OpenFSKeypairManager ¶
func OpenFSKeypairManager(path string) (KeypairManager, error)
OpenFSKeypairManager opens a filesystem backed assertions backstore under path.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model holds a model assertion, which is a statement by a brand about the properties of a device model.
func (*Model) AllowedModes ¶
AllowedModes returns which ones of the "classic" and "developer" modes are allowed for the model.
func (*Model) Architecture ¶
Architecture returns the archicteture the model is based on.
func (*Model) AuthorityID ¶
func (ab *Model) AuthorityID() string
AuthorityID returns the authority-id a.k.a the signer id of the assertion.
func (*Model) Class ¶
Class returns which class the model belongs to defining policies for additional software installation.
func (*Model) RequiredSnaps ¶
RequiredSnaps returns the snaps that must be installed at all times and cannot be removed for this model.
func (*Model) Signature ¶
func (ab *Model) Signature() (content, signature []byte)
Signature returns the signed content and its unprocessed signature.
type PrivateKey ¶
type PrivateKey interface { // PublicKey returns the public part of the pair. PublicKey() PublicKey // contains filtered or unexported methods }
PrivateKey is a cryptographic private/public key pair.
func GenerateKey ¶
func GenerateKey() (PrivateKey, error)
GenerateKey generates a private/public key pair.
func OpenPGPPrivateKey ¶
func OpenPGPPrivateKey(privk *packet.PrivateKey) PrivateKey
OpenPGPPrivateKey returns a PrivateKey for database use out of a opengpg packet.PrivateKey.
type PublicKey ¶
type PublicKey interface { // Fingerprint returns the key fingerprint. Fingerprint() string // ID returns the id of the key as used to match signatures to their signing key. ID() string // contains filtered or unexported methods }
PublicKey is the public part of a cryptographic private/public key pair.
func OpenPGPPublicKey ¶
OpenPGPPublicKey returns a database useable public key out of a opengpg packet.PulicKey.
type RODatabase ¶
type RODatabase interface { // IsTrustedAccount returns whether the account is part of the trusted set. IsTrustedAccount(accountID string) bool // Find an assertion based on arbitrary headers. // Provided headers must contain the primary key for the assertion type. // It returns ErrNotFound if the assertion cannot be found. Find(assertionType *AssertionType, headers map[string]string) (Assertion, error) // FindMany finds assertions based on arbitrary headers. // It returns ErrNotFound if no assertion can be found. FindMany(assertionType *AssertionType, headers map[string]string) ([]Assertion, error) }
A RODatabase exposes read-only access to an assertion database.
type RevisionError ¶
type RevisionError struct {
Used, Current int
}
RevisionError indicates a revision improperly used for an operation.
func (*RevisionError) Error ¶
func (e *RevisionError) Error() string
type Serial ¶
type Serial struct {
// contains filtered or unexported fields
}
Serial holds a serial assertion, which is a statement binding a device identity with the device public key.
func (*Serial) AuthorityID ¶
func (ab *Serial) AuthorityID() string
AuthorityID returns the authority-id a.k.a the signer id of the assertion.
func (*Serial) Serial ¶
Serial returns the serial identifier of the device, together with brand id and model they form the unique identifier of the device.
func (*Serial) Signature ¶
func (ab *Serial) Signature() (content, signature []byte)
Signature returns the signed content and its unprocessed signature.
type Signature ¶
type Signature interface { // KeyID() returns a suffix of the signing key fingerprint KeyID() string }
Signature is a cryptographic signature.
type SnapBuild ¶
type SnapBuild struct {
// contains filtered or unexported fields
}
SnapBuild holds a snap-build assertion, asserting the properties of a snap at the time it was built by the developer.
func (*SnapBuild) AuthorityID ¶
func (ab *SnapBuild) AuthorityID() string
AuthorityID returns the authority-id a.k.a the signer id of the assertion.
func (*SnapBuild) Revision ¶
func (ab *SnapBuild) Revision() int
Revision returns the assertion revision.
func (*SnapBuild) Signature ¶
func (ab *SnapBuild) Signature() (content, signature []byte)
Signature returns the signed content and its unprocessed signature.
func (*SnapBuild) SnapDigest ¶
SnapDigest returns the digest of the snap. The digest is prefixed with the algorithm used to generate it.
func (*SnapBuild) Type ¶
func (ab *SnapBuild) Type() *AssertionType
Type returns the assertion type.
type SnapDeclaration ¶
type SnapDeclaration struct {
// contains filtered or unexported fields
}
SnapDeclaration holds a snap-declaration assertion, declaring a snap binding its identifying snap-id to a name, asserting its publisher and its other properties.
func (*SnapDeclaration) AuthorityID ¶
func (ab *SnapDeclaration) AuthorityID() string
AuthorityID returns the authority-id a.k.a the signer id of the assertion.
func (*SnapDeclaration) Body ¶
func (ab *SnapDeclaration) Body() []byte
Body returns the body of the assertion.
func (*SnapDeclaration) Gates ¶
func (snapdcl *SnapDeclaration) Gates() []string
Gates returns the list of snap-ids gated by this snap.
func (*SnapDeclaration) PublisherID ¶
func (snapdcl *SnapDeclaration) PublisherID() string
PublisherID returns the identifier of the publisher of the declared snap.
func (*SnapDeclaration) Revision ¶
func (ab *SnapDeclaration) Revision() int
Revision returns the assertion revision.
func (*SnapDeclaration) Series ¶
func (snapdcl *SnapDeclaration) Series() string
Series returns the series for which the snap is being declared.
func (*SnapDeclaration) Signature ¶
func (ab *SnapDeclaration) Signature() (content, signature []byte)
Signature returns the signed content and its unprocessed signature.
func (*SnapDeclaration) SnapID ¶
func (snapdcl *SnapDeclaration) SnapID() string
SnapID returns the snap id of the declared snap.
func (*SnapDeclaration) SnapName ¶
func (snapdcl *SnapDeclaration) SnapName() string
SnapName returns the declared snap name.
func (*SnapDeclaration) Timestamp ¶
func (snapdcl *SnapDeclaration) Timestamp() time.Time
Timestamp returns the time when the snap-declaration was issued.
func (*SnapDeclaration) Type ¶
func (ab *SnapDeclaration) Type() *AssertionType
Type returns the assertion type.
type SnapRevision ¶
type SnapRevision struct {
// contains filtered or unexported fields
}
SnapRevision holds a snap-revision assertion, which is a statement by the store acknowledging the receipt of a build of a snap and labeling it with a snap revision.
func (*SnapRevision) AuthorityID ¶
func (ab *SnapRevision) AuthorityID() string
AuthorityID returns the authority-id a.k.a the signer id of the assertion.
func (*SnapRevision) Body ¶
func (ab *SnapRevision) Body() []byte
Body returns the body of the assertion.
func (*SnapRevision) DeveloperID ¶
func (snaprev *SnapRevision) DeveloperID() string
DeveloperID returns the id of the developer that submitted this build of the snap.
func (*SnapRevision) Revision ¶
func (ab *SnapRevision) Revision() int
Revision returns the assertion revision.
func (*SnapRevision) Series ¶
func (snaprev *SnapRevision) Series() string
Series returns the series of the snap submitted to and acknowledged by the store.
func (*SnapRevision) Signature ¶
func (ab *SnapRevision) Signature() (content, signature []byte)
Signature returns the signed content and its unprocessed signature.
func (*SnapRevision) SnapDigest ¶
func (snaprev *SnapRevision) SnapDigest() string
SnapDigest returns the digest of the snap submitted to and acknowledged by the store. The digest is prefixed with the algorithm used to generate it.
func (*SnapRevision) SnapID ¶
func (snaprev *SnapRevision) SnapID() string
SnapID returns the snap id of the snap.
func (*SnapRevision) SnapRevision ¶
func (snaprev *SnapRevision) SnapRevision() uint64
SnapRevision returns the revision assigned to this build of the snap.
func (*SnapRevision) SnapSize ¶
func (snaprev *SnapRevision) SnapSize() uint64
SnapSize returns the size in bytes of the snap submitted to the store.
func (*SnapRevision) Timestamp ¶
func (snaprev *SnapRevision) Timestamp() time.Time
Timestamp returns the time when the snap-revision was issued.
func (*SnapRevision) Type ¶
func (ab *SnapRevision) Type() *AssertionType
Type returns the assertion type.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package assertstest provides helpers for testing code that involves assertions.
|
Package assertstest provides helpers for testing code that involves assertions. |
Package sysdb supports the system-wide assertion database with ways to open it and to manage the trusted set of assertions founding it.
|
Package sysdb supports the system-wide assertion database with ways to open it and to manage the trusted set of assertions founding it. |
Package systestkeys defines trusted assertions and keys to use in tests.
|
Package systestkeys defines trusted assertions and keys to use in tests. |