Documentation
¶
Index ¶
Constants ¶
const ( ChallengeSize = 32 // 256 bits ResponseSize = 64 // SHA512 output size AuthTimeout = 10 * time.Second // Maximum time for auth handshake MinTokenSize = 16 // Minimum token length in bytes )
Variables ¶
This section is empty.
Functions ¶
func ComputeResponse ¶
ComputeResponse computes HMAC-SHA512(token, challenge)
func GenerateChallenge ¶
GenerateChallenge creates a cryptographically secure random challenge
func New ¶
New creates a new challenge-response authenticator. The token must be at least MinTokenSize (16) bytes. The token is copied to prevent external modification.
func VerifyResponse ¶
VerifyResponse verifies the response using constant-time comparison
Types ¶
type ChallengeAuth ¶
type ChallengeAuth struct {
// contains filtered or unexported fields
}
ChallengeAuth implements challenge-response authentication using HMAC-SHA512
func (*ChallengeAuth) VerifyConn ¶
VerifyConn implements the auth.Auth interface. It performs the complete challenge-response authentication flow: 1. Opens an auth stream on the QUIC connection 2. Generates and sends a random challenge 3. Reads and verifies the client's response