storecontext

package
v0.0.0-...-554ba31 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: GPL-3.0 Imports: 10 Imported by: 30

Documentation

Overview

Package storecontext supplies a pluggable implementation of store.DeviceAndAuthContext.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New returns a store.DeviceAndAuthContext using the given full-featured Backend.

func NewComposed

NewComposed returns a store.DeviceAndAuthContext using the given backends.

func StoreID

func StoreID(mod *asserts.Model) string

StoreID returns the store set in the model assertion, if mod != nil and it's not the generic classic model, or the override from the UBUNTU_STORE_ID envvar.

Types

type Backend

A Backend exposes device information and device identity assertions, signing session requests and proxy store assertion. Methods can return state.ErrNoState if the underlying needed information is not (yet) available. They can also assume the state lock is held.

type DeviceBackend

type DeviceBackend interface {
	// Device returns current device state.
	Device() (*auth.DeviceState, error)
	// SetDevice sets the device details in the state.
	SetDevice(device *auth.DeviceState) error

	// Model returns the device model assertion.
	Model() (*asserts.Model, error)
	// Serial returns the device serial assertion.
	Serial() (*asserts.Serial, error)
}

A DeviceBackend exposes device information and device identity assertions. Methods can return state.ErrNoState if the underlying needed information is not (yet) available. They can also assume the state lock is held.

type DeviceSessionRequestParams

type DeviceSessionRequestParams = store.DeviceSessionRequestParams

type DeviceSessionRequestSigner

type DeviceSessionRequestSigner interface {
	// SignDeviceSessionRequest produces a signed device-session-request with for given serial assertion and nonce.
	SignDeviceSessionRequest(serial *asserts.Serial, nonce string) (*asserts.DeviceSessionRequest, error)
}

type StoreOptions

type StoreOptions interface {
	// ProxyStore returns the store assertion for the proxy store if one is set.
	ProxyStore() (*asserts.Store, error)

	// StoreOffline returns a string indicating whether the store should have
	// network access or not
	StoreOffline() (bool, error)
}

Jump to

Keyboard shortcuts

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