Documentation
¶
Index ¶
- Constants
- Variables
- func IsSuperMacaroon(macHex string) bool
- func NewSuperMacaroonRootKeyID(id [4]byte) uint64
- func ParseMacaroon(macHex string) (*macaroon.Macaroon, error)
- func SerializeSession(w io.Writer, session *Session) error
- func UseLogger(logger btclog.Logger)
- type DB
- type GRPCServerCreator
- type MacaroonRecipe
- type Server
- type Session
- type State
- type Store
- type SuperMacaroonValidator
- type Type
Constants ¶
const ( // DBFilename is the default filename of the session database. DBFilename = "session.db" // DefaultSessionDBTimeout is the default maximum time we wait for the // session bbolt database to be opened. If the database is already // opened by another process, the unique lock cannot be obtained. With // the timeout we error out after the given time instead of just // blocking for forever. DefaultSessionDBTimeout = 5 * time.Second )
const Subsystem = "SESS"
Variables ¶
var ( // ErrDBReversion is returned when detecting an attempt to revert to a // prior database version. ErrDBReversion = errors.New("cannot revert to prior version") )
var ( // ErrSessionNotFound is an error returned when we attempt to retrieve // information about a session but it is not found. ErrSessionNotFound = errors.New("session not found") )
var ( // SuperMacaroonRootKeyPrefix is the prefix we set on a super macaroon's // root key to clearly mark it as such. SuperMacaroonRootKeyPrefix = [4]byte{0xFF, 0xEE, 0xDD, 0xCC} )
Functions ¶
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 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 SerializeSession ¶
SerializeSession binary serializes the given session to the writer using the tlv format.
Types ¶
type DB ¶
DB is a bolt-backed persistent store.
func (*DB) ListSessions ¶
ListSessions returns all sessions currently known to the store.
func (*DB) RevokeSession ¶
RevokeSession updates the state of the session with the given local public key to be revoked.
func (*DB) StoreSession ¶
StoreSession stores a session in the store. If a session with the same local public key already exists, the existing record is updated/ overwritten instead.
type GRPCServerCreator ¶
type GRPCServerCreator func(opts ...grpc.ServerOption) *grpc.Server
type MacaroonRecipe ¶
MacaroonRecipe defines the permissions and caveats that should be used to bake a macaroon.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(serverCreator GRPCServerCreator) *Server
func (*Server) StartSession ¶
type Session ¶
type Session struct { Label string State State Type Type Expiry time.Time ServerAddr string DevServer bool MacaroonRootKey uint64 MacaroonRecipe *MacaroonRecipe PairingSecret [mailbox.NumPasswordBytes]byte LocalPrivateKey *btcec.PrivateKey LocalPublicKey *btcec.PublicKey RemotePublicKey *btcec.PublicKey }
Session is a struct representing a long-term Terminal Connect session.
func DeserializeSession ¶
DeserializeSession deserializes a session from the given reader, expecting the data to be encoded in the tlv format.
type Store ¶
type Store interface { // StoreSession stores a session in the store. If a session with the // same local public key already exists, the existing record is updated/ // overwritten instead. StoreSession(*Session) error // ListSessions returns all sessions currently known to the store. ListSessions() ([]*Session, error) // RevokeSession updates the state of the session with the given local // public key to be revoked. RevokeSession(*btcec.PublicKey) error }
Store is the interface a persistent storage must implement for storing and retrieving Terminal Connect sessions.