vestibule/registry
In-memory registry that maps provider names ("google", "apple", ...) to `Strategy` values. Used by the middleware to dispatch incoming authorize/callback requests to the right provider.
vestibule/registry
In-memory registry that maps provider names (“google”, “apple”, …)
to Strategy values. Used by the middleware to dispatch incoming
authorize/callback requests to the right provider.
Types
Registry
A registry mapping provider names to Strategy + ClientConfig pairs.
The type parameter e must match across all registered strategies.
pub type Registry(a)RegistryError
Errors returned when registering a strategy.
pub type RegistryError { DuplicateProvider(name: String)}Constructors
DuplicateProvider(name: String)
A strategy with this provider name is already registered. Use
register_or_replace if you intend to overwrite the existing entry.
ValidationError
An invalid provider registration found during startup validation.
pub type ValidationError { ValidationError( provider: String, field: String, reason: String )}Functions
get
Look up a provider by name.
pub fn get( Registry(a), provider: String) -> Result(#(strategy.Strategy(a), config.ClientConfig), Nil)new
Create an empty registry.
pub fn new() -> Registry(a)providers
List all registered provider names.
pub fn providers(Registry(a)) -> List(String)register
Register a strategy with its config. Provider name is taken from the strategy.
Registration is rejected with Error(DuplicateProvider(name)) if a
strategy is already registered under the same provider name. This prevents
a later (possibly untrusted) registration from silently replacing a trusted
provider — which would otherwise enable provider impersonation when account
identity is keyed by provider + uid.
When accepting provider names from dynamic or partly untrusted
configuration, namespace custom names (for example "custom:acme") so they
cannot collide with built-in trusted providers. Trusted callers that
genuinely need to overwrite an entry should use register_or_replace.
pub fn register( Registry(a), strategy: strategy.Strategy(a), config: config.ClientConfig) -> Result(Registry(a), RegistryError)register_or_replace
Register a strategy with its config, replacing any existing strategy registered under the same provider name.
This is the explicit, trusted-caller counterpart to register. Only use it
when the provider name and strategy are fully trusted, since it silently
overwrites a previously registered provider.
pub fn register_or_replace( Registry(a), strategy: strategy.Strategy(a), config: config.ClientConfig) -> Registry(a)validate
Validate every registered provider without making network requests.
All errors are returned together so startup diagnostics can identify every invalid provider, field, and reason in one pass.
pub fn validate(Registry(a)) -> Result(Nil, List(ValidationError))validation_error_field
Return the field associated with a registry validation error.
pub fn validation_error_field(ValidationError) -> Stringvalidation_error_provider
Return the provider associated with a registry validation error.
pub fn validation_error_provider(ValidationError) -> Stringvalidation_error_reason
Return the actionable reason associated with a registry validation error.
pub fn validation_error_reason(ValidationError) -> String