Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth holds the JWT signing secret and pre-minted tokens for each permission level.
func LoadOrInitAuth ¶
LoadOrInitAuth loads jwt secret + pre-minted tokens from `dataDir`, or initialises them if absent. If `seed` is non-empty it overrides any on-disk secret.
func (*Auth) AuthNew ¶
func (a *Auth) AuthNew(perms []auth.Permission) ([]byte, error)
AuthNew issues a new JWT with the requested perms.
func (*Auth) AuthVerify ¶
func (a *Auth) AuthVerify(token string) ([]auth.Permission, error)
AuthVerify validates a JWT and returns its claimed permissions.
Tokens issued post-#7 carry an `exp` claim; we enforce it strictly: expired tokens fail with a clear error so the operator knows to rotate. Legacy tokens (v1.2.1 and earlier) have no exp claim; we accept them with a warning-class log line so we don't break running deployments during the one-release grace window.
func (*Auth) Inspect ¶
Inspect parses a previously-issued token (signed by this Auth's secret) and returns descriptive info for the operator. Used by `lantern auth list`.
type Config ¶
type Config struct {
// ListenAddress is the TCP listen address, e.g. "127.0.0.1:1234".
ListenAddress string
// DataDir is where token files (lantern auth tokens) live.
DataDir string
// JWTSecret is the symmetric secret for the JWT auth scheme. When
// empty, the server generates one and persists it under DataDir.
JWTSecret []byte
}
Config configures the RPC server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps an http.Server bound to a go-jsonrpc dispatcher.
func New ¶
New creates a server bound to `node` and starts listening. The caller must call Run() (blocking) or Start()/Stop() to actually serve.
func (*Server) Addr ¶
Addr returns the actual listening address (useful when ListenAddress was ":0").
func (*Server) Auth ¶
Auth returns the auth state (so callers can mint additional tokens for the CLI subcommands).
func (*Server) FullNodeAPIInfo ¶
FullNodeAPIInfo returns the Lotus-compatible `FULLNODE_API_INFO` string for the admin-scoped token, ready to be set into the environment.
Format: "<token>:/ip4/<host>/tcp/<port>/http"
type TokenInfo ¶
type TokenInfo struct {
File string // basename under dataDir (e.g. "token", "token-sign")
Perms []auth.Permission // permission set granted by this token
IssuedAt time.Time // when this token was minted
Expires time.Time // when this token stops being accepted
JTI string // unique token id (rotation evidence)
Legacy bool // true when the token has no exp claim
}
TokenInfo describes an issued JWT for the auth-list command (#7).