Documentation
¶
Overview ¶
Package rpid derives and validates the WebAuthn relying-party ID for the host subflux is reached on: the registrable domain (eTLD+1) from the public suffix list, never a label strip, so a host whose provider is itself a public suffix (foo.duckdns.org, nas.synology.me) collapses to the exact host instead of to an illegal bare suffix.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Derive ¶
Derive returns the relying-party ID for host: the registrable domain of a DNS name, or "localhost" verbatim. The error is a *Error.
func Normalize ¶
Normalize returns the canonical spelling of an operator-typed value: trimmed, ASCII-lowercased, without a trailing dot. A port is not stripped; Validate refuses it.
func Validate ¶
Validate judges an operator-typed value as written, without deriving: a value narrower than the registrable domain is specification-legal and is accepted. The error is a *Error.
func ValidateForHost ¶
ValidateForHost is Validate plus the served check: host must be id or a subdomain of it. The dot in the needle is the guard against "evilexample.com" matching "example.com".
Types ¶
type Error ¶
type Error struct {
Value string
Detail string
Reason Reason
// contains filtered or unexported fields
}
Error names the offending value, why it was refused, and the remedy. The message carries no configuration key: every caller adds its own context.
type Reason ¶
type Reason string
Reason names why a value cannot be a relying-party ID.
const ( ReasonMalformedHost Reason = "malformed_host" ReasonIPLiteral Reason = "ip_literal" ReasonSingleLabel Reason = "single_label" ReasonPublicSuffix Reason = "public_suffix" ReasonIllegalDomain Reason = "illegal_domain" ReasonNotCanonical Reason = "not_canonical" ReasonNotServed Reason = "not_served" )
The refusal reasons, each carrying its own remedy in Error.Detail.