@warlock.js/auth 5.31.0 → 5.33.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/CHANGELOG.md +12 -0
- package/esm/commands/auth-cleanup-command.d.mts +1 -2
- package/esm/commands/auth-cleanup-command.d.mts.map +1 -1
- package/esm/commands/auth-purge-never-expiring-command.d.mts +1 -2
- package/esm/commands/auth-purge-never-expiring-command.d.mts.map +1 -1
- package/esm/commands/jwt-secret-generator-command.d.mts +1 -2
- package/esm/commands/jwt-secret-generator-command.d.mts.map +1 -1
- package/esm/contracts/auth-contract.d.mts +1 -3
- package/esm/contracts/auth-contract.d.mts.map +1 -1
- package/esm/contracts/index.d.mts +2 -1
- package/esm/contracts/providers.d.mts +82 -50
- package/esm/contracts/providers.d.mts.map +1 -1
- package/esm/contracts/request-locals.d.mts +2 -3
- package/esm/contracts/request-locals.d.mts.map +1 -1
- package/esm/contracts/types.d.mts +59 -43
- package/esm/contracts/types.d.mts.map +1 -1
- package/esm/errors/auth-provider-sdk-missing.error.d.mts +1 -3
- package/esm/errors/auth-provider-sdk-missing.error.d.mts.map +1 -1
- package/esm/errors/email-not-verified.error.d.mts +1 -3
- package/esm/errors/email-not-verified.error.d.mts.map +1 -1
- package/esm/errors/index.d.mts +2 -1
- package/esm/errors/index.mjs +1 -1
- package/esm/errors/invalid-one-time-token.error.d.mts +1 -3
- package/esm/errors/invalid-one-time-token.error.d.mts.map +1 -1
- package/esm/errors/invalid-passkey.error.d.mts +1 -3
- package/esm/errors/invalid-passkey.error.d.mts.map +1 -1
- package/esm/errors/invalid-provider-callback.error.d.mts +1 -3
- package/esm/errors/invalid-provider-callback.error.d.mts.map +1 -1
- package/esm/errors/notifications-unavailable.error.d.mts +1 -3
- package/esm/errors/notifications-unavailable.error.d.mts.map +1 -1
- package/esm/errors/provider-email-not-verified.error.d.mts +1 -3
- package/esm/errors/provider-email-not-verified.error.d.mts.map +1 -1
- package/esm/index.d.mts +8 -0
- package/esm/localization/auth-default-translations.d.mts +1 -3
- package/esm/localization/auth-default-translations.d.mts.map +1 -1
- package/esm/localization/auth-translations.type.d.mts +11 -7
- package/esm/localization/auth-translations.type.d.mts.map +1 -1
- package/esm/localization/index.mjs +1 -1
- package/esm/localization/register-auth-translations.d.mts +1 -2
- package/esm/localization/register-auth-translations.d.mts.map +1 -1
- package/esm/middleware/auth.middleware.d.mts +10 -10
- package/esm/middleware/auth.middleware.d.mts.map +1 -1
- package/esm/middleware/csrf-origin-check.d.mts +4 -6
- package/esm/middleware/csrf-origin-check.d.mts.map +1 -1
- package/esm/middleware/csrf-origin-check.mjs +1 -1
- package/esm/middleware/csrf-origin-check.mjs.map +1 -1
- package/esm/middleware/index.d.mts +2 -1
- package/esm/middleware/index.mjs +1 -1
- package/esm/middleware/login-throttle.middleware.d.mts +4 -6
- package/esm/middleware/login-throttle.middleware.d.mts.map +1 -1
- package/esm/middleware/one-time-token-throttle.middleware.d.mts +2 -4
- package/esm/middleware/one-time-token-throttle.middleware.d.mts.map +1 -1
- package/esm/middleware/otp-throttle.middleware.d.mts +2 -4
- package/esm/middleware/otp-throttle.middleware.d.mts.map +1 -1
- package/esm/middleware/require-verified-email.middleware.d.mts +1 -3
- package/esm/middleware/require-verified-email.middleware.d.mts.map +1 -1
- package/esm/models/access-token/access-token.model.d.mts +6 -6
- package/esm/models/access-token/access-token.model.d.mts.map +1 -1
- package/esm/models/access-token/index.d.mts +2 -1
- package/esm/models/access-token/index.mjs +1 -1
- package/esm/models/auth-token-family/auth-token-family.model.d.mts +2 -4
- package/esm/models/auth-token-family/auth-token-family.model.d.mts.map +1 -1
- package/esm/models/auth-token-family/index.d.mts +2 -1
- package/esm/models/auth-token-family/index.mjs +1 -1
- package/esm/models/auth.model.d.mts +1 -3
- package/esm/models/auth.model.d.mts.map +1 -1
- package/esm/models/index.d.mts +8 -2
- package/esm/models/index.d.mts.map +1 -1
- package/esm/models/index.mjs +1 -1
- package/esm/models/one-time-token/index.d.mts +2 -1
- package/esm/models/one-time-token/index.mjs +1 -1
- package/esm/models/one-time-token/one-time-token.model.d.mts +3 -5
- package/esm/models/one-time-token/one-time-token.model.d.mts.map +1 -1
- package/esm/models/passkey-credential/index.d.mts +2 -1
- package/esm/models/passkey-credential/index.mjs +1 -1
- package/esm/models/passkey-credential/passkey-credential.model.d.mts +2 -4
- package/esm/models/passkey-credential/passkey-credential.model.d.mts.map +1 -1
- package/esm/models/provider-account/index.d.mts +2 -1
- package/esm/models/provider-account/index.mjs +1 -1
- package/esm/models/provider-account/provider-account.model.d.mts +2 -4
- package/esm/models/provider-account/provider-account.model.d.mts.map +1 -1
- package/esm/models/refresh-token/index.d.mts +2 -1
- package/esm/models/refresh-token/index.mjs +1 -1
- package/esm/models/refresh-token/refresh-token.model.d.mts +7 -7
- package/esm/models/refresh-token/refresh-token.model.d.mts.map +1 -1
- package/esm/otp/index.d.mts +2 -1
- package/esm/otp/index.mjs +1 -1
- package/esm/otp/otp.d.mts +2 -4
- package/esm/otp/otp.d.mts.map +1 -1
- package/esm/otp/otp.mjs +2 -1
- package/esm/otp/otp.mjs.map +1 -1
- package/esm/passkeys/index.d.mts +2 -1
- package/esm/passkeys/index.mjs +1 -1
- package/esm/passkeys/passkey-authentication.d.mts +2 -4
- package/esm/passkeys/passkey-authentication.d.mts.map +1 -1
- package/esm/passkeys/passkey-authentication.mjs +2 -1
- package/esm/passkeys/passkey-authentication.mjs.map +1 -1
- package/esm/passkeys/passkey-registration.d.mts +3 -4
- package/esm/passkeys/passkey-registration.d.mts.map +1 -1
- package/esm/passkeys/simplewebauthn.d.mts +2 -3
- package/esm/passkeys/simplewebauthn.d.mts.map +1 -1
- package/esm/passkeys/simplewebauthn.mjs +1 -1
- package/esm/providers/apple-provider.d.mts +5 -9
- package/esm/providers/apple-provider.d.mts.map +1 -1
- package/esm/providers/discord-provider.d.mts +2 -7
- package/esm/providers/discord-provider.d.mts.map +1 -1
- package/esm/providers/facebook-provider.d.mts +2 -7
- package/esm/providers/facebook-provider.d.mts.map +1 -1
- package/esm/providers/github-provider.d.mts +2 -7
- package/esm/providers/github-provider.d.mts.map +1 -1
- package/esm/providers/google-provider.d.mts +5 -10
- package/esm/providers/google-provider.d.mts.map +1 -1
- package/esm/providers/index.d.mts +2 -1
- package/esm/providers/index.mjs +1 -1
- package/esm/providers/linkedin-provider.d.mts +3 -8
- package/esm/providers/linkedin-provider.d.mts.map +1 -1
- package/esm/providers/provider-login.d.mts +3 -5
- package/esm/providers/provider-login.d.mts.map +1 -1
- package/esm/providers/provider-login.mjs +3 -2
- package/esm/providers/provider-login.mjs.map +1 -1
- package/esm/providers/provider-state-cookie.mjs +3 -2
- package/esm/providers/provider-state-cookie.mjs.map +1 -1
- package/esm/providers/x-provider.d.mts +2 -7
- package/esm/providers/x-provider.d.mts.map +1 -1
- package/esm/services/auth-events.d.mts +5 -6
- package/esm/services/auth-events.d.mts.map +1 -1
- package/esm/services/auth.service.d.mts +10 -9
- package/esm/services/auth.service.d.mts.map +1 -1
- package/esm/services/current-user.d.mts +1 -3
- package/esm/services/current-user.d.mts.map +1 -1
- package/esm/services/email-verification.d.mts +3 -5
- package/esm/services/email-verification.d.mts.map +1 -1
- package/esm/services/generate-jwt-secret.d.mts +1 -2
- package/esm/services/generate-jwt-secret.d.mts.map +1 -1
- package/esm/services/index.d.mts +2 -1
- package/esm/services/index.mjs +1 -1
- package/esm/services/jwt.d.mts +8 -29
- package/esm/services/jwt.d.mts.map +1 -1
- package/esm/services/jwt.mjs +2 -2
- package/esm/services/jwt.mjs.map +1 -1
- package/esm/services/one-time-tokens.d.mts +6 -6
- package/esm/services/one-time-tokens.d.mts.map +1 -1
- package/esm/services/password-reset.d.mts +2 -4
- package/esm/services/password-reset.d.mts.map +1 -1
- package/esm/services/resolve-request-user.d.mts +19 -14
- package/esm/services/resolve-request-user.d.mts.map +1 -1
- package/esm/services/token-family-operation.mjs +1 -1
- package/esm/session/index.d.mts +2 -1
- package/esm/session/index.mjs +1 -1
- package/esm/session/page-session.d.mts +26 -18
- package/esm/session/page-session.d.mts.map +1 -1
- package/esm/utils/auth-error-codes.d.mts +11 -22
- package/esm/utils/auth-error-codes.d.mts.map +1 -1
- package/esm/utils/index.mjs +1 -1
- package/esm/utils/safe-equal.d.mts +1 -2
- package/esm/utils/safe-equal.d.mts.map +1 -1
- package/esm/utils/token-expiry.d.mts +3 -4
- package/esm/utils/token-expiry.d.mts.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ All notable changes to `@warlock.js/auth` are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). `@warlock.js/*` packages are released in lockstep — every package shares the same version number, so a version below may list only the changes that affected this package.
|
|
6
6
|
|
|
7
|
+
## 5.33.0 - 2026-10-19
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Lockstep release; package APIs are unchanged.
|
|
12
|
+
|
|
13
|
+
## 5.32.0 - 2026-10-18
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- Pin the package development compiler to TypeScript 7.0.2 and use explicit Node types and source roots with supported module resolution.
|
|
18
|
+
|
|
7
19
|
## 5.31.0 - 2026-10-18
|
|
8
20
|
|
|
9
21
|
### Added
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* warlock auth:cleanup
|
|
8
8
|
* ```
|
|
9
9
|
*/
|
|
10
|
-
declare function registerAuthCleanupCommand(): import("@warlock.js/core").CLICommand;
|
|
10
|
+
export declare function registerAuthCleanupCommand(): import("@warlock.js/core").CLICommand;
|
|
11
11
|
//#endregion
|
|
12
|
-
export { registerAuthCleanupCommand };
|
|
13
12
|
//# sourceMappingURL=auth-cleanup-command.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-cleanup-command.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/commands/auth-cleanup-command.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth-cleanup-command.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/commands/auth-cleanup-command.ts"],"mappings":";;;;;;;;;wBAYgB,yDAA0B"}
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
* warlock auth.purge-never-expiring # report, then delete
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
declare function registerAuthPurgeNeverExpiringCommand(): import("@warlock.js/core").CLICommand;
|
|
26
|
+
export declare function registerAuthPurgeNeverExpiringCommand(): import("@warlock.js/core").CLICommand;
|
|
27
27
|
//#endregion
|
|
28
|
-
export { registerAuthPurgeNeverExpiringCommand };
|
|
29
28
|
//# sourceMappingURL=auth-purge-never-expiring-command.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-purge-never-expiring-command.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/commands/auth-purge-never-expiring-command.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth-purge-never-expiring-command.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/commands/auth-purge-never-expiring-command.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;wBA4BgB,oEAAqC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//#region ../../packages/auth/src/commands/jwt-secret-generator-command.d.ts
|
|
2
|
-
declare function registerJWTSecretGeneratorCommand(): import("@warlock.js/core").CLICommand;
|
|
2
|
+
export declare function registerJWTSecretGeneratorCommand(): import("@warlock.js/core").CLICommand;
|
|
3
3
|
//#endregion
|
|
4
|
-
export { registerJWTSecretGeneratorCommand };
|
|
5
4
|
//# sourceMappingURL=jwt-secret-generator-command.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwt-secret-generator-command.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/commands/jwt-secret-generator-command.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"jwt-secret-generator-command.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/commands/jwt-secret-generator-command.ts"],"mappings":";wBAGgB,gEAAiC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AccessTokenOutput, DeviceInfo, TokenPair } from "./types.mjs";
|
|
2
2
|
import { RefreshToken } from "../models/refresh-token/refresh-token.model.mjs";
|
|
3
|
-
|
|
4
3
|
//#region ../../packages/auth/src/contracts/auth-contract.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Surface every authenticable user model exposes once it extends the
|
|
@@ -10,7 +9,7 @@ import { RefreshToken } from "../models/refresh-token/refresh-token.model.mjs";
|
|
|
10
9
|
* Kept in sync with `Auth` — if a method here drifts from the class, the
|
|
11
10
|
* `implements Authenticable` clause on `Auth` fails to compile.
|
|
12
11
|
*/
|
|
13
|
-
interface Authenticable {
|
|
12
|
+
export interface Authenticable {
|
|
14
13
|
/**
|
|
15
14
|
* Discriminator identifying which user type this model represents.
|
|
16
15
|
* Drives token payloads and `authMiddleware` type checks.
|
|
@@ -36,5 +35,4 @@ interface Authenticable {
|
|
|
36
35
|
confirmPassword(password: string): Promise<boolean>;
|
|
37
36
|
}
|
|
38
37
|
//#endregion
|
|
39
|
-
export { Authenticable };
|
|
40
38
|
//# sourceMappingURL=auth-contract.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-contract.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/contracts/auth-contract.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth-contract.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/contracts/auth-contract.ts"],"mappings":";;;;;;;;;;;iBAWiB;;;;;MAKX;;;;;EAMJ,oBAAoB,UAAU,0BAA0B,QAAQ;;;;;EAMhE,qBAAqB,aAAa,aAAa,QAAQ;;;;EAKvD,gBAAgB,aAAa,aAAa,QAAQ;;;;EAKlD,gBAAgB,mBAAmB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AppleProviderConfig, AuthProvider, DiscordProviderConfig, FacebookProviderConfig, GitHubProviderConfig, GoogleProviderConfig, LinkedInProviderConfig, OtpConfig, OtpMessage, OtpSender, PasskeysConfig, ProviderAuthorizationState, ProviderCallbackParams, ProviderProfile, ProviderUserCreator, ProvidersConfig, XProviderConfig } from "./providers.mjs";
|
|
2
2
|
import { AccessTokenConfig, AccessTokenOutput, AuthConfigurations, AuthCredentialDescriptor, AuthCredentials, AuthMiddlewareOptions, AuthNotification, AuthRefreshCredentialDescriptor, CanAuthenticate, ClearAuthCookieOptions, CookieAuthConfig, CookieDomainResolver, CsrfConfig, DeviceInfo, EmailVerificationConfig, LegacyJwtConfig, LoginResult, LogoutWithoutTokenBehavior, NO_EXPIRATION, OneTimeTokenConfig, OneTimeTokenNotificationData, OneTimeTokenUrlBuilder, PageAuthConfig, PasswordResetConfig, PasswordSetter, RefreshTokenConfig, SetAuthCookieOptions, TokenFrom, TokenPair } from "./types.mjs";
|
|
3
3
|
import { Authenticable } from "./auth-contract.mjs";
|
|
4
|
-
import { RequestUser } from "./request-locals.mjs";
|
|
4
|
+
import { RequestUser } from "./request-locals.mjs";
|
|
5
|
+
export { AccessTokenConfig, AccessTokenOutput, AppleProviderConfig, AuthConfigurations, AuthCredentialDescriptor, AuthCredentials, AuthMiddlewareOptions, AuthNotification, AuthProvider, AuthRefreshCredentialDescriptor, Authenticable, CanAuthenticate, ClearAuthCookieOptions, CookieAuthConfig, CookieDomainResolver, CsrfConfig, DeviceInfo, DiscordProviderConfig, EmailVerificationConfig, FacebookProviderConfig, GitHubProviderConfig, GoogleProviderConfig, LegacyJwtConfig, LinkedInProviderConfig, LoginResult, LogoutWithoutTokenBehavior, NO_EXPIRATION, OneTimeTokenConfig, OneTimeTokenNotificationData, OneTimeTokenUrlBuilder, OtpConfig, OtpMessage, OtpSender, PageAuthConfig, PasskeysConfig, PasswordResetConfig, PasswordSetter, ProviderAuthorizationState, ProviderCallbackParams, ProviderProfile, ProviderUserCreator, ProvidersConfig, RefreshTokenConfig, RequestUser, SetAuthCookieOptions, TokenFrom, TokenPair, XProviderConfig };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Auth } from "../models/auth.model.mjs";
|
|
2
2
|
import { ChildModel } from "@warlock.js/cascade";
|
|
3
|
-
|
|
4
3
|
//#region ../../packages/auth/src/contracts/providers.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* The per-login secrets a redirect provider round-trips: `state` (CSRF),
|
|
7
6
|
* `nonce` (id_token replay binding) and the PKCE `codeVerifier`.
|
|
8
7
|
*/
|
|
9
|
-
type ProviderAuthorizationState = {
|
|
8
|
+
export type ProviderAuthorizationState = {
|
|
10
9
|
state: string;
|
|
11
10
|
nonce: string;
|
|
12
11
|
codeVerifier: string;
|
|
@@ -16,18 +15,22 @@ type ProviderAuthorizationState = {
|
|
|
16
15
|
* callback query and the state that was stored when the login started. The
|
|
17
16
|
* caller has already checked `query.state` against `expected.state`.
|
|
18
17
|
*/
|
|
19
|
-
type ProviderCallbackParams = {
|
|
18
|
+
export type ProviderCallbackParams = {
|
|
20
19
|
query: Record<string, unknown>;
|
|
21
20
|
expected: ProviderAuthorizationState;
|
|
22
21
|
};
|
|
23
22
|
/** The identity a provider asserts, normalized across providers. */
|
|
24
|
-
type ProviderProfile = {
|
|
25
|
-
/** Provider name, e.g. `"google"`. */
|
|
23
|
+
export type ProviderProfile = {
|
|
24
|
+
/** Provider name, e.g. `"google"`. */
|
|
25
|
+
provider: string;
|
|
26
|
+
/** The provider's stable user id (`sub`). The link key — never the email. */
|
|
26
27
|
providerUserId: string;
|
|
27
|
-
email?: string;
|
|
28
|
+
email?: string;
|
|
29
|
+
/** Whether the PROVIDER verified `email`. Accounts are never linked on `false`. */
|
|
28
30
|
emailVerified: boolean;
|
|
29
31
|
name?: string;
|
|
30
|
-
avatar?: string;
|
|
32
|
+
avatar?: string;
|
|
33
|
+
/** The verified claims the profile was built from. */
|
|
31
34
|
raw: Record<string, unknown>;
|
|
32
35
|
};
|
|
33
36
|
/**
|
|
@@ -35,7 +38,7 @@ type ProviderProfile = {
|
|
|
35
38
|
* Register an instance under `auth.providers.custom.<name>` to add one auth does
|
|
36
39
|
* not ship.
|
|
37
40
|
*/
|
|
38
|
-
interface AuthProvider {
|
|
41
|
+
export interface AuthProvider {
|
|
39
42
|
readonly name: string;
|
|
40
43
|
/**
|
|
41
44
|
* How the provider's callback arrives. `"query"` (default) is a top-level
|
|
@@ -51,60 +54,78 @@ interface AuthProvider {
|
|
|
51
54
|
handleCallback(params: ProviderCallbackParams): Promise<ProviderProfile>;
|
|
52
55
|
}
|
|
53
56
|
/** `auth.providers.google`. */
|
|
54
|
-
type GoogleProviderConfig = {
|
|
57
|
+
export type GoogleProviderConfig = {
|
|
55
58
|
clientId: string;
|
|
56
|
-
clientSecret: string;
|
|
57
|
-
|
|
59
|
+
clientSecret: string;
|
|
60
|
+
/** Must exactly match a redirect URI registered in the Google console. */
|
|
61
|
+
redirectUri: string;
|
|
62
|
+
/** @default ["openid", "email", "profile"] */
|
|
58
63
|
scopes?: string[];
|
|
59
64
|
};
|
|
60
65
|
/** `auth.providers.github`. */
|
|
61
|
-
type GitHubProviderConfig = {
|
|
66
|
+
export type GitHubProviderConfig = {
|
|
62
67
|
clientId: string;
|
|
63
|
-
clientSecret: string;
|
|
64
|
-
|
|
68
|
+
clientSecret: string;
|
|
69
|
+
/** Must exactly match the "Authorization callback URL" registered on the GitHub OAuth App. */
|
|
70
|
+
redirectUri: string;
|
|
71
|
+
/** @default ["read:user", "user:email"] */
|
|
65
72
|
scopes?: string[];
|
|
66
73
|
};
|
|
67
74
|
/** `auth.providers.discord`. */
|
|
68
|
-
type DiscordProviderConfig = {
|
|
75
|
+
export type DiscordProviderConfig = {
|
|
69
76
|
clientId: string;
|
|
70
|
-
clientSecret: string;
|
|
71
|
-
|
|
77
|
+
clientSecret: string;
|
|
78
|
+
/** Must exactly match a redirect registered on the Discord application. */
|
|
79
|
+
redirectUri: string;
|
|
80
|
+
/** @default ["identify", "email"] */
|
|
72
81
|
scopes?: string[];
|
|
73
82
|
};
|
|
74
83
|
/** `auth.providers.linkedin`. */
|
|
75
|
-
type LinkedInProviderConfig = {
|
|
84
|
+
export type LinkedInProviderConfig = {
|
|
76
85
|
clientId: string;
|
|
77
|
-
clientSecret: string;
|
|
78
|
-
|
|
86
|
+
clientSecret: string;
|
|
87
|
+
/** Must exactly match a redirect URL registered on the LinkedIn app. */
|
|
88
|
+
redirectUri: string;
|
|
89
|
+
/** @default ["openid", "profile", "email"] */
|
|
79
90
|
scopes?: string[];
|
|
80
91
|
};
|
|
81
92
|
/** `auth.providers.apple`. */
|
|
82
|
-
type AppleProviderConfig = {
|
|
83
|
-
/** The Services ID (or app id) registered with Sign in with Apple. */
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
93
|
+
export type AppleProviderConfig = {
|
|
94
|
+
/** The Services ID (or app id) registered with Sign in with Apple. */
|
|
95
|
+
clientId: string;
|
|
96
|
+
/** The Apple Developer team id — signed into the client-secret JWT as `iss`. */
|
|
97
|
+
teamId: string;
|
|
98
|
+
/** The id of the private key created for Sign in with Apple — signed into the client-secret JWT header as `kid`. */
|
|
99
|
+
keyId: string;
|
|
100
|
+
/** The PKCS8 PEM contents of that private key (`.p8` file), used to sign the client-secret JWT. */
|
|
101
|
+
privateKey: string;
|
|
102
|
+
/** Must exactly match a return URL registered on the Services ID. */
|
|
103
|
+
redirectUri: string;
|
|
104
|
+
/** @default ["name", "email"] */
|
|
88
105
|
scopes?: string[];
|
|
89
106
|
};
|
|
90
107
|
/** `auth.providers.facebook`. */
|
|
91
|
-
type FacebookProviderConfig = {
|
|
108
|
+
export type FacebookProviderConfig = {
|
|
92
109
|
clientId: string;
|
|
93
|
-
clientSecret: string;
|
|
94
|
-
|
|
110
|
+
clientSecret: string;
|
|
111
|
+
/** Must exactly match a valid OAuth redirect URI registered on the Facebook app. */
|
|
112
|
+
redirectUri: string;
|
|
113
|
+
/** @default ["email", "public_profile"] */
|
|
95
114
|
scopes?: string[];
|
|
96
115
|
};
|
|
97
116
|
/** `auth.providers.x`. */
|
|
98
|
-
type XProviderConfig = {
|
|
117
|
+
export type XProviderConfig = {
|
|
99
118
|
clientId: string;
|
|
100
|
-
clientSecret: string;
|
|
101
|
-
|
|
119
|
+
clientSecret: string;
|
|
120
|
+
/** Must exactly match a callback URI registered on the X app (confidential client). */
|
|
121
|
+
redirectUri: string;
|
|
122
|
+
/** @default ["tweet.read", "users.read"] */
|
|
102
123
|
scopes?: string[];
|
|
103
124
|
};
|
|
104
125
|
/** Creates the app user for a verified provider profile with no matching account. */
|
|
105
|
-
type ProviderUserCreator = (profile: ProviderProfile, Model: ChildModel<Auth>) => Auth | Promise<Auth>;
|
|
126
|
+
export type ProviderUserCreator = (profile: ProviderProfile, Model: ChildModel<Auth>) => Auth | Promise<Auth>;
|
|
106
127
|
/** `auth.providers`. */
|
|
107
|
-
type ProvidersConfig = {
|
|
128
|
+
export type ProvidersConfig = {
|
|
108
129
|
google?: GoogleProviderConfig;
|
|
109
130
|
github?: GitHubProviderConfig;
|
|
110
131
|
discord?: DiscordProviderConfig;
|
|
@@ -116,44 +137,55 @@ type ProvidersConfig = {
|
|
|
116
137
|
* User attribute a verified provider email is matched against.
|
|
117
138
|
* @default "email"
|
|
118
139
|
*/
|
|
119
|
-
emailField?: string;
|
|
120
|
-
|
|
140
|
+
emailField?: string;
|
|
141
|
+
/** Replace the default user creation (`{ email, name, <verification.field>: now }`). */
|
|
142
|
+
createUser?: ProviderUserCreator;
|
|
143
|
+
/** Providers auth does not ship, by name. */
|
|
121
144
|
custom?: Record<string, AuthProvider>;
|
|
122
145
|
};
|
|
123
146
|
/** `auth.passkeys`. */
|
|
124
|
-
type PasskeysConfig = {
|
|
125
|
-
/** Relying-party id — the site's registrable domain, e.g. `"example.com"`. */
|
|
126
|
-
|
|
147
|
+
export type PasskeysConfig = {
|
|
148
|
+
/** Relying-party id — the site's registrable domain, e.g. `"example.com"`. */
|
|
149
|
+
rpID: string;
|
|
150
|
+
/** Name shown by the authenticator. */
|
|
151
|
+
rpName: string;
|
|
152
|
+
/** Exact origin(s) the browser ceremony runs on, e.g. `"https://example.com"`. */
|
|
127
153
|
origin: string | string[];
|
|
128
154
|
/**
|
|
129
155
|
* Challenge lifetime — a positive `ms` duration string.
|
|
130
156
|
* @default "5m"
|
|
131
157
|
*/
|
|
132
|
-
challengeExpiresIn?: string;
|
|
158
|
+
challengeExpiresIn?: string;
|
|
159
|
+
/** Account name shown by the authenticator. @default user email, else id */
|
|
133
160
|
userName?: (user: Auth) => string;
|
|
134
161
|
};
|
|
135
162
|
/** Data an OTP delivery receives. */
|
|
136
|
-
type OtpMessage = {
|
|
137
|
-
/** Ready-to-send text containing the code. */
|
|
163
|
+
export type OtpMessage = {
|
|
164
|
+
/** Ready-to-send text containing the code. */
|
|
165
|
+
body: string;
|
|
138
166
|
code: string;
|
|
139
167
|
expiresAt: Date;
|
|
140
168
|
};
|
|
141
169
|
/** Delivers an OTP. Replaces the default `notify.channel(channel).send(phone, message)`. */
|
|
142
|
-
type OtpSender = (phone: string, message: OtpMessage, channel: string) => unknown;
|
|
170
|
+
export type OtpSender = (phone: string, message: OtpMessage, channel: string) => unknown;
|
|
143
171
|
/** `auth.otp`. */
|
|
144
|
-
type OtpConfig = {
|
|
172
|
+
export type OtpConfig = {
|
|
145
173
|
/**
|
|
146
174
|
* Notifications channel the code is sent through. The app registers it
|
|
147
175
|
* (auth ships no SMS/WhatsApp driver).
|
|
148
176
|
* @default "sms"
|
|
149
177
|
*/
|
|
150
|
-
channel?: string;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
178
|
+
channel?: string;
|
|
179
|
+
/** User attribute holding the phone number. @default "phone" */
|
|
180
|
+
phoneField?: string;
|
|
181
|
+
/** Code lifetime. @default "5m" */
|
|
182
|
+
expiresIn?: string;
|
|
183
|
+
/** Verify attempts before the code is invalidated. @default 5 */
|
|
184
|
+
maxAttempts?: number;
|
|
185
|
+
/** Build the message text. @default "Your verification code is <code>" */
|
|
186
|
+
message?: (code: string) => string;
|
|
187
|
+
/** Replace delivery entirely. */
|
|
155
188
|
send?: OtpSender;
|
|
156
189
|
};
|
|
157
190
|
//#endregion
|
|
158
|
-
export { AppleProviderConfig, AuthProvider, DiscordProviderConfig, FacebookProviderConfig, GitHubProviderConfig, GoogleProviderConfig, LinkedInProviderConfig, OtpConfig, OtpMessage, OtpSender, PasskeysConfig, ProviderAuthorizationState, ProviderCallbackParams, ProviderProfile, ProviderUserCreator, ProvidersConfig, XProviderConfig };
|
|
159
191
|
//# sourceMappingURL=providers.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/contracts/providers.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"providers.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/contracts/providers.ts"],"mappings":";;;;;;;YAOY;EACV;EACA;EACA;;;;;;;YAQU;EACV,OAAO;EACP,UAAU;;;YAIA;;EAEV;;EAEA;EACA;;EAEA;EACA;EACA;;EAEA,KAAK;;;;;;;iBAQU;WACN;;;;;;;;WAQA;;EAET,iBAAiB,OAAO,sCAAsC;;EAE9D,eAAe,QAAQ,yBAAyB,QAAQ;;;YAI9C;EACV;EACA;;EAEA;;EAEA;;;YAIU;EACV;EACA;;EAEA;;EAEA;;;YAIU;EACV;EACA;;EAEA;;EAEA;;;YAIU;EACV;EACA;;EAEA;;EAEA;;;YAIU;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;YAIU;EACV;EACA;;EAEA;;EAEA;;;YAIU;EACV;EACA;;EAEA;;EAEA;;;YAIU,uBACV,SAAS,iBACT,OAAO,WAAW,UACf,OAAO,QAAQ;;YAGR;EACV,SAAS;EACT,SAAS;EACT,UAAU;EACV,WAAW;EACX,QAAQ;EACR,WAAW;EACX,IAAI;;;;;EAKJ;;EAEA,aAAa;;EAEb,SAAS,eAAe;;;YAId;;EAEV;;EAEA;;EAEA;;;;;EAKA;;EAEA,YAAY,MAAM;;;YAIR;;EAEV;EACA;EACA,WAAW;;;YAID,aAAa,eAAe,SAAS,YAAY;;YAGjD;;;;;;EAMV;;EAEA;;EAEA;;EAEA;;EAEA,WAAW;;EAEX,OAAO"}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* would fail to compile (TS2320). See `access/src/middleware/gate.middleware.ts`
|
|
25
25
|
* for the same hazard documented at its call site.
|
|
26
26
|
*/
|
|
27
|
-
interface RequestUser {}
|
|
27
|
+
export interface RequestUser {}
|
|
28
28
|
/**
|
|
29
29
|
* Augments core's `RequestLocals` (`request.locals`) with the `user` key —
|
|
30
30
|
* done in the module that OWNS the key, per `RequestLocals`' own contract
|
|
@@ -42,7 +42,6 @@ declare module "@warlock.js/core" {
|
|
|
42
42
|
*/
|
|
43
43
|
session?: Promise<any>;
|
|
44
44
|
}
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
46
|
//#endregion
|
|
47
|
-
export { RequestUser };
|
|
48
47
|
//# sourceMappingURL=request-locals.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-locals.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/contracts/request-locals.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"request-locals.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/contracts/request-locals.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;iBAyBiB;;;;;;;;;;YAWL;IACR,OAAO;;;;;IAKP,UAAU"}
|