asserts

package
v0.0.0-...-7cedb2b Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2016 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Overview

Package asserts implements snappy assertions and a database abstraction for managing and holding them.

Index

Constants

View Source
const (
	MaxBodySize      = 2 * 1024 * 1024
	MaxHeadersSize   = 128 * 1024
	MaxSignatureSize = 128 * 1024
)

Maximum assertion component sizes.

View Source
const MediaType = "application/x.ubuntu.assertion"

MediaType is the media type for encoded assertions on the wire.

Variables

View Source
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.

DefaultCheckers lists the default and recommended assertion checkers used by Database if none are specified in the DatabaseConfig.Checkers.

View Source
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 Encode

func Encode(assert Assertion) []byte

Encode serializes an assertion.

func EncodeDigest

func EncodeDigest(hash crypto.Hash, hashDigest []byte) (string, error)

EncodeDigest encodes a hash algorithm and a digest to be put in an assertion header.

func EncodePublicKey

func EncodePublicKey(pubKey PublicKey) ([]byte, error)

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) AccountID

func (acc *Account) AccountID() string

AccountID returns the account-id of the account.

func (*Account) AuthorityID

func (ab *Account) AuthorityID() string

AuthorityID returns the authority-id a.k.a the signer id of the assertion.

func (*Account) Body

func (ab *Account) Body() []byte

Body returns the body of the assertion.

func (*Account) DisplayName

func (acc *Account) DisplayName() string

DisplayName returns the human-friendly name for the account.

func (*Account) Header

func (ab *Account) Header(name string) string

Header returns the value of an header by name.

func (*Account) Headers

func (ab *Account) Headers() map[string]string

Headers returns the complete headers.

func (*Account) IsCertified

func (acc *Account) IsCertified() bool

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.

func (*Account) Timestamp

func (acc *Account) Timestamp() time.Time

Timestamp returns the time when the account was issued.

func (*Account) Type

func (ab *Account) Type() *AssertionType

Type returns the assertion type.

func (*Account) Username

func (acc *Account) Username() string

Username returns the user name for the account.

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) Header

func (ab *AccountKey) Header(name string) string

Header returns the value of an header by name.

func (*AccountKey) Headers

func (ab *AccountKey) Headers() map[string]string

Headers returns the complete headers.

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 Assemble

func Assemble(headers map[string]string, body, content, signature []byte) (Assertion, error)

Assemble assembles an assertion from its components.

func Decode

func Decode(serializedAssertion []byte) (Assertion, error)

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.

func Type

func Type(name string) *AssertionType

Type returns the AssertionType with name or nil

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

func OpenFSBackstore(path string) (Backstore, error)

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

func (db *Database) Add(assert Assertion) error

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

func (db *Database) Check(assert Assertion) error

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

func (db *Database) IsTrustedAccount(accountID string) bool

IsTrustedAccount returns whether the account is part of the trusted set.

func (*Database) PublicKey

func (db *Database) PublicKey(authorityID string, keyID string) (PublicKey, error)

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

func NewDecoder(r io.Reader) *Decoder

NewDecoder returns a Decoder to parse the stream of assertions from the reader.

func (*Decoder) Decode

func (d *Decoder) Decode() (Assertion, error)

Decode parses the next assertion from the stream. It returns the error io.EOF at the end of a well-formed stream.

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

func NewEncoder(w io.Writer) *Encoder

NewEncoder returns a Encoder to emit a stream of assertions to a writer.

func (*Encoder) Encode

func (enc *Encoder) Encode(assert Assertion) error

Encode emits the assertion into the stream with the required separator. Errors here are always about writing given that Encode() itself cannot error.

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

func (mod *Model) AllowedModes() []string

AllowedModes returns which ones of the "classic" and "developer" modes are allowed for the model.

func (*Model) Architecture

func (mod *Model) Architecture() string

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) Body

func (ab *Model) Body() []byte

Body returns the body of the assertion.

func (*Model) BrandID

func (mod *Model) BrandID() string

BrandID returns the brand identifier. Same as the authority id.

func (*Model) Class

func (mod *Model) Class() string

Class returns which class the model belongs to defining policies for additional software installation.

func (*Model) Core

func (mod *Model) Core() string

Core returns the core snap the model uses.

func (*Model) Gadget

func (mod *Model) Gadget() string

Gadget returns the gadget snap the model uses.

func (*Model) Header

func (ab *Model) Header(name string) string

Header returns the value of an header by name.

func (*Model) Headers

func (ab *Model) Headers() map[string]string

Headers returns the complete headers.

func (*Model) Kernel

func (mod *Model) Kernel() string

Kernel returns the kernel snap the model uses.

func (*Model) Model

func (mod *Model) Model() string

Model returns the model name identifier.

func (*Model) RequiredSnaps

func (mod *Model) RequiredSnaps() []string

RequiredSnaps returns the snaps that must be installed at all times and cannot be removed for this model.

func (*Model) Revision

func (ab *Model) Revision() int

Revision returns the assertion revision.

func (*Model) Series

func (mod *Model) Series() string

Series returns the series of the core software the model uses.

func (*Model) Signature

func (ab *Model) Signature() (content, signature []byte)

Signature returns the signed content and its unprocessed signature.

func (*Model) Store

func (mod *Model) Store() string

Store returns the snap store the model uses.

func (*Model) Timestamp

func (mod *Model) Timestamp() time.Time

Timestamp returns the time when the model assertion was issued.

func (*Model) Type

func (ab *Model) Type() *AssertionType

Type returns the assertion type.

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

func OpenPGPPublicKey(pubKey *packet.PublicKey) PublicKey

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) Body

func (ab *Serial) Body() []byte

Body returns the body of the assertion.

func (*Serial) BrandID

func (ser *Serial) BrandID() string

BrandID returns the brand identifier of the device.

func (*Serial) DeviceKey

func (ser *Serial) DeviceKey() PublicKey

DeviceKey returns the public key of the device.

func (*Serial) Header

func (ab *Serial) Header(name string) string

Header returns the value of an header by name.

func (*Serial) Headers

func (ab *Serial) Headers() map[string]string

Headers returns the complete headers.

func (*Serial) Model

func (ser *Serial) Model() string

Model returns the model name identifier of the device.

func (*Serial) Revision

func (ab *Serial) Revision() int

Revision returns the assertion revision.

func (*Serial) Serial

func (ser *Serial) Serial() string

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.

func (*Serial) Timestamp

func (ser *Serial) Timestamp() time.Time

Timestamp returns the time when the serial assertion was issued.

func (*Serial) Type

func (ab *Serial) Type() *AssertionType

Type returns the assertion type.

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) Body

func (ab *SnapBuild) Body() []byte

Body returns the body of the assertion.

func (*SnapBuild) Grade

func (snapbld *SnapBuild) Grade() string

Grade returns the grade of the snap: devel|stable

func (*SnapBuild) Header

func (ab *SnapBuild) Header(name string) string

Header returns the value of an header by name.

func (*SnapBuild) Headers

func (ab *SnapBuild) Headers() map[string]string

Headers returns the complete headers.

func (*SnapBuild) Revision

func (ab *SnapBuild) Revision() int

Revision returns the assertion revision.

func (*SnapBuild) Series

func (snapbld *SnapBuild) Series() string

Series returns the series for which the snap was built.

func (*SnapBuild) Signature

func (ab *SnapBuild) Signature() (content, signature []byte)

Signature returns the signed content and its unprocessed signature.

func (*SnapBuild) SnapDigest

func (snapbld *SnapBuild) SnapDigest() string

SnapDigest returns the digest of the snap. The digest is prefixed with the algorithm used to generate it.

func (*SnapBuild) SnapID

func (snapbld *SnapBuild) SnapID() string

SnapID returns the snap id of the snap.

func (*SnapBuild) SnapSize

func (snapbld *SnapBuild) SnapSize() uint64

SnapSize returns the size of the snap.

func (*SnapBuild) Timestamp

func (snapbld *SnapBuild) Timestamp() time.Time

Timestamp returns the time when the snap-build assertion was created.

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) Header

func (ab *SnapDeclaration) Header(name string) string

Header returns the value of an header by name.

func (*SnapDeclaration) Headers

func (ab *SnapDeclaration) Headers() map[string]string

Headers returns the complete headers.

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) Header

func (ab *SnapRevision) Header(name string) string

Header returns the value of an header by name.

func (*SnapRevision) Headers

func (ab *SnapRevision) Headers() map[string]string

Headers returns the complete headers.

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.

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.

Jump to

Keyboard shortcuts

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