Versions in this module Expand all Collapse all v1 v1.0.0 Oct 13, 2022 Changes in this version + const ErrAlreadyUnlocked + const ErrCantGetPeerFromContext + const ErrContextRootKeyID + const ErrDeletionForbidden + const ErrEncKeyNotFound + const ErrInvalidListOfPlugins + const ErrKeyNotInContext + const ErrKeyValueForbidden + const ErrMetadataFromContext + const ErrMissingRootKeyID + const ErrNoMacaroonsFromContext + const ErrPasswordRequired + const ErrRootKeyBucketNotFound + const ErrRootKeyIDNotFound + const ErrStoreLocked + const ErrUnauthorizedPluginAction + const ErrUnexpectedMacNumber + const ErrValidatorMethodAlreadyRegistered + const ErrValidatorNil + const PermissionEntityCustomURI + const PluginContextKey + var DefaultRootKeyID = []byte("0") + var RootKeyIDContextKey = contextKey + var RootKeyLen = 32 + func AddConstraints(mac *macaroon.Macaroon, cs ...Constraint) (*macaroon.Macaroon, error) + func ContextWithRootKeyId(ctx context.Context, value interface{}) context.Context + func PluginCaveat(pluginNames []string) checkers.Caveat + func PluginConstraint(pluginNames []string) func(*macaroon.Macaroon) error + func RootKeyIDFromContext(ctx context.Context) ([]byte, error) + func SafeCopyMacaroon(mac *macaroon.Macaroon) (*macaroon.Macaroon, error) + func TimeoutCaveat(seconds int64) checkers.Caveat + func TimeoutConstraint(seconds int64) func(*macaroon.Macaroon) error + type Checker func() (string, checkers.Func) + type Constraint func(*macaroon.Macaroon) error + type MacLogger struct + func (m *MacLogger) Debugf(ctx context.Context, f string, args ...interface{}) + func (m *MacLogger) Infof(ctx context.Context, f string, args ...interface{}) + type MacaroonCredential struct + func NewMacaroonCredential(m *macaroon.Macaroon) (MacaroonCredential, error) + func (m MacaroonCredential) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) + func (m MacaroonCredential) RequireTransportSecurity() bool + type MacaroonValidator interface + ValidateMacaroon func(ctx context.Context, requiredPermissions []bakery.Op, fullMethod string) error + type RootKeyStorage struct + func InitRootKeyStorage(db kvdb.DB) (*RootKeyStorage, error) + func (r *RootKeyStorage) ChangePassword(oldPw, newPw []byte) error + func (r *RootKeyStorage) Close() error + func (r *RootKeyStorage) CreateUnlock(password *[]byte) error + func (r *RootKeyStorage) DeleteMacaroonID(_ context.Context, rootKeyID []byte) ([]byte, error) + func (r *RootKeyStorage) GenerateNewRootKey() error + func (r *RootKeyStorage) Get(_ context.Context, id []byte) ([]byte, error) + func (r *RootKeyStorage) ListMacaroonIDs(_ context.Context) ([][]byte, error) + func (r *RootKeyStorage) RootKey(ctx context.Context) ([]byte, []byte, error) + type Service struct + ExternalValidators map[string]MacaroonValidator + func InitService(db kvdb.DB, location string, logger zerolog.Logger, pluginNames []string, ...) (*Service, error) + func (s *Service) Close() error + func (s *Service) CreateUnlock(password *[]byte) error + func (s *Service) NewMacaroon(ctx context.Context, rootKeyId []byte, cav []checkers.Caveat, ops ...bakery.Op) (*bakery.Macaroon, error) + func (svc *Service) ChangePassword(oldPw, newPw []byte) error + func (svc *Service) DeleteMacaroonID(ctxt context.Context, rootKeyID []byte) ([]byte, error) + func (svc *Service) ListMacaroonIDs(ctxt context.Context) ([][]byte, error) + func (svc *Service) RegisterExternalValidator(fullMethod string, validator MacaroonValidator) error + func (svc *Service) ValidateMacaroon(ctx context.Context, requiredPermissions []bakery.Op, fullMethod string) error