Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoToken = errors.New("not authenticated; run 'slack-wait login'") ErrTokenExpired = errors.New("refresh token expired; run 'slack-wait login'") )
Functions ¶
func GenerateVerifier ¶
GenerateVerifier creates a PKCE code_verifier (43 URL-safe chars, per RFC 7636).
Types ¶
type Session ¶ added in v0.1.2
type Session struct {
// contains filtered or unexported fields
}
Session keeps the active token in process memory and refreshes it on demand. The access token never touches the keyring for rotating apps; only the rotating refresh token is persisted, so a long-running `wait` can keep refreshing the access token transparently while it waits.
func NewSession ¶ added in v0.1.2
NewSession loads the stored credentials and prepares an in-memory session.
type Token ¶
type Token struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresAt time.Time `json:"expires_at"`
}
Token holds the Slack OAuth credentials. The access token and its expiry are kept in process memory only; see persisted for what is actually written to the keyring.
func ExchangeCode ¶
ExchangeCode trades an authorization code (plus PKCE verifier) for a token. No client_secret is sent; this is a public-client flow.
func (*Token) Valid ¶
Valid reports whether the access token is usable (present and not expiring within 5 minutes). A zero ExpiresAt means the token has no known expiry (non-rotating app). An empty AccessToken is never valid — this is the state of a freshly loaded rotating token, which must be refreshed before use.