Documentation ¶
Index ¶
Constants ¶
const ( // DefaultInvoiceLookupTimeout is the default maximum time we wait for // an invoice update to arrive. DefaultInvoiceLookupTimeout = 3 * time.Second )
const Subsystem = "AUTH"
Variables ¶
This section is empty.
Functions ¶
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.
Types ¶
type Authenticator ¶
type Authenticator interface { // Accept returns whether or not the header successfully authenticates // the user to a given backend service. Accept(*http.Header, string) bool // FreshChallengeHeader returns a header containing a challenge for the // user to complete. FreshChallengeHeader(*http.Request, string, int64, mint.MemoParam) (http.Header, error) }
Authenticator is the generic interface for validating client headers and returning new challenge headers.
type InvoiceChecker ¶
type InvoiceChecker interface { // VerifyInvoiceStatus checks that an invoice identified by a payment // hash has the desired status. To make sure we don't fail while the // invoice update is still on its way, we try several times until either // the desired status is set or the given timeout is reached. VerifyInvoiceStatus(lntypes.Hash, lnrpc.Invoice_InvoiceState, time.Duration) error }
InvoiceChecker is an entity that is able to check the status of an invoice, particularly whether it's been paid or not.
type Level ¶
type Level string
const ( // LevelOff is the default level where no authentication is required. LevelOff Level = "off" )
func (Level) FreebieCount ¶
type LsatAuthenticator ¶
type LsatAuthenticator struct {
// contains filtered or unexported fields
}
LsatAuthenticator is an authenticator that uses the LSAT protocol to authenticate requests.
func NewLsatAuthenticator ¶
func NewLsatAuthenticator(minter Minter, checker InvoiceChecker) *LsatAuthenticator
NewLsatAuthenticator creates a new authenticator that authenticates requests based on LSAT tokens.
func (*LsatAuthenticator) Accept ¶
func (l *LsatAuthenticator) Accept(header *http.Header, serviceName string) bool
Accept returns whether or not the header successfully authenticates the user to a given backend service.
NOTE: This is part of the Authenticator interface.
func (*LsatAuthenticator) FreshChallengeHeader ¶
func (l *LsatAuthenticator) FreshChallengeHeader(r *http.Request, serviceName string, servicePrice int64, memo mint.MemoParam) (http.Header, error)
FreshChallengeHeader returns a header containing a challenge for the user to complete.
NOTE: This is part of the Authenticator interface.
type Minter ¶
type Minter interface { // MintLSAT mints a new LSAT for the target services. MintLSAT(context.Context, mint.MemoParam, ...lsat.Service) (*macaroon.Macaroon, string, error) // VerifyLSAT attempts to verify an LSAT with the given parameters. VerifyLSAT(context.Context, *mint.VerificationParams) error }
Minter is an entity that is able to mint and verify LSATs for a set of services.
type MockAuthenticator ¶
type MockAuthenticator struct{}
MockAuthenticator is a mock implementation of the authenticator.
func NewMockAuthenticator ¶
func NewMockAuthenticator() *MockAuthenticator
NewMockAuthenticator returns a new MockAuthenticator instance.