Versions in this module Expand all Collapse all v0 v0.0.3 Sep 11, 2024 Changes in this version + const CondLndCustom + const RootKeyLen + var DefaultRootKeyID = []byte("0") + var ErrAlreadyUnlocked = fmt.Errorf("macaroon store already unlocked") + var ErrContextRootKeyID = fmt.Errorf(...) + var ErrDefaultRootKeyNotFound = fmt.Errorf("default root key not found") + var ErrDeletionForbidden = fmt.Errorf("the specified ID cannot be deleted") + var ErrEncKeyNotFound = fmt.Errorf("macaroon encryption key not found") + var ErrInvalidID = fmt.Errorf("invalid ID") + var ErrKeyValueForbidden = fmt.Errorf("root key ID value is not allowed") + var ErrMissingRootKeyID = fmt.Errorf("missing root key ID") + var ErrPasswordRequired = fmt.Errorf("a non-nil password is required") + var ErrRootKeyBucketNotFound = fmt.Errorf("root key bucket not found") + var ErrStoreLocked = fmt.Errorf("macaroon store is locked") + var ErrUnknownVersion = fmt.Errorf("unknown macaroon version") + var PermissionEntityCustomURI = "uri" + var RootKeyIDContextKey = contextKey + func AddConstraints(mac *macaroon.Macaroon, cs ...Constraint) (*macaroon.Macaroon, error) + func ContextWithRootKeyID(ctx context.Context, value interface{}) context.Context + func CustomConstraint(name, condition string) func(*macaroon.Macaroon) error + func GetCustomCaveatCondition(mac *macaroon.Macaroon, customCaveatName string) string + func HasCustomCaveat(mac *macaroon.Macaroon, customCaveatName string) bool + func IPLockChecker() (string, checkers.Func) + func IPLockConstraint(ipAddr string) func(*macaroon.Macaroon) error + func RawMacaroonFromContext(ctx context.Context) (string, error) + func RootKeyIDFromContext(ctx context.Context) ([]byte, error) + func SafeCopyMacaroon(mac *macaroon.Macaroon) (*macaroon.Macaroon, error) + func TimeoutConstraint(seconds int64) func(*macaroon.Macaroon) error + type Checker func() (string, checkers.Func) + func CustomChecker(acceptor CustomCaveatAcceptor) Checker + type Constraint func(*macaroon.Macaroon) error + type CustomCaveatAcceptor interface + CustomCaveatSupported func(customCaveatName string) error + type ExtendedRootKeyStore interface + ChangePassword func(oldPw, newPw []byte) error + Close func() error + CreateUnlock func(password *[]byte) error + DeleteMacaroonID func(ctxt context.Context, rootKeyID []byte) ([]byte, error) + GenerateNewRootKey func() error + ListMacaroonIDs func(ctxt context.Context) ([][]byte, error) + SetRootKey func(rootKey []byte) error + 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 NewRootKeyStorage(db kvdb.Backend) (*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) + func (r *RootKeyStorage) SetRootKey(rootKey []byte) error + type Service struct + ExternalValidators map[string]MacaroonValidator + StatelessInit bool + func NewService(keyStore bakery.RootKeyStore, location string, statelessInit bool, ...) (*Service, error) + func (svc *Service) ChangePassword(oldPw, newPw []byte) error + func (svc *Service) CheckMacAuth(ctx context.Context, macBytes []byte, requiredPermissions []bakery.Op, ...) error + func (svc *Service) Close() error + func (svc *Service) CreateUnlock(password *[]byte) error + func (svc *Service) DeleteMacaroonID(ctxt context.Context, rootKeyID []byte) ([]byte, error) + func (svc *Service) GenerateNewRootKey() error + func (svc *Service) ListMacaroonIDs(ctxt context.Context) ([][]byte, error) + func (svc *Service) NewMacaroon(ctx context.Context, rootKeyID []byte, ops ...bakery.Op) (*bakery.Macaroon, error) + func (svc *Service) RegisterExternalValidator(fullMethod string, validator MacaroonValidator) error + func (svc *Service) SetRootKey(rootKey []byte) error + func (svc *Service) ValidateMacaroon(ctx context.Context, requiredPermissions []bakery.Op, fullMethod string) error