Versions in this module Expand all Collapse all v0 v0.1.0 Nov 12, 2022 v0.0.1 Nov 10, 2022 Changes in this version + const UbuntuCoreWireProtocol + var Err2faFailed = errors.New("two factor authentication failed") + var ErrAuthenticationNeeds2fa = errors.New("two factor authentication required") + var ErrBadQuery = errors.New("bad query") + var ErrInvalidCredentials = errors.New("invalid credentials") + var ErrInvalidScope = errors.New("invalid scope") + var ErrLocalSnap = errors.New("cannot perform operation on local snap") + var ErrNoPaymentMethods = errors.New("no payment methods") + var ErrNoSerial = errors.New("no device serial yet") + var ErrNoUpdateAvailable = errors.New("snap has no updates available") + var ErrPaymentDeclined = errors.New("payment declined") + var ErrSnapNotFound = errors.New("snap not found") + var ErrTOSNotAccepted = errors.New("terms of service not accepted") + var ErrTooManyRequests = errors.New("too many requests") + var ErrUnauthenticated = errors.New("you need to log in first") + var MacaroonACLAPI = developerAPIBase + "dev/api/acl/" + var UbuntuoneDischargeAPI = ubuntuoneAPIBase + "/tokens/discharge" + var UbuntuoneLocation = authLocation() + var UbuntuoneRefreshDischargeAPI = ubuntuoneAPIBase + "/tokens/refresh" + func ClientUserAgent(ctx context.Context) string + func WithClientUserAgent(parent context.Context, req *http.Request) context.Context + type AssertionQuery interface + AddError func(e error, ref *asserts.Ref) error + AddGroupingError func(e error, grouping asserts.Grouping) error + AddSequenceError func(e error, atSeq *asserts.AtSequence) error + ToResolve func() (map[asserts.Grouping][]*asserts.AtRevision, ...) + type AssertionResult struct + Grouping asserts.Grouping + StreamURLs []string + type AuthRefreshNeed struct + Device bool + User bool + type AuthorizeOptions struct + type Authorizer interface + Authorize func(r *http.Request, dauthCtx DeviceAndAuthContext, user *auth.UserState, ...) error + CanAuthorizeForUser func(user *auth.UserState) bool + type CacheManager struct + func NewCacheManager(cacheDir string, maxItems int) *CacheManager + func (cm *CacheManager) Get(cacheKey, targetPath string) error + func (cm *CacheManager) GetPath(cacheKey string) string + func (cm *CacheManager) Put(cacheKey, sourcePath string) error + type Config struct + Architecture string + AssertionsBaseURL *url.URL + Authorizer Authorizer + CacheDownloads int + DeltaFormat string + DetailFields []string + FindFields []string + InfoFields []string + Proxy func(*http.Request) (*url.URL, error) + Series string + StoreBaseURL *url.URL + StoreID string + func DefaultConfig() *Config + type CurrentSnap struct + Block []snap.Revision + CohortKey string + Epoch snap.Epoch + IgnoreValidation bool + InstanceName string + RefreshedDate time.Time + Revision snap.Revision + SnapID string + TrackingChannel string + ValidationSets []snapasserts.ValidationSetKey + type DeviceAndAuthContext interface + CloudInfo func() (*auth.CloudInfo, error) + Device func() (*auth.DeviceState, error) + DeviceSessionRequestParams func(nonce string) (*DeviceSessionRequestParams, error) + ProxyStoreParams func(defaultURL *url.URL) (proxyStoreID string, proxySroreURL *url.URL, err error) + StoreID func(fallback string) (string, error) + UpdateDeviceAuth func(device *auth.DeviceState, sessionMacaroon string) (actual *auth.DeviceState, err error) + UpdateUserAuth func(user *auth.UserState, discharges []string) (actual *auth.UserState, err error) + type DeviceSessionRequestParams struct + Model *asserts.Model + Request *asserts.DeviceSessionRequest + Serial *asserts.Serial + func (p *DeviceSessionRequestParams) EncodedModel() string + func (p *DeviceSessionRequestParams) EncodedRequest() string + func (p *DeviceSessionRequestParams) EncodedSerial() string + type DownloadError struct + Code int + URL *url.URL + func (e *DownloadError) Error() string + type DownloadOptions struct + IsAutoRefresh bool + LeavePartialOnError bool + RateLimit int64 + type HashError struct + func (e HashError) Error() string + type InvalidAuthDataError map[string]stringList + func (e InvalidAuthDataError) Error() string + type PasswordPolicyError map[string]stringList + func (e PasswordPolicyError) Error() string + type RefreshOptions struct + IsAutoRefresh bool + PrivacyKey string + RefreshManaged bool + type RefreshingAuthorizer interface + RefreshAuth func(need AuthRefreshNeed, dauthCtx DeviceAndAuthContext, user *auth.UserState, ...) error + type RevisionNotAvailableError struct + Action string + Channel string + Releases []channel.Channel + func (e *RevisionNotAvailableError) Error() string + type Search struct + Category string + CommonID string + Prefix bool + Private bool + Query string + Scope string + type SnapAction struct + Action string + Channel string + CohortKey string + Epoch snap.Epoch + Flags SnapActionFlags + InstanceName string + Revision snap.Revision + SnapID string + ValidationSets []snapasserts.ValidationSetKey + type SnapActionError struct + Download map[string]error + Install map[string]error + NoResults bool + Other []error + Refresh map[string]error + func (e SnapActionError) Error() string + func (e SnapActionError) SingleOpError() (op, name string, err error) + type SnapActionFlags int + const SnapActionEnforceValidation + const SnapActionIgnoreValidation + type SnapActionResult struct + RedirectChannel string + type SnapAdder interface + AddSnap func(snapName, version, summary string, commands []string) error + type SnapSpec struct + Name string + type Store struct + func New(cfg *Config, dauthCtx DeviceAndAuthContext) *Store + func (s *Store) Assertion(assertType *asserts.AssertionType, primaryKey []string, user *auth.UserState) (asserts.Assertion, error) + func (s *Store) Buy(options *client.BuyOptions, user *auth.UserState) (*client.BuyResult, error) + func (s *Store) CacheDownloads() int + func (s *Store) ConnectivityCheck() (status map[string]bool, err error) + func (s *Store) CreateCohorts(ctx context.Context, snaps []string) (map[string]string, error) + func (s *Store) Download(ctx context.Context, name string, targetPath string, ...) error + func (s *Store) DownloadAssertions(streamURLs []string, b *asserts.Batch, user *auth.UserState) error + func (s *Store) DownloadStream(ctx context.Context, name string, downloadInfo *snap.DownloadInfo, ...) (io.ReadCloser, int, error) + func (s *Store) EnsureDeviceSession() error + func (s *Store) Find(ctx context.Context, search *Search, user *auth.UserState) ([]*snap.Info, error) + func (s *Store) LoginUser(username, password, otp string) (string, string, error) + func (s *Store) ReadyToBuy(user *auth.UserState) error + func (s *Store) Sections(ctx context.Context, user *auth.UserState) ([]string, error) + func (s *Store) SeqFormingAssertion(assertType *asserts.AssertionType, sequenceKey []string, sequence int, ...) (asserts.Assertion, error) + func (s *Store) SetCacheDownloads(fileCount int) + func (s *Store) SnapAction(ctx context.Context, currentSnaps []*CurrentSnap, actions []*SnapAction, ...) ([]SnapActionResult, []AssertionResult, error) + func (s *Store) SnapExists(ctx context.Context, snapSpec SnapSpec, user *auth.UserState) (naming.SnapRef, *channel.Channel, error) + func (s *Store) SnapInfo(ctx context.Context, snapSpec SnapSpec, user *auth.UserState) (*snap.Info, error) + func (s *Store) SuggestedCurrency() string + func (s *Store) UserInfo(email string) (userinfo *User, err error) + func (s *Store) WriteCatalogs(ctx context.Context, names io.Writer, adder SnapAdder) error + type TransferSpeedMonitoringWriter struct + func NewTransferSpeedMonitoringWriterAndContext(origCtx context.Context, measureTimeWindow time.Duration, ...) (*TransferSpeedMonitoringWriter, context.Context) + func (w *TransferSpeedMonitoringWriter) Err() error + func (w *TransferSpeedMonitoringWriter) Monitor() (quit chan bool) + func (w *TransferSpeedMonitoringWriter) Write(p []byte) (n int, err error) + type UnexpectedHTTPStatusError struct + Method string + OopsID string + OpSummary string + StatusCode int + URL *url.URL + func (e *UnexpectedHTTPStatusError) Error() string + type User struct + OpenIDIdentifier string + SSHKeys []string + Username string + type UserAuthUpdater interface + UpdateUserAuth func(user *auth.UserState, discharges []string) (actual *auth.UserState, err error) + type UserAuthorizer struct + func (a UserAuthorizer) Authorize(r *http.Request, _ DeviceAndAuthContext, user *auth.UserState, ...) error + func (a UserAuthorizer) CanAuthorizeForUser(user *auth.UserState) bool + func (a UserAuthorizer) RefreshAuth(need AuthRefreshNeed, dauthCtx DeviceAndAuthContext, user *auth.UserState, ...) error + func (a UserAuthorizer) RefreshUser(user *auth.UserState, upd UserAuthUpdater, client *http.Client) error