// Package replay defines the authenticated replay-reservation contract used by // the gateway transport pipeline. package replay import ( "context" "errors" "time" ) var ( // ErrDuplicate reports that the request identifier has already been // reserved for the same device session within the active replay window. ErrDuplicate = errors.New("replay reservation already exists") ) // Store reserves authenticated transport request identifiers for a bounded // replay window. type Store interface { // Reserve marks the deviceSessionID and requestID pair as seen for ttl. // Implementations must wrap ErrDuplicate when the same pair is reserved // again before ttl expires. Reserve(ctx context.Context, deviceSessionID string, requestID string, ttl time.Duration) error }