macaroons

package
v0.17.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func HasMacaroonSuffix(path string) error

HasMacaroonSuffix checks that the super macaroon path is not empty and ends with the expected suffix.

func IsSuperMacaroon

func IsSuperMacaroon(macHex string) bool

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

func IsSuperMacaroonRootKeyID(rootKeyID uint64) bool

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

func MacaroonMatchesPermissions(path string,
	expectedPerms []bakery.Op) (bool, error)

MacaroonMatchesPermissions checks if the macaroon at the given path contains exactly the expected permissions (no more and no less).

func NewSuperMacaroonRootKeyID

func NewSuperMacaroonRootKeyID(id [4]byte) uint64

NewSuperMacaroonRootKeyID returns a new macaroon root key ID that has the prefix to mark it as a super macaroon root key.

func ParseMacaroon

func ParseMacaroon(macHex string) (*macaroon.Macaroon, error)

ParseMacaroon parses a hex encoded macaroon into its native struct.

func RootKeyIDFromMacaroon

func RootKeyIDFromMacaroon(mac *macaroon.Macaroon) (uint64, error)

RootKeyIDFromMacaroon extracts the root key ID of the passed macaroon.

func SuperMacaroonExists

func SuperMacaroonExists(path string) bool

SuperMacaroonExists determines whether a macaroon file exists at the given path.

Types

type Baker

type Baker func(ctx context.Context, rootKeyID uint64,
	perms []bakery.Op, caveats []macaroon.Caveat) (string, error)

Baker is a function type for baking a super macaroon.

type SuperMacaroonValidator

type SuperMacaroonValidator func(ctx context.Context,
	superMacaroon []byte, requiredPermissions []bakery.Op,
	fullMethod string) error

SuperMacaroonValidator is a function type for validating a super macaroon.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL