macaroon

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pouch

Pouch holds the set of macaroons we need to interact with tapd. Each sub-server has its own macaroon, and for the remaining temporary calls that directly hit tapd, we'll use the admin macaroon.

type SerializedMacaroon

type SerializedMacaroon string

SerializedMacaroon is a type that represents a hex-encoded macaroon. We'll use this primarily vs the raw binary format as the gRPC metadata feature requires that all keys and values be strings.

func (SerializedMacaroon) WithMacaroonAuth

func (s SerializedMacaroon) WithMacaroonAuth(
	ctx context.Context) context.Context

WithMacaroonAuth modifies the passed context to include the macaroon KV metadata of the target macaroon. This method can be used to add the macaroon at call time, rather than when the connection to the gRPC server is created.

type Source

type Source interface {
	// LoadPouch loads the full per-service Pouch represented by
	// this source.
	LoadPouch() (Pouch, error)
}

Source describes where the SDK should obtain authentication macaroons. Exactly one source is held by the caller's Config, so conflicting inputs cannot be expressed — the compiler enforces what runtime validation used to. Instances are obtained from FromPath, FromDir, or FromHex.

func FromDir

func FromDir(dir string) Source

FromDir returns a Source that loads one macaroon per service from the given directory, matching tapd's standard on-disk layout.

func FromHex

func FromHex(hex string) Source

FromHex returns a Source that uses a hex-encoded macaroon as the single credential for every service.

func FromPath

func FromPath(path string) Source

FromPath returns a Source that loads a single macaroon file and reuses it for every service (the file is assumed to bear all required caveats, e.g. the admin macaroon).

type TaprpcServiceMac

type TaprpcServiceMac string

TaprpcServiceMac is the name of a macaroon that can be used to authenticate with a specific taprpc service.

const (
	AdminServiceMac     TaprpcServiceMac = "admin.macaroon"
	WalletKitServiceMac TaprpcServiceMac = "walletkit.macaroon"
	ProofServiceMac     TaprpcServiceMac = "proof.macaroon"
	UniverseServiceMac  TaprpcServiceMac = "universe.macaroon"
	MintServiceMac      TaprpcServiceMac = "mint.macaroon"
	ReadOnlyServiceMac  TaprpcServiceMac = "readonly.macaroon"
)

Jump to

Keyboard shortcuts

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