Versions in this module Expand all Collapse all v0 v0.3.0 Mar 19, 2025 Changes in this version + var FailedMacaroonPredicate = TypedPredicate[*FailedMacaroon] + var IsFailedMacaroon = Predicate(isType[*FailedMacaroon]) + var IsMalformedMacaroon = Predicate(isType[*MalformedMacaroon]) + var IsNonMacaroon = Predicate(isType[NonMacaroon]) + var IsUnverifiedMacaroon = Predicate(isType[*UnverifiedMacaroon]) + var IsVerificationResult = Predicate(isType[VerificationResult]) + var IsVerifiedMacaroon = Predicate(isType[*VerifiedMacaroon]) + var IsWellFormedMacaroon = Predicate(isType[Macaroon]) + var KeepAll = Predicate(func(Token) bool { ... }) + var KeepNone = Predicate(func(Token) bool { ... }) + var MacaroonPredicate = TypedPredicate[Macaroon] + var MalformedMacaroonPredicate = TypedPredicate[*MalformedMacaroon] + var NonMacaroonPredicate = TypedPredicate[NonMacaroon] + var UnverifiedMacaroonPredicate = TypedPredicate[*UnverifiedMacaroon] + var VerificationResultPredicate = TypedPredicate[VerificationResult] + var VerifiedMacaroonPredicate = TypedPredicate[*VerifiedMacaroon] + func ForEach[T Token](b *Bundle, cb func(T)) + func HasCaveat[C macaroon.Caveat](t Token) bool + func Header[T Token](ts ...T) string + func Map[R any, T Token](b *Bundle, cb func(T) R) []R + func Reduce[A any, T Token](b *Bundle, cb func(A, T) A) A + func String[T Token](ts ...T) string + type Bundle struct + IsPermissionToken Predicate + func ParseBundle(permissionLocation, hdr string) (*Bundle, error) + func ParseBundleWithFilter(permissionLocation, hdr string, filter Filter) (*Bundle, error) + func (b *Bundle) AddTokens(hdr string) error + func (b *Bundle) Any(f Filter) bool + func (b *Bundle) Attenuate(caveats ...macaroon.Caveat) error + func (b *Bundle) Clone() *Bundle + func (b *Bundle) Count(f Filter) int + func (b *Bundle) Discharge(tpLocation string, tpKey macaroon.EncryptionKey, cb Discharger) error + func (b *Bundle) Error() error + func (b *Bundle) Filter(f Filter) + func (b *Bundle) Header() string + func (b *Bundle) IsEmpty() bool + func (b *Bundle) IsMissingDischarge(tpLocation string) Filter + func (b *Bundle) Len() int + func (b *Bundle) Select(f Filter) *Bundle + func (b *Bundle) String() string + func (b *Bundle) UndischargedThirdPartyTickets() map[string][][]byte + func (b *Bundle) UndischargedTicketsForThirdParty(tpLocation string) [][]byte + func (b *Bundle) Validate(accesses ...macaroon.Access) error + func (b *Bundle) Verify(ctx context.Context, v Verifier) ([]*macaroon.CaveatSet, error) + func (b *Bundle) WithDischarges(f Filter) Filter + type Discharger func([]macaroon.Caveat) ([]macaroon.Caveat, error) + type FailedMacaroon struct + Err error + func (m *FailedMacaroon) Error() error + type Filter interface + Apply func([]Token) []Token + func DefaultFilter(isPerm Predicate) Filter + type KeyResolver func(context.Context, macaroon.Nonce) (macaroon.SigningKey, map[string][]macaroon.EncryptionKey, error) + func WithKey(kid []byte, key macaroon.SigningKey, ...) KeyResolver + func WithKeys(keyByKID map[string]macaroon.SigningKey, ...) KeyResolver + func (kr KeyResolver) Verify(ctx context.Context, dissByPerm map[Macaroon][]Macaroon) map[Macaroon]VerificationResult + func (kr KeyResolver) VerifyOne(ctx context.Context, perm Macaroon, diss []Macaroon) VerificationResult + type LocationFilter string + func (l LocationFilter) Apply(ts []Token) []Token + func (l LocationFilter) Predicate() Predicate + type Macaroon interface + Location func() string + Nonce func() macaroon.Nonce + ThirdPartyTickets func() map[string][][]byte + TicketsForThirdParty func(string) [][]byte + UnsafeCaveats func() *macaroon.CaveatSet + UnsafeMacaroon func() *macaroon.Macaroon + Unverified func() *UnverifiedMacaroon + type MalformedMacaroon struct + Err error + Str string + func (t *MalformedMacaroon) Error() error + func (t *MalformedMacaroon) String() string + type NonMacaroon string + func (t NonMacaroon) String() string + type Predicate func(Token) bool + func AllowsAccess(accesses ...macaroon.Access) Predicate + func And(ps ...Predicate) Predicate + func Not(p Predicate) Predicate + func Or(ps ...Predicate) Predicate + func TypedPredicate[T Token](p func(T) bool) Predicate + func (p Predicate) Apply(ts []Token) []Token + type Token interface + String func() string + type UnverifiedMacaroon struct + Str string + UnsafeMac *macaroon.Macaroon + func (t *UnverifiedMacaroon) Location() string + func (t *UnverifiedMacaroon) Nonce() macaroon.Nonce + func (t *UnverifiedMacaroon) String() string + func (t *UnverifiedMacaroon) ThirdPartyTickets() map[string][][]byte + func (t *UnverifiedMacaroon) TicketsForThirdParty(loc string) [][]byte + func (t *UnverifiedMacaroon) UnsafeCaveats() *macaroon.CaveatSet + func (t *UnverifiedMacaroon) UnsafeMacaroon() *macaroon.Macaroon + func (t *UnverifiedMacaroon) Unverified() *UnverifiedMacaroon + type VerificationCache struct + func NewVerificationCache(verifier Verifier, ttl time.Duration, size int) *VerificationCache + func (vc *VerificationCache) Purge() + func (vc *VerificationCache) Verify(ctx context.Context, dissByPerm map[Macaroon][]Macaroon) map[Macaroon]VerificationResult + type VerificationResult interface + type VerifiedMacaroon struct + Caveats *macaroon.CaveatSet + func (t *VerifiedMacaroon) Expiration() time.Time + type Verifier interface + Verify func(ctx context.Context, dischargesByPermission map[Macaroon][]Macaroon) map[Macaroon]VerificationResult + type VerifierFunc func(ctx context.Context, perm Macaroon, diss []Macaroon) VerificationResult + func (vf VerifierFunc) Verify(ctx context.Context, dissByPerm map[Macaroon][]Macaroon) map[Macaroon]VerificationResult