Documentation
¶
Overview ¶
Package auth handles credential storage and chat-JWT minting.
The stored credential is the long-lived NG remember cookie — never the account password (ADR 0001).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("credential not found")
ErrNotFound is returned by Load when no value is stored under a key.
Functions ¶
This section is empty.
Types ¶
type CookieMinter ¶
type CookieMinter struct {
JWTURL string
// NGCookie is the newgrounds.com cookie header value granting the
// session, e.g. "vmkldu5I8m=...".
NGCookie string
// Cookie is an extra routing cookie for the dev proxy, appended to
// NGCookie.
Cookie string
HTTP *http.Client
}
CookieMinter mints via GET jwt.php authenticated by the NG session or remember cookie — the long-term path for regular users (ADR 0001). It already works today for any logged-in NG account.
type Minter ¶
Minter obtains a fresh chat JWT. The token lives 1 hour and the chat server hard-closes the socket when it lapses, so minting recurs for the life of a session.
type PasswordMinter ¶
type PasswordMinter struct {
JWTURL string
Username string
Password string
// Cookie is an extra Cookie header, e.g. the dev proxy routing
// cookie ("serverid=..."), required on every request against the
// staging/dev stack.
Cookie string
HTTP *http.Client
}
PasswordMinter mints via POST jwt.php with username/password. Interim path: the site restricts it to ngapps.allowed_users until the JSON login+2FA endpoints ship (ADR 0001). The password is held in memory only and never persisted.
type Store ¶
type Store struct{}
Store persists secrets in the OS keyring (macOS Keychain, Windows Credential Manager, Linux Secret Service), falling back to a 0600 JSON file under the user config dir on headless boxes without a keyring.