Documentation
¶
Index ¶
- type BakeryConfigService
- func (s *BakeryConfigService) GetExternalUsersThirdPartyKey(ctx context.Context) (*bakery.KeyPair, error)
- func (s *BakeryConfigService) GetLocalUsersKey(ctx context.Context) (*bakery.KeyPair, error)
- func (s *BakeryConfigService) GetLocalUsersThirdPartyKey(ctx context.Context) (*bakery.KeyPair, error)
- func (s *BakeryConfigService) GetOffersThirdPartyKey(ctx context.Context) (*bakery.KeyPair, error)
- func (s *BakeryConfigService) InitialiseBakeryConfig(ctx context.Context) error
- type BakeryConfigState
- type RootKeyService
- func (s *RootKeyService) FindLatestKeyContext(ctx context.Context, createdAfter, expiresAfter, expiresBefore time.Time) (dbrootkeystore.RootKey, error)
- func (s *RootKeyService) GetKeyContext(ctx context.Context, id []byte) (dbrootkeystore.RootKey, error)
- func (s *RootKeyService) InsertKeyContext(ctx context.Context, key dbrootkeystore.RootKey) error
- type RootKeyState
- type Service
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BakeryConfigService ¶
type BakeryConfigService struct {
// contains filtered or unexported fields
}
BakeryConfigService provides the API for the bakery config
func NewBakeryConfigService ¶
func NewBakeryConfigService(st BakeryConfigState) *BakeryConfigService
NewBakeryConfigService returns a new service for managing bakery config
func (*BakeryConfigService) GetExternalUsersThirdPartyKey ¶
func (s *BakeryConfigService) GetExternalUsersThirdPartyKey(ctx context.Context) (*bakery.KeyPair, error)
GetExternalUsersThirdPartyKey returns the third party key pair used with the external users bakery.
func (*BakeryConfigService) GetLocalUsersKey ¶
GetLocalUsersKey returns the key pair used with the local users bakery.
func (*BakeryConfigService) GetLocalUsersThirdPartyKey ¶
func (s *BakeryConfigService) GetLocalUsersThirdPartyKey(ctx context.Context) (*bakery.KeyPair, error)
GetLocalUsersThirdPartyKey returns the third party key pair used with the local users bakery.
func (*BakeryConfigService) GetOffersThirdPartyKey ¶
GetOffersThirdPartyKey returns the key pair used with the cross model offers bakery.
func (*BakeryConfigService) InitialiseBakeryConfig ¶
func (s *BakeryConfigService) InitialiseBakeryConfig(ctx context.Context) error
InitialiseBakeryConfig creates and fills in the bakery config in state.
type BakeryConfigState ¶
type BakeryConfigState interface { // InitialiseBakeryConfig creates and fills in the bakery config in state. InitialiseBakeryConfig(ctx context.Context, localUsersKey, localUsersThirdPartyKey, externalUsersThirdPartyKey, offersThirdPartyKey *bakery.KeyPair) error // GetLocalUsersKey returns the key pair used with the local users bakery. GetLocalUsersKey(context.Context) (*bakery.KeyPair, error) // GetLocalUsersThirdPartyKey returns the third party key pair used with the local users bakery. GetLocalUsersThirdPartyKey(context.Context) (*bakery.KeyPair, error) // GetExternalUsersThirdPartyKey returns the third party key pair used with the external users bakery. GetExternalUsersThirdPartyKey(context.Context) (*bakery.KeyPair, error) // GetOffersThirdPartyKey returns the key pair used with the cross model offers bakery. GetOffersThirdPartyKey(context.Context) (*bakery.KeyPair, error) }
BakeryConfigState describes persistence layer methods for bakery config
type RootKeyService ¶
type RootKeyService struct {
// contains filtered or unexported fields
}
RootKeyService provides the API for macaroon root key storage We can use RootKeyService to construct a bakery.RootKeyStore.
func NewRootKeyService ¶
func NewRootKeyService(st RootKeyState, clock macaroon.Clock) *RootKeyService
NewRootKeyService returns a new service for managing macaroon root keys
func (*RootKeyService) FindLatestKeyContext ¶
func (s *RootKeyService) FindLatestKeyContext(ctx context.Context, createdAfter, expiresAfter, expiresBefore time.Time) (dbrootkeystore.RootKey, error)
FindLatestKeyContext (dbrootkeystore.FindLatestKeyContext) returns the most recently created root key k following all the conditions:
k.Created >= createdAfter k.Expires >= expiresAfter k.Expires <= expiresBefore
To satisfy dbrootkeystore.FindLatestKeyContext specification, if no such key is found, the zero root key is returned with a nil error
func (*RootKeyService) GetKeyContext ¶
func (s *RootKeyService) GetKeyContext(ctx context.Context, id []byte) (dbrootkeystore.RootKey, error)
GetKeyContext (dbrootkeystore.GetKeyContext) gets the key with a given id from dqlite.
To satisfy dbrootkeystore.ContextBacking specification, if not key is found, a bakery.ErrNotFound error is returned.
func (*RootKeyService) InsertKeyContext ¶
func (s *RootKeyService) InsertKeyContext(ctx context.Context, key dbrootkeystore.RootKey) error
InsertKeyContext (dbrootkeystore.InsertKeyContext) inserts the given root key into state. If a key with matching id already exists, return a macaroonerrors.KeyAlreadyExists error.
type RootKeyState ¶
type RootKeyState interface { // GetKey gets the key with a given id from state. If not key is found, a // macaroonerrors.KeyNotFound error is returned. GetKey(ctx context.Context, id []byte, now time.Time) (macaroon.RootKey, error) // FindLatestKey returns the most recently created root key k following all // the conditions: // // k.Created >= createdAfter // k.Expires >= expiresAfter // k.Expires <= expiresBefore // // If no such key was found, return a macaroonerrors.KeyNotFound error FindLatestKey(ctx context.Context, createdAfter, expiresAfter, expiresBefore, now time.Time) (macaroon.RootKey, error) // InsertKey inserts the given root key into state. If a key with matching // id already exists, return a macaroonerrors.KeyAlreadyExists error. InsertKey(ctx context.Context, key macaroon.RootKey) error }
RootKeyState describes the persistence layer for macaroon root keys
type Service ¶
type Service struct { *BakeryConfigService *RootKeyService }
Service provides the API for managing the macaroon bakery storage
type State ¶
type State interface { BakeryConfigState RootKeyState }
State represents a type for interacting with the underlying storage required for this service