katanakit-js / AuthService
Class: AuthService
Defined in: src/core/services/auth.service.ts:91
Holds the providers a deployment has configured and routes a request to one.
A registry rather than a single global provider because "which one" is configuration: a municipality may resolve a national identity number while a SaaS resolves an OAuth session, and both ship as the same kit. Nothing here reaches the network — providers are injected, so the core stays pure and testable with a stub.
Methods
useHas()
useHas(provider): boolean;Defined in: src/core/services/auth.service.ts:117
Whether a provider id is registered.
Parameters
| Parameter | Type |
|---|---|
provider | string |
Returns
boolean
useProviders()
useProviders(): string[];Defined in: src/core/services/auth.service.ts:122
Registered provider ids, in registration order.
Returns
string[]
useRegister()
useRegister(provider): void;Defined in: src/core/services/auth.service.ts:112
Registers a provider, replacing any previous one with the same id.
Parameters
| Parameter | Type |
|---|---|
provider | IAuthProvider |
Returns
void
useResolve()
useResolve(provider, input): Promise<AuthResult<
| {
claims?: Record<string, unknown>;
email?: string;
emailVerified?: boolean;
method: string;
provider: string;
subject: string;
}
| null>>;Defined in: src/core/services/auth.service.ts:138
Resolves the caller through the named provider.
An unknown provider id is a configuration failure, not an anonymous visitor — it returns ok: false so a typo cannot quietly turn a guarded route into a public one.
Parameters
| Parameter | Type |
|---|---|
provider | string |
input | AuthRequestLike |
Returns
Promise<AuthResult< | { claims?: Record<string, unknown>; email?: string; emailVerified?: boolean; method: string; provider: string; subject: string; } | null>>
useUnregister()
useUnregister(provider): boolean;Defined in: src/core/services/auth.service.ts:127
Removes a provider. Returns whether it was there.
Parameters
| Parameter | Type |
|---|---|
provider | string |
Returns
boolean
create()
static create(): AuthService;Defined in: src/core/services/auth.service.ts:107
A non-singleton instance, for tests or for isolating two deployments.
Returns
AuthService
getInstance()
static getInstance(): AuthService;Defined in: src/core/services/auth.service.ts:101
The shared instance.
Returns
AuthService