@azlib/identity 0.2.0
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/LICENSE +201 -0
- package/README.md +387 -0
- package/dist/errors-BGMwaW5s.d.mts +481 -0
- package/dist/errors-BGMwaW5s.d.mts.map +1 -0
- package/dist/errors-Bcjx9o6g.cjs +111 -0
- package/dist/errors-C2xZAatu.d.cts +481 -0
- package/dist/errors-C2xZAatu.d.cts.map +1 -0
- package/dist/errors-CEmnZxIn.mjs +66 -0
- package/dist/errors-CEmnZxIn.mjs.map +1 -0
- package/dist/express.cjs +405 -0
- package/dist/express.d.cts +87 -0
- package/dist/express.d.cts.map +1 -0
- package/dist/express.d.mts +87 -0
- package/dist/express.d.mts.map +1 -0
- package/dist/express.mjs +401 -0
- package/dist/express.mjs.map +1 -0
- package/dist/identity-4eP45YIP.cjs +461 -0
- package/dist/identity-Bz9RDOvT.mjs +410 -0
- package/dist/identity-Bz9RDOvT.mjs.map +1 -0
- package/dist/identity-router-DBL20UWT.d.mts +115 -0
- package/dist/identity-router-DBL20UWT.d.mts.map +1 -0
- package/dist/identity-router-Dib30Waj.d.cts +115 -0
- package/dist/identity-router-Dib30Waj.d.cts.map +1 -0
- package/dist/identity-service-B9zrvE9z.d.mts +128 -0
- package/dist/identity-service-B9zrvE9z.d.mts.map +1 -0
- package/dist/identity-service-CLzKx8Z7.d.cts +128 -0
- package/dist/identity-service-CLzKx8Z7.d.cts.map +1 -0
- package/dist/identity-store-BRRahxcS.d.cts +272 -0
- package/dist/identity-store-BRRahxcS.d.cts.map +1 -0
- package/dist/identity-store-BRRahxcS.d.mts +272 -0
- package/dist/identity-store-BRRahxcS.d.mts.map +1 -0
- package/dist/index-CpufYgyn.d.cts +30 -0
- package/dist/index-CpufYgyn.d.cts.map +1 -0
- package/dist/index-CpufYgyn.d.mts +30 -0
- package/dist/index-CpufYgyn.d.mts.map +1 -0
- package/dist/index.cjs +18 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.mjs +3 -0
- package/dist/logger-Be1wDzBC.cjs +48 -0
- package/dist/logger-CcCHJVVe.mjs +33 -0
- package/dist/logger-CcCHJVVe.mjs.map +1 -0
- package/dist/nestjs.cjs +516 -0
- package/dist/nestjs.d.cts +102 -0
- package/dist/nestjs.d.cts.map +1 -0
- package/dist/nestjs.d.mts +102 -0
- package/dist/nestjs.d.mts.map +1 -0
- package/dist/nestjs.mjs +500 -0
- package/dist/nestjs.mjs.map +1 -0
- package/dist/node.cjs +946 -0
- package/dist/node.d.cts +260 -0
- package/dist/node.d.cts.map +1 -0
- package/dist/node.d.mts +260 -0
- package/dist/node.d.mts.map +1 -0
- package/dist/node.mjs +890 -0
- package/dist/node.mjs.map +1 -0
- package/dist/test-utils.cjs +169 -0
- package/dist/test-utils.d.cts +12 -0
- package/dist/test-utils.d.cts.map +1 -0
- package/dist/test-utils.d.mts +12 -0
- package/dist/test-utils.d.mts.map +1 -0
- package/dist/test-utils.mjs +170 -0
- package/dist/test-utils.mjs.map +1 -0
- package/package.json +92 -0
- package/schema/model.ts +100 -0
- package/schema/mysql.sql +102 -0
- package/schema/postgres.sql +92 -0
- package/schema/prisma.schema +122 -0
- package/schema/sqlite.sql +92 -0
package/dist/node.d.cts
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { C as RolePermissionGrant, D as VerificationToken, E as UserRoleAssignment, O as VerificationTokenType, S as Role, T as TotpSetupResult, _ as IdentityUserStatus, a as generateVerificationToken, b as OAuthLinkedAccount, c as AuthResult, d as AuthenticatedIdentity, f as CredentialRecord, g as IdentityUser, h as IdentityEventType, i as CreateVerificationTokenInput, l as AuthSession, m as IdentityEvent, n as CreateIdentityUserInput, o as hashVerificationToken, p as DirectPermissionGrant, r as IdentityStore, s as AccessTokenClaims, t as CreateAuthSessionInput, u as AuthTokens, v as LoginResult, w as TotpSecret, x as Permission, y as MfaRequiredResult } from "./identity-store-BRRahxcS.cjs";
|
|
2
|
+
import { A as resolveIdentityConfig, B as AuthorizationDecision, C as createTokenService, D as IdentityConfigInput, E as IdentityConfig, F as IdentityLogger, H as PolicyRule, I as consoleLogger, L as noopLogger, M as NotificationService, N as PasswordResetParams, O as IdentityOverrides, P as TwoFactorSmsParams, R as resolveLogger, S as TokenService, T as createAuditLogger, U as evaluateAuthorization, V as AuthorizationRequirement, W as isAuthorized, _ as ExchangeCodeParams, a as IdentityError, b as OAuthUserInfo, c as UnauthenticatedError, d as OAuthProviderNotFoundError, f as OAuthService, g as BuildAuthUrlParams, h as createOAuthService, i as IdentityConfigError, j as EmailVerificationParams, k as LockoutConfig, l as OAuthAuthorizationUrl, m as OAuthStateMismatchError, n as EmailAlreadyRegisteredError, o as InvalidCredentialsError, p as OAuthServiceDeps, r as ForbiddenError, s as InvalidTokenError, t as AccountUnavailableError, u as OAuthCallbackParams, v as OAuthProvider, w as AuditLogger, x as SessionDeps, y as OAuthTokens, z as AuthorizationContext } from "./errors-C2xZAatu.cjs";
|
|
3
|
+
import { a as RegisterInput, c as registerUser, d as loginUser, f as PasswordHasher, i as RegisterDeps, l as LoginDeps, n as IdentityServiceConfig, o as RegistrationValidationError, p as createPasswordHasher, r as createIdentityService, s as normalizeEmail, t as IdentityService, u as LoginInput } from "./identity-service-CLzKx8Z7.cjs";
|
|
4
|
+
import { t as identitySchemaModel } from "./index-CpufYgyn.cjs";
|
|
5
|
+
|
|
6
|
+
//#region core/lockout.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Checks whether the user account is currently locked. Throws {@link AccountUnavailableError}
|
|
9
|
+
* when the lockout is active (i.e. `lockedUntil` is in the future).
|
|
10
|
+
*
|
|
11
|
+
* Note: if `lockedUntil` is in the past the lock has expired — the user may proceed and
|
|
12
|
+
* the stale lock will be cleared on successful login.
|
|
13
|
+
*/
|
|
14
|
+
declare function checkLockout(user: IdentityUser, config: LockoutConfig, now: () => Date): void;
|
|
15
|
+
/**
|
|
16
|
+
* Records a failed login attempt. When the threshold is reached the account is locked
|
|
17
|
+
* for `config.durationSeconds` seconds (or permanently when `durationSeconds` is 0).
|
|
18
|
+
*/
|
|
19
|
+
declare function recordFailedAttempt(store: IdentityStore, user: IdentityUser, config: LockoutConfig, now: () => Date): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Clears lockout state after a successful login. Resets the failure counter and any
|
|
22
|
+
* active lockout so the account returns to `active` status.
|
|
23
|
+
*/
|
|
24
|
+
declare function clearLockout(store: IdentityStore, user: IdentityUser): Promise<void>;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region core/refresh-service.d.ts
|
|
27
|
+
/** Dependencies for the refresh flow. */
|
|
28
|
+
interface RefreshDeps {
|
|
29
|
+
config: IdentityConfig;
|
|
30
|
+
store: IdentityStore;
|
|
31
|
+
tokenService: TokenService;
|
|
32
|
+
audit: AuditLogger;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Rotates a refresh session: validates the presented refresh token against the stored
|
|
36
|
+
* hash, issues a new access token, and replaces the stored refresh-token hash.
|
|
37
|
+
*
|
|
38
|
+
* Detects refresh-token reuse (a token whose session exists but whose hash no longer
|
|
39
|
+
* matches) and revokes the session as a precaution.
|
|
40
|
+
*/
|
|
41
|
+
declare function refreshSession(deps: RefreshDeps, presentedToken: string): Promise<AuthResult>;
|
|
42
|
+
/** Revokes a single session (logout). */
|
|
43
|
+
declare function revokeSession(deps: Pick<RefreshDeps, "config" | "store" | "tokenService" | "audit">, presentedToken: string): Promise<void>;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region core/oauth/providers/google.d.ts
|
|
46
|
+
/** Configuration for {@link createGoogleOAuthProvider}. */
|
|
47
|
+
interface GoogleOAuthConfig {
|
|
48
|
+
/** OAuth 2.0 Client ID from Google Cloud Console. */
|
|
49
|
+
clientId: string;
|
|
50
|
+
/**
|
|
51
|
+
* OAuth 2.0 Client Secret. Must be kept server-side — never expose in client code or
|
|
52
|
+
* commit to source control.
|
|
53
|
+
*/
|
|
54
|
+
clientSecret: string;
|
|
55
|
+
/**
|
|
56
|
+
* Override the default OpenID Connect scopes. Defaults to `["openid", "email", "profile"]`.
|
|
57
|
+
*/
|
|
58
|
+
scopes?: string[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Creates an {@link OAuthProvider} configured for Google OAuth 2.0 / OpenID Connect.
|
|
62
|
+
*
|
|
63
|
+
* Security notes:
|
|
64
|
+
* - The client secret is used only during server-side code exchange.
|
|
65
|
+
* - The userinfo endpoint is called with the access token to fetch user data, providing
|
|
66
|
+
* a verified source of truth over the network (HTTPS).
|
|
67
|
+
* - The `state` parameter is required and must be verified by the caller to prevent CSRF.
|
|
68
|
+
*/
|
|
69
|
+
declare function createGoogleOAuthProvider(config: GoogleOAuthConfig): OAuthProvider;
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region core/oauth/providers/microsoft.d.ts
|
|
72
|
+
/** Configuration for {@link createMicrosoftOAuthProvider}. */
|
|
73
|
+
interface MicrosoftOAuthConfig {
|
|
74
|
+
/** Application (client) ID from the Azure / Entra app registration. */
|
|
75
|
+
clientId: string;
|
|
76
|
+
/**
|
|
77
|
+
* Client secret from the Azure / Entra app registration. Must be kept server-side —
|
|
78
|
+
* never expose in client code or commit to source control.
|
|
79
|
+
*/
|
|
80
|
+
clientSecret: string;
|
|
81
|
+
/**
|
|
82
|
+
* Tenant identifier. Use `"common"` (default) to accept personal and work/school
|
|
83
|
+
* accounts, `"organizations"` for work/school only, `"consumers"` for personal
|
|
84
|
+
* accounts only, or your specific tenant GUID / domain.
|
|
85
|
+
*/
|
|
86
|
+
tenantId?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Override the default Microsoft Graph scopes. Defaults to
|
|
89
|
+
* `["openid", "email", "profile", "User.Read"]`.
|
|
90
|
+
*/
|
|
91
|
+
scopes?: string[];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Creates an {@link OAuthProvider} configured for Microsoft Entra ID OAuth 2.0 / OIDC.
|
|
95
|
+
*
|
|
96
|
+
* Security notes:
|
|
97
|
+
* - The client secret is used only during server-side code exchange.
|
|
98
|
+
* - User data is fetched from the Microsoft Graph API using the access token, providing
|
|
99
|
+
* a verified source of truth over HTTPS.
|
|
100
|
+
* - The `state` parameter is required and must be verified by the caller to prevent CSRF.
|
|
101
|
+
*/
|
|
102
|
+
declare function createMicrosoftOAuthProvider(config: MicrosoftOAuthConfig): OAuthProvider;
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region core/email-verification.d.ts
|
|
105
|
+
/** Raised when an email verification token is missing, expired, or already used. */
|
|
106
|
+
declare class EmailVerificationError extends IdentityError {
|
|
107
|
+
constructor(message?: string);
|
|
108
|
+
}
|
|
109
|
+
interface EmailVerificationDeps {
|
|
110
|
+
config: IdentityConfig;
|
|
111
|
+
store: IdentityStore;
|
|
112
|
+
audit: AuditLogger;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Generates and persists a verification token, then calls the notification service.
|
|
116
|
+
*
|
|
117
|
+
* Safe to call after registration or when the user explicitly requests a resend.
|
|
118
|
+
* Returns silently when the email is already verified.
|
|
119
|
+
*/
|
|
120
|
+
declare function requestEmailVerification(deps: EmailVerificationDeps, userId: string): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Verifies the user's email address using the token from the verification link.
|
|
123
|
+
*
|
|
124
|
+
* Throws {@link EmailVerificationError} for unknown, expired, or already-used tokens.
|
|
125
|
+
*/
|
|
126
|
+
declare function verifyEmail(deps: EmailVerificationDeps, rawToken: string): Promise<void>;
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region core/password-reset.d.ts
|
|
129
|
+
/** Raised when a password reset token is missing, expired, or already used. */
|
|
130
|
+
declare class PasswordResetError extends IdentityError {
|
|
131
|
+
constructor(message?: string);
|
|
132
|
+
}
|
|
133
|
+
interface PasswordResetDeps {
|
|
134
|
+
config: IdentityConfig;
|
|
135
|
+
store: IdentityStore;
|
|
136
|
+
hasher: PasswordHasher;
|
|
137
|
+
audit: AuditLogger;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Generates a password reset token and dispatches the notification.
|
|
141
|
+
*
|
|
142
|
+
* Never reveals whether the email address exists in the system (returns silently for
|
|
143
|
+
* unknown addresses) to prevent account enumeration.
|
|
144
|
+
*/
|
|
145
|
+
declare function requestPasswordReset(deps: PasswordResetDeps, email: string): Promise<void>;
|
|
146
|
+
/**
|
|
147
|
+
* Validates the reset token and sets a new password.
|
|
148
|
+
*
|
|
149
|
+
* On success, bumps `authVersion` and revokes all existing sessions so outstanding
|
|
150
|
+
* refresh tokens are immediately invalidated.
|
|
151
|
+
*/
|
|
152
|
+
declare function resetPassword(deps: PasswordResetDeps, rawToken: string, newPassword: string): Promise<void>;
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region core/totp.d.ts
|
|
155
|
+
/** Encodes a Buffer to a base32 string (no padding). */
|
|
156
|
+
declare function base32Encode(buffer: Buffer): string;
|
|
157
|
+
/** Decodes a base32 string (case-insensitive, padding stripped) to a Buffer. */
|
|
158
|
+
declare function base32Decode(encoded: string): Buffer;
|
|
159
|
+
/**
|
|
160
|
+
* Generates a 160-bit random TOTP secret and returns it base32-encoded.
|
|
161
|
+
* 160 bits (20 bytes) aligns with the SHA-1 block size and is standard for TOTP.
|
|
162
|
+
*/
|
|
163
|
+
declare function generateTotpSecret(): string;
|
|
164
|
+
/**
|
|
165
|
+
* Generates the current TOTP code for the given base32 secret (RFC 6238).
|
|
166
|
+
*/
|
|
167
|
+
declare function generateTotp(secretBase32: string, now?: Date): string;
|
|
168
|
+
/**
|
|
169
|
+
* Verifies a 6-digit TOTP code.
|
|
170
|
+
* Accepts codes from the previous, current, or next time step (±1 window) to
|
|
171
|
+
* tolerate clock skew between server and authenticator app.
|
|
172
|
+
*/
|
|
173
|
+
declare function verifyTotp(code: string, secretBase32: string, now?: Date): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Builds an `otpauth://totp/` URI suitable for QR code scanning in authenticator apps
|
|
176
|
+
* (Google Authenticator, Authy, 1Password, etc.).
|
|
177
|
+
*/
|
|
178
|
+
declare function buildOtpAuthUri(params: {
|
|
179
|
+
secret: string;
|
|
180
|
+
accountName: string;
|
|
181
|
+
issuer: string;
|
|
182
|
+
}): string;
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region core/two-factor.d.ts
|
|
185
|
+
/** Raised when a TOTP code is absent or incorrect. */
|
|
186
|
+
declare class TwoFactorError extends IdentityError {
|
|
187
|
+
constructor(message?: string);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Raised during login when the user has 2FA enabled and the TOTP challenge has not yet
|
|
191
|
+
* been completed. HTTP 403 signals "authenticated but additional factor required".
|
|
192
|
+
*/
|
|
193
|
+
declare class TwoFactorRequiredError extends IdentityError {
|
|
194
|
+
constructor();
|
|
195
|
+
}
|
|
196
|
+
interface TwoFactorDeps extends SessionDeps {
|
|
197
|
+
audit: AuditLogger;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Begins the 2FA setup flow. Generates a new TOTP secret (stored as pending, not yet
|
|
201
|
+
* active) and returns the secret + QR URI for display in an authenticator app.
|
|
202
|
+
*
|
|
203
|
+
* The caller must then call {@link enable2FA} with a valid TOTP code to activate 2FA.
|
|
204
|
+
*/
|
|
205
|
+
declare function setup2FA(deps: TwoFactorDeps, userId: string): Promise<TotpSetupResult>;
|
|
206
|
+
/**
|
|
207
|
+
* Confirms and enables 2FA. A valid TOTP code from the authenticator app is required.
|
|
208
|
+
* Idempotent when 2FA is already enabled for the user.
|
|
209
|
+
*/
|
|
210
|
+
declare function enable2FA(deps: TwoFactorDeps, userId: string, totpCode: string): Promise<void>;
|
|
211
|
+
/**
|
|
212
|
+
* Disables 2FA for the user. Requires a valid TOTP code as confirmation.
|
|
213
|
+
* After disabling, login flows no longer issue MFA challenges for the account.
|
|
214
|
+
*/
|
|
215
|
+
declare function disable2FA(deps: TwoFactorDeps, userId: string, totpCode: string): Promise<void>;
|
|
216
|
+
/**
|
|
217
|
+
* Issues a short-lived signed JWT that encodes a pending MFA session.
|
|
218
|
+
* The client must present this token together with a TOTP code to complete login.
|
|
219
|
+
*/
|
|
220
|
+
declare function issueMfaChallengeToken(config: IdentityConfig, userId: string): Promise<string>;
|
|
221
|
+
/**
|
|
222
|
+
* Verifies an MFA challenge token and TOTP code, then issues a full auth session.
|
|
223
|
+
*
|
|
224
|
+
* Throws {@link InvalidTokenError} for an expired/invalid challenge token and
|
|
225
|
+
* {@link TwoFactorError} for a wrong TOTP code.
|
|
226
|
+
*/
|
|
227
|
+
declare function verifyMfaChallenge(deps: TwoFactorDeps, mfaToken: string, totpCode: string): Promise<AuthResult>;
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region core/account-admin.d.ts
|
|
230
|
+
/** Raised when the target user does not exist. */
|
|
231
|
+
declare class AccountAdminError extends IdentityError {
|
|
232
|
+
constructor(message: string);
|
|
233
|
+
}
|
|
234
|
+
interface AccountAdminDeps {
|
|
235
|
+
config: IdentityConfig;
|
|
236
|
+
store: IdentityStore;
|
|
237
|
+
audit: AuditLogger;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Locks a user account. Sets `status` to `"locked"` and immediately revokes all active
|
|
241
|
+
* sessions so existing refresh tokens stop working.
|
|
242
|
+
*
|
|
243
|
+
* Typically called by an admin. The `AccountUnavailableError` is thrown during any
|
|
244
|
+
* subsequent login or token verification attempt for the account.
|
|
245
|
+
*/
|
|
246
|
+
declare function lockAccount(deps: AccountAdminDeps, userId: string): Promise<void>;
|
|
247
|
+
/**
|
|
248
|
+
* Unlocks a user account. Resets `status` to `"active"` and clears any stale lockout
|
|
249
|
+
* counters so the user can log in immediately.
|
|
250
|
+
*/
|
|
251
|
+
declare function unlockAccount(deps: AccountAdminDeps, userId: string): Promise<void>;
|
|
252
|
+
/**
|
|
253
|
+
* Disables a user account. Sets `status` to `"disabled"` and revokes all sessions.
|
|
254
|
+
* Unlike `lockAccount`, disabled accounts are not automatically unlockable by the
|
|
255
|
+
* lockout timer — an explicit call to `unlockAccount` is required.
|
|
256
|
+
*/
|
|
257
|
+
declare function disableAccount(deps: AccountAdminDeps, userId: string): Promise<void>;
|
|
258
|
+
//#endregion
|
|
259
|
+
export { AccessTokenClaims, AccountAdminDeps, AccountAdminError, AccountUnavailableError, AuditLogger, AuthResult, AuthSession, AuthTokens, AuthenticatedIdentity, AuthorizationContext, AuthorizationDecision, AuthorizationRequirement, BuildAuthUrlParams, CreateAuthSessionInput, CreateIdentityUserInput, CreateVerificationTokenInput, CredentialRecord, DirectPermissionGrant, EmailAlreadyRegisteredError, EmailVerificationDeps, EmailVerificationError, EmailVerificationParams, ExchangeCodeParams, ForbiddenError, type GoogleOAuthConfig, IdentityConfig, IdentityConfigError, IdentityConfigInput, IdentityError, IdentityEvent, IdentityEventType, IdentityLogger, IdentityOverrides, IdentityService, IdentityServiceConfig, IdentityStore, IdentityUser, IdentityUserStatus, InvalidCredentialsError, InvalidTokenError, LockoutConfig, LoginDeps, LoginInput, LoginResult, MfaRequiredResult, type MicrosoftOAuthConfig, NotificationService, OAuthAuthorizationUrl, OAuthCallbackParams, OAuthLinkedAccount, OAuthProvider, OAuthProviderNotFoundError, OAuthService, OAuthServiceDeps, OAuthStateMismatchError, OAuthTokens, OAuthUserInfo, PasswordHasher, PasswordResetDeps, PasswordResetError, PasswordResetParams, Permission, PolicyRule, RefreshDeps, RegisterDeps, RegisterInput, RegistrationValidationError, Role, RolePermissionGrant, TokenService, TotpSecret, TotpSetupResult, TwoFactorDeps, TwoFactorError, TwoFactorRequiredError, TwoFactorSmsParams, UnauthenticatedError, UserRoleAssignment, VerificationToken, VerificationTokenType, base32Decode, base32Encode, buildOtpAuthUri, checkLockout, clearLockout, consoleLogger, createAuditLogger, createGoogleOAuthProvider, createIdentityService, createMicrosoftOAuthProvider, createOAuthService, createPasswordHasher, createTokenService, disable2FA, disableAccount, enable2FA, evaluateAuthorization, generateTotp, generateTotpSecret, generateVerificationToken, hashVerificationToken, identitySchemaModel, isAuthorized, issueMfaChallengeToken, lockAccount, loginUser, noopLogger, normalizeEmail, recordFailedAttempt, refreshSession, registerUser, requestEmailVerification, requestPasswordReset, resetPassword, resolveIdentityConfig, resolveLogger, revokeSession, setup2FA, unlockAccount, verifyEmail, verifyMfaChallenge, verifyTotp };
|
|
260
|
+
//# sourceMappingURL=node.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.cts","names":[],"sources":["../core/lockout.ts","../core/refresh-service.ts","../core/oauth/providers/google.ts","../core/oauth/providers/microsoft.ts","../core/email-verification.ts","../core/password-reset.ts","../core/totp.ts","../core/two-factor.ts","../core/account-admin.ts"],"mappings":";;;;;;;;;AAYA;;;;iBAAgB,YAAA,CACd,IAAA,EAAM,YAAA,EACN,MAAA,EAAQ,aAAA,EACR,GAAA,QAAW,IAAA;;;;;iBAYS,mBAAA,CACpB,KAAA,EAAO,aAAA,EACP,IAAA,EAAM,YAAA,EACN,MAAA,EAAQ,aAAA,EACR,GAAA,QAAW,IAAA,GACV,OAAA;;;;;iBAwBmB,YAAA,CACpB,KAAA,EAAO,aAAA,EACP,IAAA,EAAM,YAAA,GACL,OAAA;;;;UClDc,WAAA;EACf,MAAA,EAAQ,cAAA;EACR,KAAA,EAAO,aAAA;EACP,YAAA,EAAc,YAAA;EACd,KAAA,EAAO,WAAA;AAAA;;;;;;;;iBAUa,cAAA,CACpB,IAAA,EAAM,WAAA,EACN,cAAA,WACC,OAAA,CAAQ,UAAA;;iBAoDW,aAAA,CACpB,IAAA,EAAM,IAAA,CAAK,WAAA,kDACX,cAAA,WACC,OAAA;;;;UCjDc,iBAAA;EFjBf;EEmBA,QAAA;EFnBe;AAYjB;;;EEYE,YAAA;EFVM;;;EEcN,MAAA;AAAA;;;;;;;;;;iBA+Bc,yBAAA,CAA0B,MAAA,EAAQ,iBAAA,GAAoB,aAAa;;;;UC3ClE,oBAAA;EHJK;EGMpB,QAAA;;;;;EAK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EAChD,KAAA,EAAO,WAAA;AAAA;;;APrBQ;AAYjB;;;iBOsBsB,QAAA,CACpB,IAAA,EAAM,aAAA,EACN,MAAA,WACC,OAAA,CAAQ,eAAA;;;;;iBAoCW,SAAA,CACpB,IAAA,EAAM,aAAA,EACN,MAAA,UACA,QAAA,WACC,OAAO;;;;;iBA2BY,UAAA,CACpB,IAAA,EAAM,aAAA,EACN,MAAA,UACA,QAAA,WACC,OAAO;;;;;iBA6BY,sBAAA,CACpB,MAAA,EAAQ,cAAA,EACR,MAAA,WACC,OAAO;;AP3HA;AAwBV;;;;iBOwHsB,kBAAA,CACpB,IAAA,EAAM,aAAA,EACN,QAAA,UACA,QAAA,WACC,OAAA,CAAQ,UAAA;;;;cC9KE,iBAAA,SAA0B,aAAa;cACtC,OAAA;AAAA;AAAA,UAKG,gBAAA;EACf,MAAA,EAAQ,cAAA;EACR,KAAA,EAAO,aAAA;EACP,KAAA,EAAO,WAAA;AAAA;;;;;;;;iBAUa,WAAA,CAAY,IAAA,EAAM,gBAAA,EAAkB,MAAA,WAAiB,OAAO;ARVjE;AAYjB;;;AAZiB,iBQ2BK,aAAA,CAAc,IAAA,EAAM,gBAAA,EAAkB,MAAA,WAAiB,OAAO;;;;;;iBAoB9D,cAAA,CAAe,IAAA,EAAM,gBAAA,EAAkB,MAAA,WAAiB,OAAO"}
|
package/dist/node.d.mts
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { C as RolePermissionGrant, D as VerificationToken, E as UserRoleAssignment, O as VerificationTokenType, S as Role, T as TotpSetupResult, _ as IdentityUserStatus, a as generateVerificationToken, b as OAuthLinkedAccount, c as AuthResult, d as AuthenticatedIdentity, f as CredentialRecord, g as IdentityUser, h as IdentityEventType, i as CreateVerificationTokenInput, l as AuthSession, m as IdentityEvent, n as CreateIdentityUserInput, o as hashVerificationToken, p as DirectPermissionGrant, r as IdentityStore, s as AccessTokenClaims, t as CreateAuthSessionInput, u as AuthTokens, v as LoginResult, w as TotpSecret, x as Permission, y as MfaRequiredResult } from "./identity-store-BRRahxcS.mjs";
|
|
2
|
+
import { A as resolveIdentityConfig, B as AuthorizationDecision, C as createTokenService, D as IdentityConfigInput, E as IdentityConfig, F as IdentityLogger, H as PolicyRule, I as consoleLogger, L as noopLogger, M as NotificationService, N as PasswordResetParams, O as IdentityOverrides, P as TwoFactorSmsParams, R as resolveLogger, S as TokenService, T as createAuditLogger, U as evaluateAuthorization, V as AuthorizationRequirement, W as isAuthorized, _ as ExchangeCodeParams, a as IdentityError, b as OAuthUserInfo, c as UnauthenticatedError, d as OAuthProviderNotFoundError, f as OAuthService, g as BuildAuthUrlParams, h as createOAuthService, i as IdentityConfigError, j as EmailVerificationParams, k as LockoutConfig, l as OAuthAuthorizationUrl, m as OAuthStateMismatchError, n as EmailAlreadyRegisteredError, o as InvalidCredentialsError, p as OAuthServiceDeps, r as ForbiddenError, s as InvalidTokenError, t as AccountUnavailableError, u as OAuthCallbackParams, v as OAuthProvider, w as AuditLogger, x as SessionDeps, y as OAuthTokens, z as AuthorizationContext } from "./errors-BGMwaW5s.mjs";
|
|
3
|
+
import { a as RegisterInput, c as registerUser, d as loginUser, f as PasswordHasher, i as RegisterDeps, l as LoginDeps, n as IdentityServiceConfig, o as RegistrationValidationError, p as createPasswordHasher, r as createIdentityService, s as normalizeEmail, t as IdentityService, u as LoginInput } from "./identity-service-B9zrvE9z.mjs";
|
|
4
|
+
import { t as identitySchemaModel } from "./index-CpufYgyn.mjs";
|
|
5
|
+
|
|
6
|
+
//#region core/lockout.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Checks whether the user account is currently locked. Throws {@link AccountUnavailableError}
|
|
9
|
+
* when the lockout is active (i.e. `lockedUntil` is in the future).
|
|
10
|
+
*
|
|
11
|
+
* Note: if `lockedUntil` is in the past the lock has expired — the user may proceed and
|
|
12
|
+
* the stale lock will be cleared on successful login.
|
|
13
|
+
*/
|
|
14
|
+
declare function checkLockout(user: IdentityUser, config: LockoutConfig, now: () => Date): void;
|
|
15
|
+
/**
|
|
16
|
+
* Records a failed login attempt. When the threshold is reached the account is locked
|
|
17
|
+
* for `config.durationSeconds` seconds (or permanently when `durationSeconds` is 0).
|
|
18
|
+
*/
|
|
19
|
+
declare function recordFailedAttempt(store: IdentityStore, user: IdentityUser, config: LockoutConfig, now: () => Date): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Clears lockout state after a successful login. Resets the failure counter and any
|
|
22
|
+
* active lockout so the account returns to `active` status.
|
|
23
|
+
*/
|
|
24
|
+
declare function clearLockout(store: IdentityStore, user: IdentityUser): Promise<void>;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region core/refresh-service.d.ts
|
|
27
|
+
/** Dependencies for the refresh flow. */
|
|
28
|
+
interface RefreshDeps {
|
|
29
|
+
config: IdentityConfig;
|
|
30
|
+
store: IdentityStore;
|
|
31
|
+
tokenService: TokenService;
|
|
32
|
+
audit: AuditLogger;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Rotates a refresh session: validates the presented refresh token against the stored
|
|
36
|
+
* hash, issues a new access token, and replaces the stored refresh-token hash.
|
|
37
|
+
*
|
|
38
|
+
* Detects refresh-token reuse (a token whose session exists but whose hash no longer
|
|
39
|
+
* matches) and revokes the session as a precaution.
|
|
40
|
+
*/
|
|
41
|
+
declare function refreshSession(deps: RefreshDeps, presentedToken: string): Promise<AuthResult>;
|
|
42
|
+
/** Revokes a single session (logout). */
|
|
43
|
+
declare function revokeSession(deps: Pick<RefreshDeps, "config" | "store" | "tokenService" | "audit">, presentedToken: string): Promise<void>;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region core/oauth/providers/google.d.ts
|
|
46
|
+
/** Configuration for {@link createGoogleOAuthProvider}. */
|
|
47
|
+
interface GoogleOAuthConfig {
|
|
48
|
+
/** OAuth 2.0 Client ID from Google Cloud Console. */
|
|
49
|
+
clientId: string;
|
|
50
|
+
/**
|
|
51
|
+
* OAuth 2.0 Client Secret. Must be kept server-side — never expose in client code or
|
|
52
|
+
* commit to source control.
|
|
53
|
+
*/
|
|
54
|
+
clientSecret: string;
|
|
55
|
+
/**
|
|
56
|
+
* Override the default OpenID Connect scopes. Defaults to `["openid", "email", "profile"]`.
|
|
57
|
+
*/
|
|
58
|
+
scopes?: string[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Creates an {@link OAuthProvider} configured for Google OAuth 2.0 / OpenID Connect.
|
|
62
|
+
*
|
|
63
|
+
* Security notes:
|
|
64
|
+
* - The client secret is used only during server-side code exchange.
|
|
65
|
+
* - The userinfo endpoint is called with the access token to fetch user data, providing
|
|
66
|
+
* a verified source of truth over the network (HTTPS).
|
|
67
|
+
* - The `state` parameter is required and must be verified by the caller to prevent CSRF.
|
|
68
|
+
*/
|
|
69
|
+
declare function createGoogleOAuthProvider(config: GoogleOAuthConfig): OAuthProvider;
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region core/oauth/providers/microsoft.d.ts
|
|
72
|
+
/** Configuration for {@link createMicrosoftOAuthProvider}. */
|
|
73
|
+
interface MicrosoftOAuthConfig {
|
|
74
|
+
/** Application (client) ID from the Azure / Entra app registration. */
|
|
75
|
+
clientId: string;
|
|
76
|
+
/**
|
|
77
|
+
* Client secret from the Azure / Entra app registration. Must be kept server-side —
|
|
78
|
+
* never expose in client code or commit to source control.
|
|
79
|
+
*/
|
|
80
|
+
clientSecret: string;
|
|
81
|
+
/**
|
|
82
|
+
* Tenant identifier. Use `"common"` (default) to accept personal and work/school
|
|
83
|
+
* accounts, `"organizations"` for work/school only, `"consumers"` for personal
|
|
84
|
+
* accounts only, or your specific tenant GUID / domain.
|
|
85
|
+
*/
|
|
86
|
+
tenantId?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Override the default Microsoft Graph scopes. Defaults to
|
|
89
|
+
* `["openid", "email", "profile", "User.Read"]`.
|
|
90
|
+
*/
|
|
91
|
+
scopes?: string[];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Creates an {@link OAuthProvider} configured for Microsoft Entra ID OAuth 2.0 / OIDC.
|
|
95
|
+
*
|
|
96
|
+
* Security notes:
|
|
97
|
+
* - The client secret is used only during server-side code exchange.
|
|
98
|
+
* - User data is fetched from the Microsoft Graph API using the access token, providing
|
|
99
|
+
* a verified source of truth over HTTPS.
|
|
100
|
+
* - The `state` parameter is required and must be verified by the caller to prevent CSRF.
|
|
101
|
+
*/
|
|
102
|
+
declare function createMicrosoftOAuthProvider(config: MicrosoftOAuthConfig): OAuthProvider;
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region core/email-verification.d.ts
|
|
105
|
+
/** Raised when an email verification token is missing, expired, or already used. */
|
|
106
|
+
declare class EmailVerificationError extends IdentityError {
|
|
107
|
+
constructor(message?: string);
|
|
108
|
+
}
|
|
109
|
+
interface EmailVerificationDeps {
|
|
110
|
+
config: IdentityConfig;
|
|
111
|
+
store: IdentityStore;
|
|
112
|
+
audit: AuditLogger;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Generates and persists a verification token, then calls the notification service.
|
|
116
|
+
*
|
|
117
|
+
* Safe to call after registration or when the user explicitly requests a resend.
|
|
118
|
+
* Returns silently when the email is already verified.
|
|
119
|
+
*/
|
|
120
|
+
declare function requestEmailVerification(deps: EmailVerificationDeps, userId: string): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Verifies the user's email address using the token from the verification link.
|
|
123
|
+
*
|
|
124
|
+
* Throws {@link EmailVerificationError} for unknown, expired, or already-used tokens.
|
|
125
|
+
*/
|
|
126
|
+
declare function verifyEmail(deps: EmailVerificationDeps, rawToken: string): Promise<void>;
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region core/password-reset.d.ts
|
|
129
|
+
/** Raised when a password reset token is missing, expired, or already used. */
|
|
130
|
+
declare class PasswordResetError extends IdentityError {
|
|
131
|
+
constructor(message?: string);
|
|
132
|
+
}
|
|
133
|
+
interface PasswordResetDeps {
|
|
134
|
+
config: IdentityConfig;
|
|
135
|
+
store: IdentityStore;
|
|
136
|
+
hasher: PasswordHasher;
|
|
137
|
+
audit: AuditLogger;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Generates a password reset token and dispatches the notification.
|
|
141
|
+
*
|
|
142
|
+
* Never reveals whether the email address exists in the system (returns silently for
|
|
143
|
+
* unknown addresses) to prevent account enumeration.
|
|
144
|
+
*/
|
|
145
|
+
declare function requestPasswordReset(deps: PasswordResetDeps, email: string): Promise<void>;
|
|
146
|
+
/**
|
|
147
|
+
* Validates the reset token and sets a new password.
|
|
148
|
+
*
|
|
149
|
+
* On success, bumps `authVersion` and revokes all existing sessions so outstanding
|
|
150
|
+
* refresh tokens are immediately invalidated.
|
|
151
|
+
*/
|
|
152
|
+
declare function resetPassword(deps: PasswordResetDeps, rawToken: string, newPassword: string): Promise<void>;
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region core/totp.d.ts
|
|
155
|
+
/** Encodes a Buffer to a base32 string (no padding). */
|
|
156
|
+
declare function base32Encode(buffer: Buffer): string;
|
|
157
|
+
/** Decodes a base32 string (case-insensitive, padding stripped) to a Buffer. */
|
|
158
|
+
declare function base32Decode(encoded: string): Buffer;
|
|
159
|
+
/**
|
|
160
|
+
* Generates a 160-bit random TOTP secret and returns it base32-encoded.
|
|
161
|
+
* 160 bits (20 bytes) aligns with the SHA-1 block size and is standard for TOTP.
|
|
162
|
+
*/
|
|
163
|
+
declare function generateTotpSecret(): string;
|
|
164
|
+
/**
|
|
165
|
+
* Generates the current TOTP code for the given base32 secret (RFC 6238).
|
|
166
|
+
*/
|
|
167
|
+
declare function generateTotp(secretBase32: string, now?: Date): string;
|
|
168
|
+
/**
|
|
169
|
+
* Verifies a 6-digit TOTP code.
|
|
170
|
+
* Accepts codes from the previous, current, or next time step (±1 window) to
|
|
171
|
+
* tolerate clock skew between server and authenticator app.
|
|
172
|
+
*/
|
|
173
|
+
declare function verifyTotp(code: string, secretBase32: string, now?: Date): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Builds an `otpauth://totp/` URI suitable for QR code scanning in authenticator apps
|
|
176
|
+
* (Google Authenticator, Authy, 1Password, etc.).
|
|
177
|
+
*/
|
|
178
|
+
declare function buildOtpAuthUri(params: {
|
|
179
|
+
secret: string;
|
|
180
|
+
accountName: string;
|
|
181
|
+
issuer: string;
|
|
182
|
+
}): string;
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region core/two-factor.d.ts
|
|
185
|
+
/** Raised when a TOTP code is absent or incorrect. */
|
|
186
|
+
declare class TwoFactorError extends IdentityError {
|
|
187
|
+
constructor(message?: string);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Raised during login when the user has 2FA enabled and the TOTP challenge has not yet
|
|
191
|
+
* been completed. HTTP 403 signals "authenticated but additional factor required".
|
|
192
|
+
*/
|
|
193
|
+
declare class TwoFactorRequiredError extends IdentityError {
|
|
194
|
+
constructor();
|
|
195
|
+
}
|
|
196
|
+
interface TwoFactorDeps extends SessionDeps {
|
|
197
|
+
audit: AuditLogger;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Begins the 2FA setup flow. Generates a new TOTP secret (stored as pending, not yet
|
|
201
|
+
* active) and returns the secret + QR URI for display in an authenticator app.
|
|
202
|
+
*
|
|
203
|
+
* The caller must then call {@link enable2FA} with a valid TOTP code to activate 2FA.
|
|
204
|
+
*/
|
|
205
|
+
declare function setup2FA(deps: TwoFactorDeps, userId: string): Promise<TotpSetupResult>;
|
|
206
|
+
/**
|
|
207
|
+
* Confirms and enables 2FA. A valid TOTP code from the authenticator app is required.
|
|
208
|
+
* Idempotent when 2FA is already enabled for the user.
|
|
209
|
+
*/
|
|
210
|
+
declare function enable2FA(deps: TwoFactorDeps, userId: string, totpCode: string): Promise<void>;
|
|
211
|
+
/**
|
|
212
|
+
* Disables 2FA for the user. Requires a valid TOTP code as confirmation.
|
|
213
|
+
* After disabling, login flows no longer issue MFA challenges for the account.
|
|
214
|
+
*/
|
|
215
|
+
declare function disable2FA(deps: TwoFactorDeps, userId: string, totpCode: string): Promise<void>;
|
|
216
|
+
/**
|
|
217
|
+
* Issues a short-lived signed JWT that encodes a pending MFA session.
|
|
218
|
+
* The client must present this token together with a TOTP code to complete login.
|
|
219
|
+
*/
|
|
220
|
+
declare function issueMfaChallengeToken(config: IdentityConfig, userId: string): Promise<string>;
|
|
221
|
+
/**
|
|
222
|
+
* Verifies an MFA challenge token and TOTP code, then issues a full auth session.
|
|
223
|
+
*
|
|
224
|
+
* Throws {@link InvalidTokenError} for an expired/invalid challenge token and
|
|
225
|
+
* {@link TwoFactorError} for a wrong TOTP code.
|
|
226
|
+
*/
|
|
227
|
+
declare function verifyMfaChallenge(deps: TwoFactorDeps, mfaToken: string, totpCode: string): Promise<AuthResult>;
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region core/account-admin.d.ts
|
|
230
|
+
/** Raised when the target user does not exist. */
|
|
231
|
+
declare class AccountAdminError extends IdentityError {
|
|
232
|
+
constructor(message: string);
|
|
233
|
+
}
|
|
234
|
+
interface AccountAdminDeps {
|
|
235
|
+
config: IdentityConfig;
|
|
236
|
+
store: IdentityStore;
|
|
237
|
+
audit: AuditLogger;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Locks a user account. Sets `status` to `"locked"` and immediately revokes all active
|
|
241
|
+
* sessions so existing refresh tokens stop working.
|
|
242
|
+
*
|
|
243
|
+
* Typically called by an admin. The `AccountUnavailableError` is thrown during any
|
|
244
|
+
* subsequent login or token verification attempt for the account.
|
|
245
|
+
*/
|
|
246
|
+
declare function lockAccount(deps: AccountAdminDeps, userId: string): Promise<void>;
|
|
247
|
+
/**
|
|
248
|
+
* Unlocks a user account. Resets `status` to `"active"` and clears any stale lockout
|
|
249
|
+
* counters so the user can log in immediately.
|
|
250
|
+
*/
|
|
251
|
+
declare function unlockAccount(deps: AccountAdminDeps, userId: string): Promise<void>;
|
|
252
|
+
/**
|
|
253
|
+
* Disables a user account. Sets `status` to `"disabled"` and revokes all sessions.
|
|
254
|
+
* Unlike `lockAccount`, disabled accounts are not automatically unlockable by the
|
|
255
|
+
* lockout timer — an explicit call to `unlockAccount` is required.
|
|
256
|
+
*/
|
|
257
|
+
declare function disableAccount(deps: AccountAdminDeps, userId: string): Promise<void>;
|
|
258
|
+
//#endregion
|
|
259
|
+
export { AccessTokenClaims, AccountAdminDeps, AccountAdminError, AccountUnavailableError, AuditLogger, AuthResult, AuthSession, AuthTokens, AuthenticatedIdentity, AuthorizationContext, AuthorizationDecision, AuthorizationRequirement, BuildAuthUrlParams, CreateAuthSessionInput, CreateIdentityUserInput, CreateVerificationTokenInput, CredentialRecord, DirectPermissionGrant, EmailAlreadyRegisteredError, EmailVerificationDeps, EmailVerificationError, EmailVerificationParams, ExchangeCodeParams, ForbiddenError, type GoogleOAuthConfig, IdentityConfig, IdentityConfigError, IdentityConfigInput, IdentityError, IdentityEvent, IdentityEventType, IdentityLogger, IdentityOverrides, IdentityService, IdentityServiceConfig, IdentityStore, IdentityUser, IdentityUserStatus, InvalidCredentialsError, InvalidTokenError, LockoutConfig, LoginDeps, LoginInput, LoginResult, MfaRequiredResult, type MicrosoftOAuthConfig, NotificationService, OAuthAuthorizationUrl, OAuthCallbackParams, OAuthLinkedAccount, OAuthProvider, OAuthProviderNotFoundError, OAuthService, OAuthServiceDeps, OAuthStateMismatchError, OAuthTokens, OAuthUserInfo, PasswordHasher, PasswordResetDeps, PasswordResetError, PasswordResetParams, Permission, PolicyRule, RefreshDeps, RegisterDeps, RegisterInput, RegistrationValidationError, Role, RolePermissionGrant, TokenService, TotpSecret, TotpSetupResult, TwoFactorDeps, TwoFactorError, TwoFactorRequiredError, TwoFactorSmsParams, UnauthenticatedError, UserRoleAssignment, VerificationToken, VerificationTokenType, base32Decode, base32Encode, buildOtpAuthUri, checkLockout, clearLockout, consoleLogger, createAuditLogger, createGoogleOAuthProvider, createIdentityService, createMicrosoftOAuthProvider, createOAuthService, createPasswordHasher, createTokenService, disable2FA, disableAccount, enable2FA, evaluateAuthorization, generateTotp, generateTotpSecret, generateVerificationToken, hashVerificationToken, identitySchemaModel, isAuthorized, issueMfaChallengeToken, lockAccount, loginUser, noopLogger, normalizeEmail, recordFailedAttempt, refreshSession, registerUser, requestEmailVerification, requestPasswordReset, resetPassword, resolveIdentityConfig, resolveLogger, revokeSession, setup2FA, unlockAccount, verifyEmail, verifyMfaChallenge, verifyTotp };
|
|
260
|
+
//# sourceMappingURL=node.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.mts","names":[],"sources":["../core/lockout.ts","../core/refresh-service.ts","../core/oauth/providers/google.ts","../core/oauth/providers/microsoft.ts","../core/email-verification.ts","../core/password-reset.ts","../core/totp.ts","../core/two-factor.ts","../core/account-admin.ts"],"mappings":";;;;;;;;;AAYA;;;;iBAAgB,YAAA,CACd,IAAA,EAAM,YAAA,EACN,MAAA,EAAQ,aAAA,EACR,GAAA,QAAW,IAAA;;;;;iBAYS,mBAAA,CACpB,KAAA,EAAO,aAAA,EACP,IAAA,EAAM,YAAA,EACN,MAAA,EAAQ,aAAA,EACR,GAAA,QAAW,IAAA,GACV,OAAA;;;;;iBAwBmB,YAAA,CACpB,KAAA,EAAO,aAAA,EACP,IAAA,EAAM,YAAA,GACL,OAAA;;;;UClDc,WAAA;EACf,MAAA,EAAQ,cAAA;EACR,KAAA,EAAO,aAAA;EACP,YAAA,EAAc,YAAA;EACd,KAAA,EAAO,WAAA;AAAA;;;;;;;;iBAUa,cAAA,CACpB,IAAA,EAAM,WAAA,EACN,cAAA,WACC,OAAA,CAAQ,UAAA;;iBAoDW,aAAA,CACpB,IAAA,EAAM,IAAA,CAAK,WAAA,kDACX,cAAA,WACC,OAAA;;;;UCjDc,iBAAA;EFjBf;EEmBA,QAAA;EFnBe;AAYjB;;;EEYE,YAAA;EFVM;;;EEcN,MAAA;AAAA;;;;;;;;;;iBA+Bc,yBAAA,CAA0B,MAAA,EAAQ,iBAAA,GAAoB,aA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