Documentation
¶
Index ¶
- Variables
- func BakeAndWriteSuperMacaroon(ctx context.Context, lnd lnrpc.LightningClient, path string, perms []bakery.Op) error
- func BakeSuperMacaroon(ctx context.Context, lnd lnrpc.LightningClient, rootKeyID uint64, ...) (string, error)
- func HasMacaroonSuffix(path string) error
- func IsSuperMacaroon(macHex string) bool
- func IsSuperMacaroonRootKeyID(rootKeyID uint64) bool
- func MacaroonMatchesPermissions(path string, expectedPerms []bakery.Op) (bool, error)
- func NewSuperMacaroonRootKeyID(id [4]byte) uint64
- func ParseMacaroon(macHex string) (*macaroon.Macaroon, error)
- func RootKeyIDFromMacaroon(mac *macaroon.Macaroon) (uint64, error)
- func SuperMacaroonExists(path string) bool
- type Baker
- type SuperMacaroonValidator
Constants ¶
This section is empty.
Variables ¶
var SuperMacaroonRootKeyPrefix = [4]byte{0xFF, 0xEE, 0xDD, 0xCC}
SuperMacaroonRootKeyPrefix is the prefix we set on a super macaroon's root key to clearly mark it as such.
Functions ¶
func BakeAndWriteSuperMacaroon ¶
func BakeAndWriteSuperMacaroon(ctx context.Context, lnd lnrpc.LightningClient, path string, perms []bakery.Op) error
BakeAndWriteSuperMacaroon bakes a super macaroon and writes it to disk.
func BakeSuperMacaroon ¶
func BakeSuperMacaroon(ctx context.Context, lnd lnrpc.LightningClient, rootKeyID uint64, perms []bakery.Op, caveats []macaroon.Caveat) (string, error)
BakeSuperMacaroon uses the lnd client to bake a macaroon that can include permissions for multiple daemons.
func HasMacaroonSuffix ¶
HasMacaroonSuffix checks that the super macaroon path is not empty and ends with the expected suffix.
func IsSuperMacaroon ¶
IsSuperMacaroon returns true if the given hex encoded macaroon is a super macaroon baked by LiT which can be identified by its root key ID.
func IsSuperMacaroonRootKeyID ¶
IsSuperMacaroonRootKeyID returns true if the given macaroon root key ID (also known as storage ID) is a super macaroon, which can be identified by its first 4 bytes.
func MacaroonMatchesPermissions ¶
MacaroonMatchesPermissions checks if the macaroon at the given path contains exactly the expected permissions (no more and no less).
func NewSuperMacaroonRootKeyID ¶
NewSuperMacaroonRootKeyID returns a new macaroon root key ID that has the prefix to mark it as a super macaroon root key.
func ParseMacaroon ¶
ParseMacaroon parses a hex encoded macaroon into its native struct.
func RootKeyIDFromMacaroon ¶
RootKeyIDFromMacaroon extracts the root key ID of the passed macaroon.
func SuperMacaroonExists ¶
SuperMacaroonExists determines whether a macaroon file exists at the given path.