@jimhoyd/urlcode-auth 0.1.0-alpha.1 → 0.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/IMPLEMENTATION-STATUS.md +3 -1
- package/README.md +56 -0
- package/SECURITY.md +1 -1
- package/THREAT-MODEL.md +4 -2
- package/dist/abuse-http.d.ts +8 -0
- package/dist/abuse-http.js +74 -0
- package/dist/abuse-store.d.ts +5 -0
- package/dist/abuse-store.js +40 -0
- package/dist/abuse.d.ts +27 -0
- package/dist/abuse.js +34 -0
- package/dist/admin-account-operations.d.ts +83 -0
- package/dist/admin-account-operations.js +50 -0
- package/dist/admin-account-store.d.ts +22 -0
- package/dist/admin-account-store.js +185 -0
- package/dist/auth-baseline.d.ts +30 -0
- package/dist/auth-baseline.js +153 -0
- package/dist/auth-core.d.ts +655 -0
- package/dist/auth-core.js +1066 -0
- package/dist/auth-flows.d.ts +30 -0
- package/dist/auth-flows.js +228 -0
- package/dist/auth-signup.d.ts +12 -0
- package/dist/auth-signup.js +154 -0
- package/dist/auth-store.d.ts +81 -0
- package/dist/auth-store.js +1601 -0
- package/dist/auth-templates.d.ts +13 -0
- package/dist/auth-templates.js +74 -0
- package/dist/auth-ui.d.ts +106 -0
- package/dist/auth-ui.js +205 -0
- package/dist/auth.d.ts +49 -0
- package/dist/auth.js +532 -0
- package/dist/backup.d.ts +18 -0
- package/dist/backup.js +121 -0
- package/dist/challenge-ui.d.ts +11 -0
- package/dist/challenge-ui.js +18 -0
- package/dist/challenge.d.ts +21 -0
- package/dist/challenge.js +65 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +137 -0
- package/dist/deployment-check.d.ts +16 -0
- package/dist/deployment-check.js +41 -0
- package/dist/disposable-domain-data.d.ts +1 -0
- package/dist/disposable-domain-data.js +8886 -0
- package/dist/disposable-domains.d.ts +3 -0
- package/dist/disposable-domains.js +17 -0
- package/dist/email-copy.d.ts +114 -0
- package/dist/email-copy.js +58 -0
- package/dist/factor-recovery.d.ts +46 -0
- package/dist/factor-recovery.js +71 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +18 -0
- package/dist/lifecycle-hooks.d.ts +76 -0
- package/dist/lifecycle-hooks.js +106 -0
- package/dist/manual-recovery-store.d.ts +25 -0
- package/dist/manual-recovery-store.js +129 -0
- package/dist/manual-recovery.d.ts +87 -0
- package/dist/manual-recovery.js +35 -0
- package/dist/oidc.d.ts +31 -0
- package/dist/oidc.js +54 -0
- package/dist/passkeys.d.ts +24 -0
- package/dist/passkeys.js +29 -0
- package/dist/password-policy.d.ts +7 -0
- package/dist/password-policy.js +72 -0
- package/dist/presentation.d.ts +15 -0
- package/dist/presentation.js +458 -0
- package/dist/presets.d.ts +18 -0
- package/dist/presets.js +17 -0
- package/dist/providers.d.ts +13 -0
- package/dist/providers.js +15 -0
- package/dist/registration.d.ts +45 -0
- package/dist/registration.js +130 -0
- package/dist/scaffold.d.ts +44 -0
- package/dist/scaffold.js +212 -0
- package/dist/second-factor-flows.d.ts +28 -0
- package/dist/second-factor-flows.js +76 -0
- package/dist/senders.d.ts +86 -0
- package/dist/senders.js +153 -0
- package/dist/user-query.d.ts +28 -0
- package/dist/user-query.js +81 -0
- package/package.json +2 -2
|
@@ -0,0 +1,655 @@
|
|
|
1
|
+
import type { AdminAccountService } from './admin-account-operations.ts';
|
|
2
|
+
import type { AuthAbuseOptions, AuthAbusePolicy } from './abuse.ts';
|
|
3
|
+
import type { UserQuery } from './user-query.ts';
|
|
4
|
+
import type { ManualRecoveryService, ManualRecoveryCase } from './manual-recovery.ts';
|
|
5
|
+
import type { FactorRecoveryService } from './factor-recovery.ts';
|
|
6
|
+
import type { RegistrationPolicy, RegistrationInput, RegistrationProfile, RegistrationOptions } from './registration.ts';
|
|
7
|
+
import { AuthError } from './auth-store.ts';
|
|
8
|
+
export { AuthError };
|
|
9
|
+
export interface AuthUser {
|
|
10
|
+
/** Latest retained device/session observation; not complete historical activity. */
|
|
11
|
+
observedLastSeen?: number;
|
|
12
|
+
id: string;
|
|
13
|
+
email: string;
|
|
14
|
+
emailVerified: boolean;
|
|
15
|
+
status: 'active' | 'locked' | 'pending-delete';
|
|
16
|
+
roles: string[];
|
|
17
|
+
created: number;
|
|
18
|
+
totpEnabled: boolean;
|
|
19
|
+
passkeyMfaEnabled?: boolean;
|
|
20
|
+
profile?: RegistrationProfile;
|
|
21
|
+
}
|
|
22
|
+
export type AuthRestriction = 'verify-email' | 'enroll-mfa';
|
|
23
|
+
export interface AuthSecondFactor {
|
|
24
|
+
token: string;
|
|
25
|
+
browserHash: string;
|
|
26
|
+
}
|
|
27
|
+
export interface AuthSecurityPolicy {
|
|
28
|
+
abuse?: AuthAbusePolicy;
|
|
29
|
+
allowPasskeySecondFactor?: true;
|
|
30
|
+
trustedDeviceTtlMs?: number;
|
|
31
|
+
allowEmailFactorRecovery?: true;
|
|
32
|
+
allowManualRecovery?: true;
|
|
33
|
+
requireEmailVerification: boolean;
|
|
34
|
+
requireMfa: boolean;
|
|
35
|
+
deletionGraceMs: number;
|
|
36
|
+
}
|
|
37
|
+
export interface AuthPrincipal {
|
|
38
|
+
restrictions?: AuthRestriction[];
|
|
39
|
+
id: string;
|
|
40
|
+
email: string;
|
|
41
|
+
emailVerified: boolean;
|
|
42
|
+
roles: string[];
|
|
43
|
+
permissions: string[];
|
|
44
|
+
sessionId: string;
|
|
45
|
+
authenticatedAt: number;
|
|
46
|
+
impersonatorId?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface ExternalAuthProof {
|
|
49
|
+
kind: 'oidc';
|
|
50
|
+
version: number;
|
|
51
|
+
provider: string;
|
|
52
|
+
subject: string;
|
|
53
|
+
}
|
|
54
|
+
export interface PasskeyAuthProof {
|
|
55
|
+
kind: 'passkey';
|
|
56
|
+
version: number;
|
|
57
|
+
credentialId: string;
|
|
58
|
+
publicKeyHash: string;
|
|
59
|
+
expectedCounter: number;
|
|
60
|
+
newCounter: number;
|
|
61
|
+
}
|
|
62
|
+
export type AuthProof = ExternalAuthProof | PasskeyAuthProof;
|
|
63
|
+
export interface AuthDevice {
|
|
64
|
+
id: string;
|
|
65
|
+
label?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface AuthSessionResult {
|
|
68
|
+
newDevice?: boolean;
|
|
69
|
+
user: AuthUser;
|
|
70
|
+
token: string;
|
|
71
|
+
principal: AuthPrincipal;
|
|
72
|
+
}
|
|
73
|
+
export interface AuthSession {
|
|
74
|
+
id: string;
|
|
75
|
+
created: number;
|
|
76
|
+
authenticatedAt: number;
|
|
77
|
+
expires: number;
|
|
78
|
+
lastSeen?: number;
|
|
79
|
+
deviceLabel?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface AuthDailyMetric {
|
|
82
|
+
day: string;
|
|
83
|
+
signUps: number;
|
|
84
|
+
signIns: number;
|
|
85
|
+
failedSignIns: number;
|
|
86
|
+
methods: {
|
|
87
|
+
method: string;
|
|
88
|
+
signUps: number;
|
|
89
|
+
signIns: number;
|
|
90
|
+
failedSignIns: number;
|
|
91
|
+
}[];
|
|
92
|
+
}
|
|
93
|
+
export interface AuthAuditEvent {
|
|
94
|
+
id: number;
|
|
95
|
+
actor: string;
|
|
96
|
+
action: string;
|
|
97
|
+
subject: string;
|
|
98
|
+
created: number;
|
|
99
|
+
reason: string;
|
|
100
|
+
}
|
|
101
|
+
export interface AuthLifecycleEvent {
|
|
102
|
+
type: 'sign-up' | 'delete';
|
|
103
|
+
accountId: string;
|
|
104
|
+
}
|
|
105
|
+
export interface AuthHookStats {
|
|
106
|
+
accepted: number;
|
|
107
|
+
dropped: number;
|
|
108
|
+
failed: number;
|
|
109
|
+
timedOut: number;
|
|
110
|
+
}
|
|
111
|
+
export interface AuthOptions {
|
|
112
|
+
abuse?: AuthAbuseOptions;
|
|
113
|
+
blockDisposableEmails?: boolean;
|
|
114
|
+
allowPasskeySecondFactor?: boolean;
|
|
115
|
+
trustedDeviceTtlMs?: number;
|
|
116
|
+
/** Explicit email fallback lowers MFA assurance; disabled by default. */
|
|
117
|
+
allowEmailFactorRecovery?: boolean;
|
|
118
|
+
allowManualRecovery?: boolean;
|
|
119
|
+
approveConfigurationChangeFrom?: string;
|
|
120
|
+
configurationTag?: string;
|
|
121
|
+
requireEmailVerification?: boolean;
|
|
122
|
+
requireMfa?: boolean;
|
|
123
|
+
deletionGraceMs?: number;
|
|
124
|
+
onLifecycle?: (event: AuthLifecycleEvent, context: {
|
|
125
|
+
signal: AbortSignal;
|
|
126
|
+
}) => void | Promise<void>;
|
|
127
|
+
database: string;
|
|
128
|
+
encryptionKey?: Uint8Array;
|
|
129
|
+
encryptionKeys?: Record<string, Uint8Array>;
|
|
130
|
+
activeEncryptionKey?: string;
|
|
131
|
+
roles: Record<string, string[]>;
|
|
132
|
+
defaultRole?: string;
|
|
133
|
+
now?: () => number;
|
|
134
|
+
registrationPolicy?: RegistrationPolicy;
|
|
135
|
+
sessionTtlMs?: number;
|
|
136
|
+
sessionIdleMs?: number;
|
|
137
|
+
allowImpersonation?: boolean;
|
|
138
|
+
registrationMode?: 'open' | 'invite-only' | 'waitlist' | 'off';
|
|
139
|
+
allowedEmails?: string[];
|
|
140
|
+
blockedEmails?: string[];
|
|
141
|
+
checkPassword?: (password: string, context?: {
|
|
142
|
+
signal: AbortSignal;
|
|
143
|
+
}) => Promise<void>;
|
|
144
|
+
allowedEmailDomains?: string[];
|
|
145
|
+
blockedEmailDomains?: string[];
|
|
146
|
+
}
|
|
147
|
+
export interface AuthCredentials {
|
|
148
|
+
secondFactor?: AuthSecondFactor;
|
|
149
|
+
trustedDevice?: string;
|
|
150
|
+
device?: AuthDevice;
|
|
151
|
+
email: string;
|
|
152
|
+
password: string;
|
|
153
|
+
totp?: string;
|
|
154
|
+
recoveryCode?: string;
|
|
155
|
+
}
|
|
156
|
+
export interface AuthPasskey {
|
|
157
|
+
secondFactor?: boolean;
|
|
158
|
+
id: string;
|
|
159
|
+
accountId: string;
|
|
160
|
+
publicKey: string;
|
|
161
|
+
counter: number;
|
|
162
|
+
transports?: string[];
|
|
163
|
+
}
|
|
164
|
+
export interface AuthCase {
|
|
165
|
+
id: string;
|
|
166
|
+
accountId: string;
|
|
167
|
+
action: 'reset-factors' | 'lock' | 'unlock' | 'roles' | 'restore-access';
|
|
168
|
+
recovery?: ManualRecoveryCase['recovery'];
|
|
169
|
+
roles?: string[];
|
|
170
|
+
reason: string;
|
|
171
|
+
makerId: string;
|
|
172
|
+
approverId?: string;
|
|
173
|
+
status: 'pending' | 'applied' | 'closed';
|
|
174
|
+
notes?: {
|
|
175
|
+
actorId: string;
|
|
176
|
+
note: string;
|
|
177
|
+
created: number;
|
|
178
|
+
}[];
|
|
179
|
+
created: number;
|
|
180
|
+
expires: number;
|
|
181
|
+
targetVersion: number;
|
|
182
|
+
}
|
|
183
|
+
export interface SignupBinding {
|
|
184
|
+
flowId: string;
|
|
185
|
+
browserHash: string;
|
|
186
|
+
}
|
|
187
|
+
export interface SignupState {
|
|
188
|
+
flowId: string;
|
|
189
|
+
accountId: string;
|
|
190
|
+
email: string;
|
|
191
|
+
step: 'verify-email' | 'credential' | 'profile';
|
|
192
|
+
expires: number;
|
|
193
|
+
}
|
|
194
|
+
export interface SignupStart extends SignupState {
|
|
195
|
+
delivery?: {
|
|
196
|
+
kind: 'signup-code';
|
|
197
|
+
email: string;
|
|
198
|
+
code: string;
|
|
199
|
+
} | {
|
|
200
|
+
kind: 'registration-attempt';
|
|
201
|
+
email: string;
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
export interface AuthService extends FactorRecoveryService, ManualRecoveryService, AdminAccountService {
|
|
205
|
+
getAbusePolicy(): AuthAbusePolicy | undefined;
|
|
206
|
+
admitAuthRequest(input: {
|
|
207
|
+
client: string | null;
|
|
208
|
+
signupEmail?: string;
|
|
209
|
+
}): Promise<{
|
|
210
|
+
challengeRequired: boolean;
|
|
211
|
+
}>;
|
|
212
|
+
createSecondFactorProof(input: {
|
|
213
|
+
browserHash: string;
|
|
214
|
+
proof: PasskeyAuthProof;
|
|
215
|
+
}): Promise<string>;
|
|
216
|
+
setPasskeySecondFactor(input: {
|
|
217
|
+
token: string;
|
|
218
|
+
credentialId: string;
|
|
219
|
+
enabled: boolean;
|
|
220
|
+
secondFactor?: AuthSecondFactor;
|
|
221
|
+
}): Promise<void>;
|
|
222
|
+
rememberDevice(input: {
|
|
223
|
+
token: string;
|
|
224
|
+
label?: string;
|
|
225
|
+
}): Promise<{
|
|
226
|
+
token: string;
|
|
227
|
+
expires: number;
|
|
228
|
+
}>;
|
|
229
|
+
listTrustedDevices(token: string): Promise<{
|
|
230
|
+
id: string;
|
|
231
|
+
label: string;
|
|
232
|
+
created: number;
|
|
233
|
+
expires: number;
|
|
234
|
+
}[]>;
|
|
235
|
+
revokeTrustedDevice(input: {
|
|
236
|
+
token: string;
|
|
237
|
+
deviceId: string;
|
|
238
|
+
}): Promise<void>;
|
|
239
|
+
beginSignup(input: {
|
|
240
|
+
email: string;
|
|
241
|
+
browserHash: string;
|
|
242
|
+
invitationToken?: string;
|
|
243
|
+
}): Promise<SignupStart>;
|
|
244
|
+
getSignup(input: SignupBinding): Promise<SignupState | null>;
|
|
245
|
+
verifySignup(input: SignupBinding & {
|
|
246
|
+
code: string;
|
|
247
|
+
}): Promise<SignupState>;
|
|
248
|
+
setSignupPassword(input: SignupBinding & {
|
|
249
|
+
password: string;
|
|
250
|
+
}): Promise<SignupState>;
|
|
251
|
+
setSignupPasskeyChallenge(input: SignupBinding & {
|
|
252
|
+
challenge: string;
|
|
253
|
+
}): Promise<SignupState>;
|
|
254
|
+
getSignupPasskeyChallenge(input: SignupBinding): Promise<{
|
|
255
|
+
state: SignupState;
|
|
256
|
+
challenge: string;
|
|
257
|
+
}>;
|
|
258
|
+
setSignupPasskey(input: SignupBinding & {
|
|
259
|
+
challenge: string;
|
|
260
|
+
credential: Omit<AuthPasskey, 'accountId'>;
|
|
261
|
+
}): Promise<SignupState>;
|
|
262
|
+
completeSignup(input: SignupBinding & {
|
|
263
|
+
profile?: RegistrationInput;
|
|
264
|
+
device?: AuthDevice;
|
|
265
|
+
}): Promise<AuthSessionResult | null>;
|
|
266
|
+
register(input: {
|
|
267
|
+
email: string;
|
|
268
|
+
password: string;
|
|
269
|
+
invitationToken?: string;
|
|
270
|
+
device?: AuthDevice;
|
|
271
|
+
profile?: RegistrationInput;
|
|
272
|
+
}): Promise<AuthSessionResult>;
|
|
273
|
+
bootstrapAdmin(input: {
|
|
274
|
+
email: string;
|
|
275
|
+
password: string;
|
|
276
|
+
}): Promise<AuthSessionResult>;
|
|
277
|
+
login(input: AuthCredentials): Promise<AuthSessionResult>;
|
|
278
|
+
stepUp(input: {
|
|
279
|
+
token: string;
|
|
280
|
+
password: string;
|
|
281
|
+
totp?: string;
|
|
282
|
+
recoveryCode?: string;
|
|
283
|
+
secondFactor?: AuthSecondFactor;
|
|
284
|
+
}): Promise<AuthSessionResult>;
|
|
285
|
+
authenticate(token: string): Promise<AuthPrincipal | null>;
|
|
286
|
+
logout(token: string): Promise<void>;
|
|
287
|
+
revokeSessions(accountId: string): Promise<void>;
|
|
288
|
+
listUsers(options?: UserQuery): Promise<{
|
|
289
|
+
users: AuthUser[];
|
|
290
|
+
next?: string;
|
|
291
|
+
}>;
|
|
292
|
+
getUser(id: string): Promise<AuthUser | null>;
|
|
293
|
+
getRoles(): Record<string, string[]>;
|
|
294
|
+
listSessions(accountId: string): Promise<AuthSession[]>;
|
|
295
|
+
listDevices(accountId: string): Promise<{
|
|
296
|
+
id: string;
|
|
297
|
+
label: string;
|
|
298
|
+
lastSeen: number;
|
|
299
|
+
}[]>;
|
|
300
|
+
listAudit(options?: {
|
|
301
|
+
limit?: number;
|
|
302
|
+
after?: string;
|
|
303
|
+
actor?: string;
|
|
304
|
+
subject?: string;
|
|
305
|
+
action?: string;
|
|
306
|
+
from?: number;
|
|
307
|
+
to?: number;
|
|
308
|
+
}): Promise<{
|
|
309
|
+
events: AuthAuditEvent[];
|
|
310
|
+
next?: string;
|
|
311
|
+
}>;
|
|
312
|
+
issueToken(input: {
|
|
313
|
+
email: string;
|
|
314
|
+
purpose: 'verify-email' | 'reset-password';
|
|
315
|
+
}): Promise<{
|
|
316
|
+
token: string | null;
|
|
317
|
+
}>;
|
|
318
|
+
consumeVerification(token: string): Promise<AuthUser>;
|
|
319
|
+
resetPassword(input: {
|
|
320
|
+
token: string;
|
|
321
|
+
password: string;
|
|
322
|
+
}): Promise<AuthUser>;
|
|
323
|
+
beginTotp(token: string): Promise<{
|
|
324
|
+
secret: string;
|
|
325
|
+
otpauthUrl: string;
|
|
326
|
+
}>;
|
|
327
|
+
confirmTotp(input: {
|
|
328
|
+
token: string;
|
|
329
|
+
code: string;
|
|
330
|
+
}): Promise<{
|
|
331
|
+
recoveryCodes: string[];
|
|
332
|
+
}>;
|
|
333
|
+
disableTotp(input: {
|
|
334
|
+
token: string;
|
|
335
|
+
password: string;
|
|
336
|
+
code?: string;
|
|
337
|
+
secondFactor?: AuthSecondFactor;
|
|
338
|
+
}): Promise<void>;
|
|
339
|
+
adminSetRoles(input: {
|
|
340
|
+
actorToken: string;
|
|
341
|
+
accountId: string;
|
|
342
|
+
roles: string[];
|
|
343
|
+
reason?: string;
|
|
344
|
+
}): Promise<AuthUser>;
|
|
345
|
+
adminSetStatus(input: {
|
|
346
|
+
actorToken: string;
|
|
347
|
+
accountId: string;
|
|
348
|
+
status: 'active' | 'locked';
|
|
349
|
+
reason?: string;
|
|
350
|
+
}): Promise<AuthUser>;
|
|
351
|
+
adminRevokeSessions(input: {
|
|
352
|
+
actorToken: string;
|
|
353
|
+
accountId: string;
|
|
354
|
+
reason?: string;
|
|
355
|
+
}): Promise<void>;
|
|
356
|
+
putFlow(input: {
|
|
357
|
+
id: string;
|
|
358
|
+
kind: string;
|
|
359
|
+
data: unknown;
|
|
360
|
+
expires: number;
|
|
361
|
+
}): Promise<void>;
|
|
362
|
+
consumeFlow(id: string, kind: string): Promise<unknown | null>;
|
|
363
|
+
findExternal(provider: string, subject: string): Promise<AuthUser | null>;
|
|
364
|
+
linkExternal(input: {
|
|
365
|
+
actorToken: string;
|
|
366
|
+
provider: string;
|
|
367
|
+
subject: string;
|
|
368
|
+
}): Promise<void>;
|
|
369
|
+
createExternalAccount(input: {
|
|
370
|
+
email: string;
|
|
371
|
+
provider: string;
|
|
372
|
+
subject: string;
|
|
373
|
+
emailVerified: boolean;
|
|
374
|
+
profile?: RegistrationInput;
|
|
375
|
+
}): Promise<AuthUser>;
|
|
376
|
+
getExternalProof(provider: string, subject: string): Promise<{
|
|
377
|
+
user: AuthUser;
|
|
378
|
+
proof: ExternalAuthProof;
|
|
379
|
+
} | null>;
|
|
380
|
+
issueSession(accountId: string, input: {
|
|
381
|
+
trustedDevice?: string;
|
|
382
|
+
method: 'passkey' | 'oidc';
|
|
383
|
+
proof: AuthProof;
|
|
384
|
+
device?: AuthDevice;
|
|
385
|
+
totp?: string;
|
|
386
|
+
recoveryCode?: string;
|
|
387
|
+
secondFactor?: AuthSecondFactor;
|
|
388
|
+
}): Promise<AuthSessionResult>;
|
|
389
|
+
addPasskey(input: {
|
|
390
|
+
actorToken: string;
|
|
391
|
+
credential: Omit<AuthPasskey, 'accountId'>;
|
|
392
|
+
}): Promise<void>;
|
|
393
|
+
getPasskey(id: string): Promise<{
|
|
394
|
+
accountId: string;
|
|
395
|
+
credential: Omit<AuthPasskey, 'accountId'>;
|
|
396
|
+
proof: Omit<PasskeyAuthProof, 'newCounter'>;
|
|
397
|
+
} | null>;
|
|
398
|
+
listPasskeys(accountId: string): Promise<Omit<AuthPasskey, 'accountId'>[]>;
|
|
399
|
+
advancePasskeyCounter(input: {
|
|
400
|
+
id: string;
|
|
401
|
+
expectedCounter: number;
|
|
402
|
+
newCounter: number;
|
|
403
|
+
}): Promise<void>;
|
|
404
|
+
changePassword(input: {
|
|
405
|
+
token: string;
|
|
406
|
+
currentPassword: string;
|
|
407
|
+
password: string;
|
|
408
|
+
totp?: string;
|
|
409
|
+
recoveryCode?: string;
|
|
410
|
+
secondFactor?: AuthSecondFactor;
|
|
411
|
+
}): Promise<void>;
|
|
412
|
+
exportAccount(token: string): Promise<{
|
|
413
|
+
user: AuthUser;
|
|
414
|
+
sessions: AuthSession[];
|
|
415
|
+
passkeys: {
|
|
416
|
+
id: string;
|
|
417
|
+
transports?: string[];
|
|
418
|
+
}[];
|
|
419
|
+
identities: {
|
|
420
|
+
provider: string;
|
|
421
|
+
subject: string;
|
|
422
|
+
}[];
|
|
423
|
+
}>;
|
|
424
|
+
deleteAccount(input: {
|
|
425
|
+
token: string;
|
|
426
|
+
password?: string;
|
|
427
|
+
totp?: string;
|
|
428
|
+
recoveryCode?: string;
|
|
429
|
+
secondFactor?: AuthSecondFactor;
|
|
430
|
+
}): Promise<{
|
|
431
|
+
cancelToken: string;
|
|
432
|
+
deleteAfter: number;
|
|
433
|
+
}>;
|
|
434
|
+
cancelDeletion(token: string): Promise<void>;
|
|
435
|
+
purgeDeleted(options?: {
|
|
436
|
+
limit?: number;
|
|
437
|
+
}): Promise<{
|
|
438
|
+
purged: number;
|
|
439
|
+
}>;
|
|
440
|
+
issueEmailCode(input: {
|
|
441
|
+
email: string;
|
|
442
|
+
}): Promise<{
|
|
443
|
+
flowId: string;
|
|
444
|
+
code: string | null;
|
|
445
|
+
}>;
|
|
446
|
+
consumeEmailCode(input: {
|
|
447
|
+
trustedDevice?: string;
|
|
448
|
+
flowId: string;
|
|
449
|
+
code: string;
|
|
450
|
+
device?: AuthDevice;
|
|
451
|
+
totp?: string;
|
|
452
|
+
recoveryCode?: string;
|
|
453
|
+
secondFactor?: AuthSecondFactor;
|
|
454
|
+
}): Promise<AuthSessionResult>;
|
|
455
|
+
createCase(input: {
|
|
456
|
+
actorToken: string;
|
|
457
|
+
accountId: string;
|
|
458
|
+
action: Exclude<AuthCase['action'], 'restore-access'>;
|
|
459
|
+
roles?: string[];
|
|
460
|
+
reason: string;
|
|
461
|
+
}): Promise<AuthCase>;
|
|
462
|
+
listCases(options?: {
|
|
463
|
+
limit?: number;
|
|
464
|
+
after?: string;
|
|
465
|
+
}): Promise<{
|
|
466
|
+
cases: AuthCase[];
|
|
467
|
+
next?: string;
|
|
468
|
+
}>;
|
|
469
|
+
getCase(id: string): Promise<AuthCase | null>;
|
|
470
|
+
approveCase(input: {
|
|
471
|
+
actorToken: string;
|
|
472
|
+
caseId: string;
|
|
473
|
+
reason: string;
|
|
474
|
+
}): Promise<AuthCase>;
|
|
475
|
+
createImpersonation(input: {
|
|
476
|
+
actorToken: string;
|
|
477
|
+
accountId: string;
|
|
478
|
+
reason: string;
|
|
479
|
+
}): Promise<AuthSessionResult>;
|
|
480
|
+
adminBulk(input: {
|
|
481
|
+
actorToken: string;
|
|
482
|
+
accountIds: string[];
|
|
483
|
+
action: 'lock' | 'unlock' | 'revoke-sessions';
|
|
484
|
+
reason: string;
|
|
485
|
+
}): Promise<{
|
|
486
|
+
affected: number;
|
|
487
|
+
}>;
|
|
488
|
+
dashboard(): Promise<{
|
|
489
|
+
users: number;
|
|
490
|
+
active: number;
|
|
491
|
+
locked: number;
|
|
492
|
+
pendingDeletion: number;
|
|
493
|
+
sessions: number;
|
|
494
|
+
waitlist: number;
|
|
495
|
+
daily: AuthDailyMetric[];
|
|
496
|
+
}>;
|
|
497
|
+
listAllSessions(options?: {
|
|
498
|
+
accountId?: string;
|
|
499
|
+
device?: string;
|
|
500
|
+
createdFrom?: number;
|
|
501
|
+
createdTo?: number;
|
|
502
|
+
limit?: number;
|
|
503
|
+
after?: string;
|
|
504
|
+
}): Promise<{
|
|
505
|
+
sessions: (AuthSession & {
|
|
506
|
+
accountId: string;
|
|
507
|
+
email: string;
|
|
508
|
+
})[];
|
|
509
|
+
next?: string;
|
|
510
|
+
}>;
|
|
511
|
+
importUsers(users: {
|
|
512
|
+
email: string;
|
|
513
|
+
passwordHash: string;
|
|
514
|
+
emailVerified?: boolean;
|
|
515
|
+
}[]): Promise<{
|
|
516
|
+
imported: number;
|
|
517
|
+
}>;
|
|
518
|
+
getProfile(token: string): Promise<RegistrationProfile>;
|
|
519
|
+
updateProfile(input: {
|
|
520
|
+
token: string;
|
|
521
|
+
profile: RegistrationInput;
|
|
522
|
+
}): Promise<RegistrationProfile>;
|
|
523
|
+
getConfigurationRevision(): Promise<string>;
|
|
524
|
+
getSecurityPolicy(): AuthSecurityPolicy;
|
|
525
|
+
getHookStats(): AuthHookStats;
|
|
526
|
+
getRegistrationSchema(): RegistrationOptions;
|
|
527
|
+
getRegistrationMode(): 'open' | 'invite-only' | 'waitlist' | 'off';
|
|
528
|
+
requestRegistration(input: {
|
|
529
|
+
email: string;
|
|
530
|
+
password: string;
|
|
531
|
+
profile?: RegistrationInput;
|
|
532
|
+
}): Promise<{
|
|
533
|
+
id: string;
|
|
534
|
+
}>;
|
|
535
|
+
listRegistrationRequests(options?: {
|
|
536
|
+
limit?: number;
|
|
537
|
+
after?: string;
|
|
538
|
+
}): Promise<{
|
|
539
|
+
requests: {
|
|
540
|
+
id: string;
|
|
541
|
+
email: string;
|
|
542
|
+
created: number;
|
|
543
|
+
}[];
|
|
544
|
+
next?: string;
|
|
545
|
+
}>;
|
|
546
|
+
approveRegistration(input: {
|
|
547
|
+
actorToken: string;
|
|
548
|
+
requestId: string;
|
|
549
|
+
reason?: string;
|
|
550
|
+
}): Promise<AuthUser>;
|
|
551
|
+
invite(input: {
|
|
552
|
+
actorToken: string;
|
|
553
|
+
email: string;
|
|
554
|
+
}): Promise<{
|
|
555
|
+
token: string;
|
|
556
|
+
}>;
|
|
557
|
+
completeStepUp(input: {
|
|
558
|
+
token: string;
|
|
559
|
+
accountId: string;
|
|
560
|
+
method: 'passkey';
|
|
561
|
+
proof: PasskeyAuthProof;
|
|
562
|
+
totp?: string;
|
|
563
|
+
recoveryCode?: string;
|
|
564
|
+
secondFactor?: AuthSecondFactor;
|
|
565
|
+
}): Promise<AuthSessionResult>;
|
|
566
|
+
removePasskey(input: {
|
|
567
|
+
token: string;
|
|
568
|
+
credentialId: string;
|
|
569
|
+
}): Promise<void>;
|
|
570
|
+
unlinkExternal(input: {
|
|
571
|
+
token: string;
|
|
572
|
+
provider: string;
|
|
573
|
+
subject: string;
|
|
574
|
+
}): Promise<void>;
|
|
575
|
+
closeCase(input: {
|
|
576
|
+
actorToken: string;
|
|
577
|
+
caseId: string;
|
|
578
|
+
reason: string;
|
|
579
|
+
}): Promise<AuthCase>;
|
|
580
|
+
addCaseNote(input: {
|
|
581
|
+
actorToken: string;
|
|
582
|
+
caseId: string;
|
|
583
|
+
note: string;
|
|
584
|
+
}): Promise<AuthCase>;
|
|
585
|
+
cleanup(options?: {
|
|
586
|
+
limit?: number;
|
|
587
|
+
}): Promise<{
|
|
588
|
+
removed: number;
|
|
589
|
+
}>;
|
|
590
|
+
requestEmailChange(input: {
|
|
591
|
+
token: string;
|
|
592
|
+
email: string;
|
|
593
|
+
password?: string;
|
|
594
|
+
totp?: string;
|
|
595
|
+
recoveryCode?: string;
|
|
596
|
+
secondFactor?: AuthSecondFactor;
|
|
597
|
+
}): Promise<{
|
|
598
|
+
oldEmail: string;
|
|
599
|
+
newEmail: string;
|
|
600
|
+
verificationToken: string;
|
|
601
|
+
cancelToken: string;
|
|
602
|
+
activateAfter: number;
|
|
603
|
+
}>;
|
|
604
|
+
confirmEmailChange(token: string): Promise<AuthUser>;
|
|
605
|
+
cancelEmailChange(token: string): Promise<void>;
|
|
606
|
+
adminCreateUser(input: {
|
|
607
|
+
actorToken: string;
|
|
608
|
+
email: string;
|
|
609
|
+
reason: string;
|
|
610
|
+
}): Promise<{
|
|
611
|
+
user: AuthUser;
|
|
612
|
+
setupToken: string;
|
|
613
|
+
}>;
|
|
614
|
+
revokeSession(input: {
|
|
615
|
+
token: string;
|
|
616
|
+
sessionId: string;
|
|
617
|
+
}): Promise<void>;
|
|
618
|
+
adminRevokeSession(input: {
|
|
619
|
+
actorToken: string;
|
|
620
|
+
sessionId: string;
|
|
621
|
+
reason: string;
|
|
622
|
+
}): Promise<void>;
|
|
623
|
+
adminAddNote(input: {
|
|
624
|
+
actorToken: string;
|
|
625
|
+
accountId: string;
|
|
626
|
+
reason: string;
|
|
627
|
+
}): Promise<void>;
|
|
628
|
+
adminReveal(input: {
|
|
629
|
+
actorToken: string;
|
|
630
|
+
accountId: string;
|
|
631
|
+
reason: string;
|
|
632
|
+
}): Promise<{
|
|
633
|
+
id: string;
|
|
634
|
+
email: string;
|
|
635
|
+
}>;
|
|
636
|
+
adminExport(input: {
|
|
637
|
+
actorToken: string;
|
|
638
|
+
accountId: string;
|
|
639
|
+
reason: string;
|
|
640
|
+
}): Promise<{
|
|
641
|
+
user: AuthUser;
|
|
642
|
+
sessions: AuthSession[];
|
|
643
|
+
identities: {
|
|
644
|
+
provider: string;
|
|
645
|
+
subject: string;
|
|
646
|
+
}[];
|
|
647
|
+
}>;
|
|
648
|
+
rotateEncryptionKey(): Promise<{
|
|
649
|
+
changed: number;
|
|
650
|
+
remaining: number;
|
|
651
|
+
}>;
|
|
652
|
+
close(): Promise<void>;
|
|
653
|
+
}
|
|
654
|
+
export declare function normalizeEmail(value: string): string;
|
|
655
|
+
export declare function createAuthService(options: AuthOptions): Promise<AuthService>;
|