Documentation
¶
Overview ¶
Package grantauth signs and validates short-lived Shellin grant tokens.
Tokens are HMAC-SHA256 JWTs with issuer, audience, subject, expiry, token ID, role, and session claims. Signaling tokens must also pass replay protection through a ReplayStore before a WebSocket is accepted.
Index ¶
Constants ¶
View Source
const MinHMACSecretBytes = 32
Variables ¶
View Source
var ( ErrReplayDetected = errors.New("grant token replay detected") )
Functions ¶
func ValidateHMACSecret ¶
Types ¶
type MemoryReplayStore ¶
type MemoryReplayStore struct {
// contains filtered or unexported fields
}
func NewMemoryReplayStore ¶
func NewMemoryReplayStore() *MemoryReplayStore
type ReplayGuard ¶
type ReplayGuard struct {
// contains filtered or unexported fields
}
func NewReplayGuard ¶
func NewReplayGuard() *ReplayGuard
func NewReplayGuardWithStore ¶
func NewReplayGuardWithStore(store ReplayStore) *ReplayGuard
type ReplayStore ¶
ReplayStore atomically records a token ID until expiresAt.
Implementations backed by shared infrastructure must perform this as a conditional put: the first caller for a token ID succeeds, and later callers fail with ErrReplayDetected until the stored expiry has passed.
Click to show internal directories.
Click to hide internal directories.