macaroons

package
v0.14.1-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: MIT Imports: 11 Imported by: 0

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 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 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 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.

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