Documentation
¶
Overview ¶
Package auth mints and refreshes Console JWTs for the terminal/exec websocket.
The REST API authenticates with an account Api-key, but the exec websocket requires a short-lived Console JWT access token, obtained from an email + password + TOTP login (SimpleJWT at /api/v1/token/). `darkubectl login` mints the pair once and stores the refresh token; access tokens are then refreshed on demand without re-entering 2FA until the refresh token expires.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrLoginFailed = errors.New("login failed") ErrRefreshFailed = errors.New("token refresh failed") )
Errors returned by the authenticator.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client mints tokens against the Hamravesh API.
func (*Client) Refresh ¶
Refresh mints a new access token from a stored refresh token, retrying transient upstream failures.
A transport error or a 5xx is the server's problem and is retried with linear backoff; anything else (notably a 401 for an expired or revoked refresh token) is returned immediately. See defaultRefreshAttempts for why this exists.