Documentation
¶
Overview ¶
Package auth implements bounded handshake authentication state.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidReplayLimit indicates a non-positive replay-cache capacity. ErrInvalidReplayLimit = errors.New("invalid replay cache limit") // ErrInvalidNonce indicates an unset handshake nonce. ErrInvalidNonce = errors.New("invalid nonce") // ErrReplay indicates a nonce already retained by the cache. ErrReplay = errors.New("replayed nonce") // ErrReplayCacheFull indicates admission would exceed the bounded cache. ErrReplayCacheFull = errors.New("replay cache full") // ErrTimestampOutsideWindow indicates stale or excessively future authentication time. ErrTimestampOutsideWindow = errors.New("timestamp outside authentication window") )
Functions ¶
func ReplayExpiry ¶
ReplayExpiry returns the first Unix second after timestamp can pass the inclusive skew window.
Types ¶
type ReplayCache ¶
type ReplayCache struct {
// contains filtered or unexported fields
}
ReplayCache retains authenticated nonces until their replay window expires.
func NewReplayCache ¶
func NewReplayCache(limit int) (*ReplayCache, error)
NewReplayCache returns an empty replay cache with a fixed entry limit.
func (*ReplayCache) CheckAndStore ¶
func (c *ReplayCache) CheckAndStore(nonce protocol.Nonce, nowUnix, expiresAtUnix int64) error
CheckAndStore atomically rejects a retained nonce or stores it through expiresAtUnix.
Click to show internal directories.
Click to hide internal directories.