@spfn/auth 0.2.0-beta.74 → 0.2.0-beta.80
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/README.md +267 -15
- package/dist/{authenticate-DXVtYh8X.d.ts → authenticate-ofdEmk6x.d.ts} +43 -13
- package/dist/config.d.ts +150 -0
- package/dist/config.js +71 -4
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +75 -3
- package/dist/errors.js +50 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +28 -6
- package/dist/index.js +53 -5
- package/dist/index.js.map +1 -1
- package/dist/nextjs/api.js +13 -11
- package/dist/nextjs/api.js.map +1 -1
- package/dist/nextjs/server.d.ts +2 -2
- package/dist/nextjs/server.js +3 -3
- package/dist/nextjs/server.js.map +1 -1
- package/dist/server.d.ts +1040 -42
- package/dist/server.js +1894 -397
- package/dist/server.js.map +1 -1
- package/dist/{session-s_hiXmXC.d.ts → session-CGxgH3C9.d.ts} +1 -1
- package/dist/types-1BMx0OX1.d.ts +84 -0
- package/migrations/0006_easy_hardball.sql +24 -0
- package/migrations/0007_glossy_major_mapleleaf.sql +1 -0
- package/migrations/meta/0006_snapshot.json +1921 -0
- package/migrations/meta/0007_snapshot.json +1916 -0
- package/migrations/meta/_journal.json +15 -1
- package/package.json +29 -27
- package/dist/types-BtksCI9X.d.ts +0 -45
package/dist/config.d.ts
CHANGED
|
@@ -100,6 +100,16 @@ declare const authEnvSchema: {
|
|
|
100
100
|
} & {
|
|
101
101
|
key: "SPFN_AUTH_VERIFICATION_TOKEN_SECRET";
|
|
102
102
|
};
|
|
103
|
+
SPFN_AUTH_TOKEN_ENCRYPTION_KEYS: {
|
|
104
|
+
description: string;
|
|
105
|
+
required: boolean;
|
|
106
|
+
sensitive: boolean;
|
|
107
|
+
examples: string[];
|
|
108
|
+
type: "string";
|
|
109
|
+
validator: (value: string) => string;
|
|
110
|
+
} & {
|
|
111
|
+
key: "SPFN_AUTH_TOKEN_ENCRYPTION_KEYS";
|
|
112
|
+
};
|
|
103
113
|
SPFN_AUTH_ADMIN_ACCOUNTS: {
|
|
104
114
|
description: string;
|
|
105
115
|
required: boolean;
|
|
@@ -260,6 +270,71 @@ declare const authEnvSchema: {
|
|
|
260
270
|
} & {
|
|
261
271
|
key: "SPFN_AUTH_GOOGLE_REDIRECT_URI";
|
|
262
272
|
};
|
|
273
|
+
SPFN_AUTH_KAKAO_CLIENT_ID: {
|
|
274
|
+
description: string;
|
|
275
|
+
required: boolean;
|
|
276
|
+
examples: string[];
|
|
277
|
+
type: "string";
|
|
278
|
+
validator: (value: string) => string;
|
|
279
|
+
} & {
|
|
280
|
+
key: "SPFN_AUTH_KAKAO_CLIENT_ID";
|
|
281
|
+
};
|
|
282
|
+
SPFN_AUTH_KAKAO_CLIENT_SECRET: {
|
|
283
|
+
description: string;
|
|
284
|
+
required: boolean;
|
|
285
|
+
sensitive: boolean;
|
|
286
|
+
examples: string[];
|
|
287
|
+
type: "string";
|
|
288
|
+
validator: (value: string) => string;
|
|
289
|
+
} & {
|
|
290
|
+
key: "SPFN_AUTH_KAKAO_CLIENT_SECRET";
|
|
291
|
+
};
|
|
292
|
+
SPFN_AUTH_KAKAO_SCOPES: {
|
|
293
|
+
description: string;
|
|
294
|
+
required: boolean;
|
|
295
|
+
examples: string[];
|
|
296
|
+
type: "string";
|
|
297
|
+
validator: (value: string) => string;
|
|
298
|
+
} & {
|
|
299
|
+
key: "SPFN_AUTH_KAKAO_SCOPES";
|
|
300
|
+
};
|
|
301
|
+
SPFN_AUTH_KAKAO_REDIRECT_URI: {
|
|
302
|
+
description: string;
|
|
303
|
+
required: boolean;
|
|
304
|
+
examples: string[];
|
|
305
|
+
type: "string";
|
|
306
|
+
validator: (value: string) => string;
|
|
307
|
+
} & {
|
|
308
|
+
key: "SPFN_AUTH_KAKAO_REDIRECT_URI";
|
|
309
|
+
};
|
|
310
|
+
SPFN_AUTH_NAVER_CLIENT_ID: {
|
|
311
|
+
description: string;
|
|
312
|
+
required: boolean;
|
|
313
|
+
examples: string[];
|
|
314
|
+
type: "string";
|
|
315
|
+
validator: (value: string) => string;
|
|
316
|
+
} & {
|
|
317
|
+
key: "SPFN_AUTH_NAVER_CLIENT_ID";
|
|
318
|
+
};
|
|
319
|
+
SPFN_AUTH_NAVER_CLIENT_SECRET: {
|
|
320
|
+
description: string;
|
|
321
|
+
required: boolean;
|
|
322
|
+
sensitive: boolean;
|
|
323
|
+
examples: string[];
|
|
324
|
+
type: "string";
|
|
325
|
+
validator: (value: string) => string;
|
|
326
|
+
} & {
|
|
327
|
+
key: "SPFN_AUTH_NAVER_CLIENT_SECRET";
|
|
328
|
+
};
|
|
329
|
+
SPFN_AUTH_NAVER_REDIRECT_URI: {
|
|
330
|
+
description: string;
|
|
331
|
+
required: boolean;
|
|
332
|
+
examples: string[];
|
|
333
|
+
type: "string";
|
|
334
|
+
validator: (value: string) => string;
|
|
335
|
+
} & {
|
|
336
|
+
key: "SPFN_AUTH_NAVER_REDIRECT_URI";
|
|
337
|
+
};
|
|
263
338
|
SPFN_AUTH_GOOGLE_NATIVE_CLIENT_IDS: {
|
|
264
339
|
description: string;
|
|
265
340
|
required: boolean;
|
|
@@ -374,6 +449,16 @@ declare const env: _spfn_core_env.InferEnvType<{
|
|
|
374
449
|
} & {
|
|
375
450
|
key: "SPFN_AUTH_VERIFICATION_TOKEN_SECRET";
|
|
376
451
|
};
|
|
452
|
+
SPFN_AUTH_TOKEN_ENCRYPTION_KEYS: {
|
|
453
|
+
description: string;
|
|
454
|
+
required: boolean;
|
|
455
|
+
sensitive: boolean;
|
|
456
|
+
examples: string[];
|
|
457
|
+
type: "string";
|
|
458
|
+
validator: (value: string) => string;
|
|
459
|
+
} & {
|
|
460
|
+
key: "SPFN_AUTH_TOKEN_ENCRYPTION_KEYS";
|
|
461
|
+
};
|
|
377
462
|
SPFN_AUTH_ADMIN_ACCOUNTS: {
|
|
378
463
|
description: string;
|
|
379
464
|
required: boolean;
|
|
@@ -534,6 +619,71 @@ declare const env: _spfn_core_env.InferEnvType<{
|
|
|
534
619
|
} & {
|
|
535
620
|
key: "SPFN_AUTH_GOOGLE_REDIRECT_URI";
|
|
536
621
|
};
|
|
622
|
+
SPFN_AUTH_KAKAO_CLIENT_ID: {
|
|
623
|
+
description: string;
|
|
624
|
+
required: boolean;
|
|
625
|
+
examples: string[];
|
|
626
|
+
type: "string";
|
|
627
|
+
validator: (value: string) => string;
|
|
628
|
+
} & {
|
|
629
|
+
key: "SPFN_AUTH_KAKAO_CLIENT_ID";
|
|
630
|
+
};
|
|
631
|
+
SPFN_AUTH_KAKAO_CLIENT_SECRET: {
|
|
632
|
+
description: string;
|
|
633
|
+
required: boolean;
|
|
634
|
+
sensitive: boolean;
|
|
635
|
+
examples: string[];
|
|
636
|
+
type: "string";
|
|
637
|
+
validator: (value: string) => string;
|
|
638
|
+
} & {
|
|
639
|
+
key: "SPFN_AUTH_KAKAO_CLIENT_SECRET";
|
|
640
|
+
};
|
|
641
|
+
SPFN_AUTH_KAKAO_SCOPES: {
|
|
642
|
+
description: string;
|
|
643
|
+
required: boolean;
|
|
644
|
+
examples: string[];
|
|
645
|
+
type: "string";
|
|
646
|
+
validator: (value: string) => string;
|
|
647
|
+
} & {
|
|
648
|
+
key: "SPFN_AUTH_KAKAO_SCOPES";
|
|
649
|
+
};
|
|
650
|
+
SPFN_AUTH_KAKAO_REDIRECT_URI: {
|
|
651
|
+
description: string;
|
|
652
|
+
required: boolean;
|
|
653
|
+
examples: string[];
|
|
654
|
+
type: "string";
|
|
655
|
+
validator: (value: string) => string;
|
|
656
|
+
} & {
|
|
657
|
+
key: "SPFN_AUTH_KAKAO_REDIRECT_URI";
|
|
658
|
+
};
|
|
659
|
+
SPFN_AUTH_NAVER_CLIENT_ID: {
|
|
660
|
+
description: string;
|
|
661
|
+
required: boolean;
|
|
662
|
+
examples: string[];
|
|
663
|
+
type: "string";
|
|
664
|
+
validator: (value: string) => string;
|
|
665
|
+
} & {
|
|
666
|
+
key: "SPFN_AUTH_NAVER_CLIENT_ID";
|
|
667
|
+
};
|
|
668
|
+
SPFN_AUTH_NAVER_CLIENT_SECRET: {
|
|
669
|
+
description: string;
|
|
670
|
+
required: boolean;
|
|
671
|
+
sensitive: boolean;
|
|
672
|
+
examples: string[];
|
|
673
|
+
type: "string";
|
|
674
|
+
validator: (value: string) => string;
|
|
675
|
+
} & {
|
|
676
|
+
key: "SPFN_AUTH_NAVER_CLIENT_SECRET";
|
|
677
|
+
};
|
|
678
|
+
SPFN_AUTH_NAVER_REDIRECT_URI: {
|
|
679
|
+
description: string;
|
|
680
|
+
required: boolean;
|
|
681
|
+
examples: string[];
|
|
682
|
+
type: "string";
|
|
683
|
+
validator: (value: string) => string;
|
|
684
|
+
} & {
|
|
685
|
+
key: "SPFN_AUTH_NAVER_REDIRECT_URI";
|
|
686
|
+
};
|
|
537
687
|
SPFN_AUTH_GOOGLE_NATIVE_CLIENT_IDS: {
|
|
538
688
|
description: string;
|
|
539
689
|
required: boolean;
|
package/dist/config.js
CHANGED
|
@@ -95,6 +95,16 @@ var authEnvSchema = defineEnvSchema({
|
|
|
95
95
|
]
|
|
96
96
|
})
|
|
97
97
|
},
|
|
98
|
+
SPFN_AUTH_TOKEN_ENCRYPTION_KEYS: {
|
|
99
|
+
...envString({
|
|
100
|
+
description: "Backend-only OAuth token encryption keyring. Comma-separated <keyId>:<base64-encoded 32-byte key> entries; the first key encrypts new values and remaining keys decrypt during rotation.",
|
|
101
|
+
required: false,
|
|
102
|
+
sensitive: true,
|
|
103
|
+
examples: [
|
|
104
|
+
"v2:<base64-encoded-32-byte-key>,v1:<previous-base64-encoded-32-byte-key>"
|
|
105
|
+
]
|
|
106
|
+
})
|
|
107
|
+
},
|
|
98
108
|
// ============================================================================
|
|
99
109
|
// Admin Account Configuration
|
|
100
110
|
// ============================================================================
|
|
@@ -206,7 +216,7 @@ var authEnvSchema = defineEnvSchema({
|
|
|
206
216
|
},
|
|
207
217
|
NEXT_PUBLIC_SPFN_API_URL: {
|
|
208
218
|
...envString({
|
|
209
|
-
description: "Public-facing API URL used for browser-facing redirects
|
|
219
|
+
description: "Public-facing API URL used for browser-facing redirects. Falls back to SPFN_API_URL if not set.",
|
|
210
220
|
required: false,
|
|
211
221
|
examples: [
|
|
212
222
|
"https://api.example.com",
|
|
@@ -266,15 +276,72 @@ var authEnvSchema = defineEnvSchema({
|
|
|
266
276
|
},
|
|
267
277
|
SPFN_AUTH_GOOGLE_REDIRECT_URI: {
|
|
268
278
|
...envString({
|
|
269
|
-
description: "Google OAuth callback URL. Defaults to {
|
|
279
|
+
description: "Google OAuth callback URL. Defaults to {NEXT_PUBLIC_SPFN_APP_URL || SPFN_APP_URL}/_auth/oauth/google/callback \u2014 the callback must return to the web app origin that set the oauth_csrf cookie (the app rewrites /_auth/:path* to the API). Set this explicitly only when the callback should hit a different host (e.g. the API host for the direct oauthStart flow).",
|
|
270
280
|
required: false,
|
|
271
281
|
examples: [
|
|
272
|
-
"https://
|
|
273
|
-
"http://localhost:
|
|
282
|
+
"https://app.example.com/_auth/oauth/google/callback",
|
|
283
|
+
"http://localhost:3000/_auth/oauth/google/callback"
|
|
274
284
|
]
|
|
275
285
|
})
|
|
276
286
|
},
|
|
277
287
|
// ============================================================================
|
|
288
|
+
// OAuth Configuration - Kakao
|
|
289
|
+
// ============================================================================
|
|
290
|
+
SPFN_AUTH_KAKAO_CLIENT_ID: {
|
|
291
|
+
...envString({
|
|
292
|
+
description: "Kakao Login REST API key. Used as the OAuth client_id.",
|
|
293
|
+
required: false,
|
|
294
|
+
examples: ["your-kakao-rest-api-key"]
|
|
295
|
+
})
|
|
296
|
+
},
|
|
297
|
+
SPFN_AUTH_KAKAO_CLIENT_SECRET: {
|
|
298
|
+
...envString({
|
|
299
|
+
description: "Kakao Login client secret. Required when the Kakao client-secret feature is enabled.",
|
|
300
|
+
required: false,
|
|
301
|
+
sensitive: true,
|
|
302
|
+
examples: ["your-kakao-client-secret"]
|
|
303
|
+
})
|
|
304
|
+
},
|
|
305
|
+
SPFN_AUTH_KAKAO_SCOPES: {
|
|
306
|
+
...envString({
|
|
307
|
+
description: "Comma-separated Kakao consent scopes. Defaults to account_email.",
|
|
308
|
+
required: false,
|
|
309
|
+
examples: ["account_email"]
|
|
310
|
+
})
|
|
311
|
+
},
|
|
312
|
+
SPFN_AUTH_KAKAO_REDIRECT_URI: {
|
|
313
|
+
...envString({
|
|
314
|
+
description: "Kakao OAuth callback URL. Defaults to {NEXT_PUBLIC_SPFN_APP_URL || SPFN_APP_URL}/_auth/oauth/kakao/callback.",
|
|
315
|
+
required: false,
|
|
316
|
+
examples: ["https://app.example.com/_auth/oauth/kakao/callback"]
|
|
317
|
+
})
|
|
318
|
+
},
|
|
319
|
+
// ============================================================================
|
|
320
|
+
// OAuth Configuration - Naver
|
|
321
|
+
// ============================================================================
|
|
322
|
+
SPFN_AUTH_NAVER_CLIENT_ID: {
|
|
323
|
+
...envString({
|
|
324
|
+
description: "Naver Login OAuth client ID.",
|
|
325
|
+
required: false,
|
|
326
|
+
examples: ["your-naver-client-id"]
|
|
327
|
+
})
|
|
328
|
+
},
|
|
329
|
+
SPFN_AUTH_NAVER_CLIENT_SECRET: {
|
|
330
|
+
...envString({
|
|
331
|
+
description: "Naver Login OAuth client secret.",
|
|
332
|
+
required: false,
|
|
333
|
+
sensitive: true,
|
|
334
|
+
examples: ["your-naver-client-secret"]
|
|
335
|
+
})
|
|
336
|
+
},
|
|
337
|
+
SPFN_AUTH_NAVER_REDIRECT_URI: {
|
|
338
|
+
...envString({
|
|
339
|
+
description: "Naver OAuth callback URL. Defaults to {NEXT_PUBLIC_SPFN_APP_URL || SPFN_APP_URL}/_auth/oauth/naver/callback.",
|
|
340
|
+
required: false,
|
|
341
|
+
examples: ["https://app.example.com/_auth/oauth/naver/callback"]
|
|
342
|
+
})
|
|
343
|
+
},
|
|
344
|
+
// ============================================================================
|
|
278
345
|
// Native Social Login (mobile/web id_token verification)
|
|
279
346
|
//
|
|
280
347
|
// 네이티브 SDK가 받은 id_token을 서버가 JWKS로 검증하는 경로 전용 설정.
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config/index.ts","../src/config/schema.ts"],"sourcesContent":["/**\n * Core Package Configuration\n *\n * @example\n * ```typescript\n * import { registry } from '@spfn/core/config';\n *\n * const env = registry.validate();\n * console.log(env.DB_POOL_MAX);\n * ```\n *\n * @module config\n */\n\nimport { createEnvRegistry } from '@spfn/core/env';\nimport { authEnvSchema } from './schema';\n\nexport { authEnvSchema as envSchema } from './schema';\n\n/**\n * Environment registry\n */\nconst registry = createEnvRegistry(authEnvSchema);\nexport const env = registry.validate();\n","/**\n * Auth Environment Variable Schema\n *\n * Centralized schema definition for all environment variables used in @spfn/auth.\n * This provides type safety, validation, and documentation for Auth configuration.\n *\n * @module config/schema\n */\n\nimport {\n defineEnvSchema,\n envString,\n envNumber,\n envBoolean,\n createSecureSecretParser,\n createPasswordParser,\n} from '@spfn/core/env';\n\n/**\n * Auth environment variable schema\n *\n * Defines all Auth environment variables with:\n * - Type information\n * - Default values\n * - Validation rules\n * - Documentation\n *\n * @example\n * ```typescript\n * import { envSchema } from '@spfn/auth/config';\n *\n * // Access schema information\n * console.log(envSchema.SPFN_AUTH_SESSION_SECRET.description);\n * console.log(envSchema.SPFN_AUTH_JWT_EXPIRES_IN.default);\n * ```\n */\nexport const authEnvSchema = defineEnvSchema({\n // ============================================================================\n // Session Configuration\n // ============================================================================\n SPFN_AUTH_SESSION_SECRET: {\n ...envString({\n description: 'Session encryption secret (minimum 32 characters for AES-256)',\n required: true,\n fallbackKeys: ['SESSION_SECRET'],\n validator: createSecureSecretParser({\n minLength: 32,\n minUniqueChars: 16,\n minEntropy: 3.5,\n }),\n sensitive: true,\n nextjs: true, // Required for Next.js RSC session validation\n examples: [\n 'my-super-secret-session-key-at-least-32-chars-long',\n 'use-a-cryptographically-secure-random-string-here',\n ],\n }),\n },\n\n SPFN_AUTH_SESSION_TTL: {\n ...envString({\n description: 'Session TTL (time to live) - supports duration strings like \\'7d\\', \\'12h\\', \\'45m\\'',\n default: '7d',\n required: false,\n nextjs: true, // May be needed for session validation in Next.js RSC\n examples: ['7d', '30d', '12h', '45m', '3600'],\n }),\n },\n\n // ============================================================================\n // JWT Configuration\n // ============================================================================\n SPFN_AUTH_JWT_SECRET: {\n ...envString({\n description: 'JWT signing secret for server-signed tokens (legacy mode)',\n default: 'dev-secret-key-change-in-production',\n required: false,\n examples: [\n 'your-jwt-secret-key-here',\n 'use-different-from-session-secret',\n ],\n }),\n },\n\n SPFN_AUTH_JWT_EXPIRES_IN: {\n ...envString({\n description: 'JWT token expiration time (e.g., \\'7d\\', \\'24h\\', \\'1h\\')',\n default: '7d',\n required: false,\n examples: ['7d', '24h', '1h', '30m'],\n }),\n },\n\n // ============================================================================\n // Security Configuration\n // ============================================================================\n SPFN_AUTH_COOKIE_SECURE: {\n ...envBoolean({\n description: 'Override cookie Secure flag. Defaults to NODE_ENV === \"production\". Set to false for HTTP-only environments (e.g. bastion over plain HTTP).',\n required: false,\n nextjs: true,\n examples: [true, false],\n }),\n },\n\n SPFN_AUTH_BCRYPT_SALT_ROUNDS: {\n ...envNumber({\n description: 'Bcrypt salt rounds (cost factor, higher = more secure but slower)',\n default: 12,\n required: false,\n examples: [10, 12, 14],\n }),\n key: 'SPFN_AUTH_BCRYPT_SALT_ROUNDS',\n },\n\n SPFN_AUTH_VERIFICATION_TOKEN_SECRET: {\n ...envString({\n description: 'Verification token secret for email verification, password reset, etc.',\n required: true,\n examples: [\n 'your-verification-token-secret',\n 'can-be-different-from-jwt-secret',\n ],\n }),\n },\n\n // ============================================================================\n // Admin Account Configuration\n // ============================================================================\n SPFN_AUTH_ADMIN_ACCOUNTS: {\n ...envString({\n description: 'JSON array of admin accounts (recommended for multiple admins)',\n required: false,\n examples: [\n '[{\"email\":\"admin@example.com\",\"password\":\"secure-pass\",\"role\":\"admin\"}]',\n '[{\"email\":\"super@example.com\",\"password\":\"pass1\",\"role\":\"superadmin\"},{\"email\":\"admin@example.com\",\"password\":\"pass2\",\"role\":\"admin\"}]',\n ],\n }),\n },\n\n SPFN_AUTH_ADMIN_EMAILS: {\n ...envString({\n description: 'Comma-separated list of admin emails (legacy CSV format)',\n required: false,\n examples: [\n 'admin@example.com,user@example.com',\n 'super@example.com,admin@example.com,user@example.com',\n ],\n }),\n },\n\n SPFN_AUTH_ADMIN_PASSWORDS: {\n ...envString({\n description: 'Comma-separated list of admin passwords (legacy CSV format)',\n required: false,\n examples: [\n 'admin-pass,user-pass',\n 'super-pass,admin-pass,user-pass',\n ],\n }),\n },\n\n SPFN_AUTH_ADMIN_ROLES: {\n ...envString({\n description: 'Comma-separated list of admin roles (legacy CSV format)',\n required: false,\n examples: [\n 'admin,user',\n 'superadmin,admin,user',\n ],\n }),\n },\n\n SPFN_AUTH_ADMIN_EMAIL: {\n ...envString({\n description: 'Single admin email (simplest format)',\n required: false,\n examples: ['admin@example.com'],\n }),\n },\n\n SPFN_AUTH_ADMIN_PASSWORD: {\n ...envString({\n description: 'Single admin password (simplest format)',\n required: false,\n validator: createPasswordParser({\n minLength: 8,\n requireUppercase: true,\n requireLowercase: true,\n requireNumber: true,\n requireSpecial: true,\n }),\n sensitive: true,\n examples: ['SecureAdmin123!'],\n }),\n },\n\n // ============================================================================\n // Username Configuration\n // ============================================================================\n SPFN_AUTH_RESERVED_USERNAMES: {\n ...envString({\n description: 'Comma-separated list of reserved usernames that cannot be registered',\n required: false,\n default: 'admin,root,system,support,help,moderator,superadmin',\n examples: [\n 'admin,root,system,support,help',\n 'admin,root,system,support,help,moderator,superadmin,operator',\n ],\n }),\n },\n\n SPFN_AUTH_USERNAME_MIN_LENGTH: {\n ...envNumber({\n description: 'Minimum username length',\n default: 3,\n required: false,\n examples: [2, 3, 4],\n }),\n },\n\n SPFN_AUTH_USERNAME_MAX_LENGTH: {\n ...envNumber({\n description: 'Maximum username length',\n default: 30,\n required: false,\n examples: [20, 30, 50],\n }),\n },\n\n // ============================================================================\n // API Configuration\n // ============================================================================\n SPFN_API_URL: {\n ...envString({\n description: 'Internal API URL for server-to-server communication',\n default: 'http://localhost:8790',\n required: false,\n examples: [\n 'https://api.example.com',\n 'http://localhost:8790',\n ],\n }),\n },\n\n NEXT_PUBLIC_SPFN_API_URL: {\n ...envString({\n description: 'Public-facing API URL used for browser-facing redirects (e.g. OAuth callback). Falls back to SPFN_API_URL if not set.',\n required: false,\n examples: [\n 'https://api.example.com',\n 'http://localhost:8790',\n ],\n }),\n },\n\n SPFN_APP_URL: {\n ...envString({\n description: 'Next.js application URL (internal). Used for server-to-server communication.',\n default: 'http://localhost:3000',\n required: false,\n examples: [\n 'https://app.example.com',\n 'http://localhost:3000',\n ],\n }),\n },\n\n NEXT_PUBLIC_SPFN_APP_URL: {\n ...envString({\n description: 'Public-facing Next.js app URL for browser redirects (e.g. OAuth redirect). Falls back to SPFN_APP_URL if not set.',\n required: false,\n examples: [\n 'https://app.example.com',\n 'http://localhost:3000',\n ],\n }),\n },\n\n // ============================================================================\n // OAuth Configuration - Google\n // ============================================================================\n SPFN_AUTH_GOOGLE_CLIENT_ID: {\n ...envString({\n description: 'Google OAuth 2.0 Client ID. When set, Google OAuth routes are automatically enabled.',\n required: false,\n examples: ['123456789-abc123.apps.googleusercontent.com'],\n }),\n },\n\n SPFN_AUTH_GOOGLE_CLIENT_SECRET: {\n ...envString({\n description: 'Google OAuth 2.0 Client Secret',\n required: false,\n sensitive: true,\n examples: ['GOCSPX-abcdefghijklmnop'],\n }),\n },\n\n SPFN_AUTH_GOOGLE_SCOPES: {\n ...envString({\n description: 'Comma-separated Google OAuth scopes. Defaults to \"email,profile\" if not set.',\n required: false,\n examples: [\n 'email,profile',\n 'email,profile,https://www.googleapis.com/auth/gmail.readonly',\n 'email,profile,https://www.googleapis.com/auth/calendar.readonly',\n ],\n }),\n },\n\n SPFN_AUTH_GOOGLE_REDIRECT_URI: {\n ...envString({\n description: 'Google OAuth callback URL. Defaults to {NEXT_PUBLIC_SPFN_API_URL || SPFN_API_URL}/_auth/oauth/google/callback',\n required: false,\n examples: [\n 'https://api.example.com/_auth/oauth/google/callback',\n 'http://localhost:8790/_auth/oauth/google/callback',\n ],\n }),\n },\n\n // ============================================================================\n // Native Social Login (mobile/web id_token verification)\n //\n // 네이티브 SDK가 받은 id_token을 서버가 JWKS로 검증하는 경로 전용 설정.\n // authorization code 교환을 하지 않으므로 client secret이 필요 없다.\n // audience(aud)로 허용할 client id 목록만 지정한다.\n // ============================================================================\n SPFN_AUTH_GOOGLE_NATIVE_CLIENT_IDS: {\n ...envString({\n description: 'Comma-separated Google client IDs accepted as id_token audience for native sign-in (iOS, Android, web). When set, Google native sign-in is enabled. SPFN_AUTH_GOOGLE_CLIENT_ID is also accepted automatically.',\n required: false,\n examples: [\n '123-ios.apps.googleusercontent.com,123-android.apps.googleusercontent.com',\n ],\n }),\n },\n\n SPFN_AUTH_APPLE_CLIENT_IDS: {\n ...envString({\n description: 'Comma-separated Apple client IDs accepted as id_token audience for native sign-in (iOS bundle ID, web/Android Services ID). When set, Apple native sign-in is enabled.',\n required: false,\n examples: [\n 'com.example.app,com.example.app.service',\n ],\n }),\n },\n\n SPFN_AUTH_OAUTH_SUCCESS_URL: {\n ...envString({\n description: 'OAuth callback page URL. This page should use OAuthCallback component to finalize session.',\n required: false,\n default: '/auth/callback',\n examples: [\n '/auth/callback',\n 'https://app.example.com/auth/callback',\n ],\n }),\n },\n\n SPFN_AUTH_OAUTH_ERROR_URL: {\n ...envString({\n description: 'URL to redirect after OAuth error. Use {error} placeholder for error message.',\n required: false,\n default: '/auth/error?error={error}',\n examples: [\n 'https://app.example.com/auth/error?error={error}',\n 'http://localhost:3000/auth/error?error={error}',\n ],\n }),\n },\n});\n"],"mappings":";AAcA,SAAS,yBAAyB;;;ACLlC;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAoBA,IAAM,gBAAgB,g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,aAAa;AAAA,MACb,UAAU;AAAA,MACV,SAAS;AAAA,MACT,UAAU;AAAA,QACN;AAAA,QACA;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL;AACJ,CAAC;;;AD9VD,IAAM,WAAW,kBAAkB,aAAa;AACzC,IAAM,MAAM,SAAS,SAAS;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/config/index.ts","../src/config/schema.ts"],"sourcesContent":["/**\n * Core Package Configuration\n *\n * @example\n * ```typescript\n * import { registry } from '@spfn/core/config';\n *\n * const env = registry.validate();\n * console.log(env.DB_POOL_MAX);\n * ```\n *\n * @module config\n */\n\nimport { createEnvRegistry } from '@spfn/core/env';\nimport { authEnvSchema } from './schema';\n\nexport { authEnvSchema as envSchema } from './schema';\n\n/**\n * Environment registry\n */\nconst registry = createEnvRegistry(authEnvSchema);\nexport const env = registry.validate();\n","/**\n * Auth Environment Variable Schema\n *\n * Centralized schema definition for all environment variables used in @spfn/auth.\n * This provides type safety, validation, and documentation for Auth configuration.\n *\n * @module config/schema\n */\n\nimport {\n defineEnvSchema,\n envString,\n envNumber,\n envBoolean,\n createSecureSecretParser,\n createPasswordParser,\n} from '@spfn/core/env';\n\n/**\n * Auth environment variable schema\n *\n * Defines all Auth environment variables with:\n * - Type information\n * - Default values\n * - Validation rules\n * - Documentation\n *\n * @example\n * ```typescript\n * import { envSchema } from '@spfn/auth/config';\n *\n * // Access schema information\n * console.log(envSchema.SPFN_AUTH_SESSION_SECRET.description);\n * console.log(envSchema.SPFN_AUTH_JWT_EXPIRES_IN.default);\n * ```\n */\nexport const authEnvSchema = defineEnvSchema({\n // ============================================================================\n // Session Configuration\n // ============================================================================\n SPFN_AUTH_SESSION_SECRET: {\n ...envString({\n description: 'Session encryption secret (minimum 32 characters for AES-256)',\n required: true,\n fallbackKeys: ['SESSION_SECRET'],\n validator: createSecureSecretParser({\n minLength: 32,\n minUniqueChars: 16,\n minEntropy: 3.5,\n }),\n sensitive: true,\n nextjs: true, // Required for Next.js RSC session validation\n examples: [\n 'my-super-secret-session-key-at-least-32-chars-long',\n 'use-a-cryptographically-secure-random-string-here',\n ],\n }),\n },\n\n SPFN_AUTH_SESSION_TTL: {\n ...envString({\n description: 'Session TTL (time to live) - supports duration strings like \\'7d\\', \\'12h\\', \\'45m\\'',\n default: '7d',\n required: false,\n nextjs: true, // May be needed for session validation in Next.js RSC\n examples: ['7d', '30d', '12h', '45m', '3600'],\n }),\n },\n\n // ============================================================================\n // JWT Configuration\n // ============================================================================\n SPFN_AUTH_JWT_SECRET: {\n ...envString({\n description: 'JWT signing secret for server-signed tokens (legacy mode)',\n default: 'dev-secret-key-change-in-production',\n required: false,\n examples: [\n 'your-jwt-secret-key-here',\n 'use-different-from-session-secret',\n ],\n }),\n },\n\n SPFN_AUTH_JWT_EXPIRES_IN: {\n ...envString({\n description: 'JWT token expiration time (e.g., \\'7d\\', \\'24h\\', \\'1h\\')',\n default: '7d',\n required: false,\n examples: ['7d', '24h', '1h', '30m'],\n }),\n },\n\n // ============================================================================\n // Security Configuration\n // ============================================================================\n SPFN_AUTH_COOKIE_SECURE: {\n ...envBoolean({\n description: 'Override cookie Secure flag. Defaults to NODE_ENV === \"production\". Set to false for HTTP-only environments (e.g. bastion over plain HTTP).',\n required: false,\n nextjs: true,\n examples: [true, false],\n }),\n },\n\n SPFN_AUTH_BCRYPT_SALT_ROUNDS: {\n ...envNumber({\n description: 'Bcrypt salt rounds (cost factor, higher = more secure but slower)',\n default: 12,\n required: false,\n examples: [10, 12, 14],\n }),\n key: 'SPFN_AUTH_BCRYPT_SALT_ROUNDS',\n },\n\n SPFN_AUTH_VERIFICATION_TOKEN_SECRET: {\n ...envString({\n description: 'Verification token secret for email verification, password reset, etc.',\n required: true,\n examples: [\n 'your-verification-token-secret',\n 'can-be-different-from-jwt-secret',\n ],\n }),\n },\n\n SPFN_AUTH_TOKEN_ENCRYPTION_KEYS: {\n ...envString({\n description: 'Backend-only OAuth token encryption keyring. Comma-separated <keyId>:<base64-encoded 32-byte key> entries; the first key encrypts new values and remaining keys decrypt during rotation.',\n required: false,\n sensitive: true,\n examples: [\n 'v2:<base64-encoded-32-byte-key>,v1:<previous-base64-encoded-32-byte-key>',\n ],\n }),\n },\n\n // ============================================================================\n // Admin Account Configuration\n // ============================================================================\n SPFN_AUTH_ADMIN_ACCOUNTS: {\n ...envString({\n description: 'JSON array of admin accounts (recommended for multiple admins)',\n required: false,\n examples: [\n '[{\"email\":\"admin@example.com\",\"password\":\"secure-pass\",\"role\":\"admin\"}]',\n '[{\"email\":\"super@example.com\",\"password\":\"pass1\",\"role\":\"superadmin\"},{\"email\":\"admin@example.com\",\"password\":\"pass2\",\"role\":\"admin\"}]',\n ],\n }),\n },\n\n SPFN_AUTH_ADMIN_EMAILS: {\n ...envString({\n description: 'Comma-separated list of admin emails (legacy CSV format)',\n required: false,\n examples: [\n 'admin@example.com,user@example.com',\n 'super@example.com,admin@example.com,user@example.com',\n ],\n }),\n },\n\n SPFN_AUTH_ADMIN_PASSWORDS: {\n ...envString({\n description: 'Comma-separated list of admin passwords (legacy CSV format)',\n required: false,\n examples: [\n 'admin-pass,user-pass',\n 'super-pass,admin-pass,user-pass',\n ],\n }),\n },\n\n SPFN_AUTH_ADMIN_ROLES: {\n ...envString({\n description: 'Comma-separated list of admin roles (legacy CSV format)',\n required: false,\n examples: [\n 'admin,user',\n 'superadmin,admin,user',\n ],\n }),\n },\n\n SPFN_AUTH_ADMIN_EMAIL: {\n ...envString({\n description: 'Single admin email (simplest format)',\n required: false,\n examples: ['admin@example.com'],\n }),\n },\n\n SPFN_AUTH_ADMIN_PASSWORD: {\n ...envString({\n description: 'Single admin password (simplest format)',\n required: false,\n validator: createPasswordParser({\n minLength: 8,\n requireUppercase: true,\n requireLowercase: true,\n requireNumber: true,\n requireSpecial: true,\n }),\n sensitive: true,\n examples: ['SecureAdmin123!'],\n }),\n },\n\n // ============================================================================\n // Username Configuration\n // ============================================================================\n SPFN_AUTH_RESERVED_USERNAMES: {\n ...envString({\n description: 'Comma-separated list of reserved usernames that cannot be registered',\n required: false,\n default: 'admin,root,system,support,help,moderator,superadmin',\n examples: [\n 'admin,root,system,support,help',\n 'admin,root,system,support,help,moderator,superadmin,operator',\n ],\n }),\n },\n\n SPFN_AUTH_USERNAME_MIN_LENGTH: {\n ...envNumber({\n description: 'Minimum username length',\n default: 3,\n required: false,\n examples: [2, 3, 4],\n }),\n },\n\n SPFN_AUTH_USERNAME_MAX_LENGTH: {\n ...envNumber({\n description: 'Maximum username length',\n default: 30,\n required: false,\n examples: [20, 30, 50],\n }),\n },\n\n // ============================================================================\n // API Configuration\n // ============================================================================\n SPFN_API_URL: {\n ...envString({\n description: 'Internal API URL for server-to-server communication',\n default: 'http://localhost:8790',\n required: false,\n examples: [\n 'https://api.example.com',\n 'http://localhost:8790',\n ],\n }),\n },\n\n NEXT_PUBLIC_SPFN_API_URL: {\n ...envString({\n description: 'Public-facing API URL used for browser-facing redirects. Falls back to SPFN_API_URL if not set.',\n required: false,\n examples: [\n 'https://api.example.com',\n 'http://localhost:8790',\n ],\n }),\n },\n\n SPFN_APP_URL: {\n ...envString({\n description: 'Next.js application URL (internal). Used for server-to-server communication.',\n default: 'http://localhost:3000',\n required: false,\n examples: [\n 'https://app.example.com',\n 'http://localhost:3000',\n ],\n }),\n },\n\n NEXT_PUBLIC_SPFN_APP_URL: {\n ...envString({\n description: 'Public-facing Next.js app URL for browser redirects (e.g. OAuth redirect). Falls back to SPFN_APP_URL if not set.',\n required: false,\n examples: [\n 'https://app.example.com',\n 'http://localhost:3000',\n ],\n }),\n },\n\n // ============================================================================\n // OAuth Configuration - Google\n // ============================================================================\n SPFN_AUTH_GOOGLE_CLIENT_ID: {\n ...envString({\n description: 'Google OAuth 2.0 Client ID. When set, Google OAuth routes are automatically enabled.',\n required: false,\n examples: ['123456789-abc123.apps.googleusercontent.com'],\n }),\n },\n\n SPFN_AUTH_GOOGLE_CLIENT_SECRET: {\n ...envString({\n description: 'Google OAuth 2.0 Client Secret',\n required: false,\n sensitive: true,\n examples: ['GOCSPX-abcdefghijklmnop'],\n }),\n },\n\n SPFN_AUTH_GOOGLE_SCOPES: {\n ...envString({\n description: 'Comma-separated Google OAuth scopes. Defaults to \"email,profile\" if not set.',\n required: false,\n examples: [\n 'email,profile',\n 'email,profile,https://www.googleapis.com/auth/gmail.readonly',\n 'email,profile,https://www.googleapis.com/auth/calendar.readonly',\n ],\n }),\n },\n\n SPFN_AUTH_GOOGLE_REDIRECT_URI: {\n ...envString({\n description: 'Google OAuth callback URL. Defaults to {NEXT_PUBLIC_SPFN_APP_URL || SPFN_APP_URL}/_auth/oauth/google/callback — the callback must return to the web app origin that set the oauth_csrf cookie (the app rewrites /_auth/:path* to the API). Set this explicitly only when the callback should hit a different host (e.g. the API host for the direct oauthStart flow).',\n required: false,\n examples: [\n 'https://app.example.com/_auth/oauth/google/callback',\n 'http://localhost:3000/_auth/oauth/google/callback',\n ],\n }),\n },\n\n // ============================================================================\n // OAuth Configuration - Kakao\n // ============================================================================\n SPFN_AUTH_KAKAO_CLIENT_ID: {\n ...envString({\n description: 'Kakao Login REST API key. Used as the OAuth client_id.',\n required: false,\n examples: ['your-kakao-rest-api-key'],\n }),\n },\n\n SPFN_AUTH_KAKAO_CLIENT_SECRET: {\n ...envString({\n description: 'Kakao Login client secret. Required when the Kakao client-secret feature is enabled.',\n required: false,\n sensitive: true,\n examples: ['your-kakao-client-secret'],\n }),\n },\n\n SPFN_AUTH_KAKAO_SCOPES: {\n ...envString({\n description: 'Comma-separated Kakao consent scopes. Defaults to account_email.',\n required: false,\n examples: ['account_email'],\n }),\n },\n\n SPFN_AUTH_KAKAO_REDIRECT_URI: {\n ...envString({\n description: 'Kakao OAuth callback URL. Defaults to {NEXT_PUBLIC_SPFN_APP_URL || SPFN_APP_URL}/_auth/oauth/kakao/callback.',\n required: false,\n examples: ['https://app.example.com/_auth/oauth/kakao/callback'],\n }),\n },\n\n // ============================================================================\n // OAuth Configuration - Naver\n // ============================================================================\n SPFN_AUTH_NAVER_CLIENT_ID: {\n ...envString({\n description: 'Naver Login OAuth client ID.',\n required: false,\n examples: ['your-naver-client-id'],\n }),\n },\n\n SPFN_AUTH_NAVER_CLIENT_SECRET: {\n ...envString({\n description: 'Naver Login OAuth client secret.',\n required: false,\n sensitive: true,\n examples: ['your-naver-client-secret'],\n }),\n },\n\n SPFN_AUTH_NAVER_REDIRECT_URI: {\n ...envString({\n description: 'Naver OAuth callback URL. Defaults to {NEXT_PUBLIC_SPFN_APP_URL || SPFN_APP_URL}/_auth/oauth/naver/callback.',\n required: false,\n examples: ['https://app.example.com/_auth/oauth/naver/callback'],\n }),\n },\n\n // ============================================================================\n // Native Social Login (mobile/web id_token verification)\n //\n // 네이티브 SDK가 받은 id_token을 서버가 JWKS로 검증하는 경로 전용 설정.\n // authorization code 교환을 하지 않으므로 client secret이 필요 없다.\n // audience(aud)로 허용할 client id 목록만 지정한다.\n // ============================================================================\n SPFN_AUTH_GOOGLE_NATIVE_CLIENT_IDS: {\n ...envString({\n description: 'Comma-separated Google client IDs accepted as id_token audience for native sign-in (iOS, Android, web). When set, Google native sign-in is enabled. SPFN_AUTH_GOOGLE_CLIENT_ID is also accepted automatically.',\n required: false,\n examples: [\n '123-ios.apps.googleusercontent.com,123-android.apps.googleusercontent.com',\n ],\n }),\n },\n\n SPFN_AUTH_APPLE_CLIENT_IDS: {\n ...envString({\n description: 'Comma-separated Apple client IDs accepted as id_token audience for native sign-in (iOS bundle ID, web/Android Services ID). When set, Apple native sign-in is enabled.',\n required: false,\n examples: [\n 'com.example.app,com.example.app.service',\n ],\n }),\n },\n\n SPFN_AUTH_OAUTH_SUCCESS_URL: {\n ...envString({\n description: 'OAuth callback page URL. This page should use OAuthCallback component to finalize session.',\n required: false,\n default: '/auth/callback',\n examples: [\n '/auth/callback',\n 'https://app.example.com/auth/callback',\n ],\n }),\n },\n\n SPFN_AUTH_OAUTH_ERROR_URL: {\n ...envString({\n description: 'URL to redirect after OAuth error. Use {error} placeholder for error message.',\n required: false,\n default: '/auth/error?error={error}',\n examples: [\n 'https://app.example.com/auth/error?error={error}',\n 'http://localhost:3000/auth/error?error={error}',\n ],\n }),\n },\n});\n"],"mappings":";AAcA,SAAS,yBAAyB;;;ACLlC;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAoBA,IAAM,gBAAgB,gBAAgB;AAAA;AAAA;AAAA;AAAA,EAIzC,0BAA0B;AAAA,IACtB,GAAG,UAAU;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,MACV,cAAc,CAAC,gBAAgB;AAAA,MAC/B,WAAW,yBAAyB;AAAA,QAChC,WAAW;AAAA,QACX,gBAAgB;AAAA,QAChB,YAAY;AAAA,MAChB,CAAC;AAAA,MACD,WAAW;AAAA,MACX,QAAQ;AAAA;AAAA,MACR,UAAU;AAAA,QACN;AAAA,QACA;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEA,uBAAuB;AAAA,IACnB,GAAG,UAAU;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,UAAU;AAAA,MACV,QAAQ;AAAA;AAAA,MACR,UAAU,CAAC,MAAM,OAAO,OAAO,OAAO,MAAM;AAAA,IAChD,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA,EAKA,sBAAsB;AAAA,IAClB,GAAG,UAAU;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,QACN;AAAA,QACA;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEA,0BAA0B;AAAA,IACtB,GAAG,UAAU;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU,CAAC,MAAM,OAAO,MAAM,KAAK;AAAA,IACvC,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA,EAKA,yBAAyB;AAAA,IACrB,GAAG,WAAW;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EAEA,6BAA6B;AAAA,IACzB,GAAG,UAAU;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,MACV,SAAS;AAAA,MACT,UAAU;AAAA,QACN;AAAA,QACA;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEA,2BAA2B;AAAA,IACvB,GAAG,UAAU;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,MACV,SAAS;AAAA,MACT,UAAU;AAAA,QACN;AAAA,QACA;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL;AACJ,CAAC;;;ADzaD,IAAM,WAAW,kBAAkB,aAAa;AACzC,IAAM,MAAM,SAAS,SAAS;","names":[]}
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UnauthorizedError, ForbiddenError, ConflictError, ValidationError, ErrorRegistry } from '@spfn/core/errors';
|
|
1
|
+
import { UnauthorizedError, ForbiddenError, ConflictError, NotFoundError, ValidationError, ErrorRegistry } from '@spfn/core/errors';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Authentication & Authorization Error Classes
|
|
@@ -74,6 +74,56 @@ declare class AccountDisabledError extends ForbiddenError {
|
|
|
74
74
|
details?: Record<string, any>;
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Account Pending Deletion Error (403)
|
|
79
|
+
*
|
|
80
|
+
* Thrown on login (password/OAuth/authenticate) when the account is within its
|
|
81
|
+
* deletion grace period. Carries `purgeScheduledAt` so the client can offer a
|
|
82
|
+
* recovery flow instead of a generic "disabled" message.
|
|
83
|
+
*/
|
|
84
|
+
declare class AccountPendingDeletionError extends ForbiddenError {
|
|
85
|
+
constructor(data?: {
|
|
86
|
+
purgeScheduledAt?: string;
|
|
87
|
+
message?: string;
|
|
88
|
+
details?: Record<string, any>;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Deletion Already Requested Error (409)
|
|
93
|
+
*
|
|
94
|
+
* Thrown when requesting deletion for an account that already has a pending
|
|
95
|
+
* deletion request (or has already been purged).
|
|
96
|
+
*/
|
|
97
|
+
declare class DeletionAlreadyRequestedError extends ConflictError {
|
|
98
|
+
constructor(data?: {
|
|
99
|
+
message?: string;
|
|
100
|
+
details?: Record<string, any>;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Deletion Not Requested Error (404)
|
|
105
|
+
*
|
|
106
|
+
* Thrown when trying to cancel/purge a deletion for an account that has no
|
|
107
|
+
* pending deletion request.
|
|
108
|
+
*/
|
|
109
|
+
declare class DeletionNotRequestedError extends NotFoundError {
|
|
110
|
+
constructor(data?: {
|
|
111
|
+
message?: string;
|
|
112
|
+
details?: Record<string, any>;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Immediate Deletion Not Allowed Error (403)
|
|
117
|
+
*
|
|
118
|
+
* Thrown when a self-service caller requests `immediate: true` but the server
|
|
119
|
+
* has not enabled `deletion.allowSelfImmediate`.
|
|
120
|
+
*/
|
|
121
|
+
declare class ImmediateDeletionNotAllowedError extends ForbiddenError {
|
|
122
|
+
constructor(data?: {
|
|
123
|
+
message?: string;
|
|
124
|
+
details?: Record<string, any>;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
77
127
|
/**
|
|
78
128
|
* Account Already Exists Error (409)
|
|
79
129
|
*
|
|
@@ -87,6 +137,18 @@ declare class AccountAlreadyExistsError extends ConflictError {
|
|
|
87
137
|
details?: Record<string, any>;
|
|
88
138
|
});
|
|
89
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Registration Rejected Error (403)
|
|
142
|
+
*
|
|
143
|
+
* Thrown by the app-injected beforeRegister hook to reject a registration
|
|
144
|
+
* (age gate, domain restriction, block list, ...)
|
|
145
|
+
*/
|
|
146
|
+
declare class RegistrationRejectedError extends ForbiddenError {
|
|
147
|
+
constructor(data?: {
|
|
148
|
+
message?: string;
|
|
149
|
+
details?: Record<string, any>;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
90
152
|
/**
|
|
91
153
|
* Invalid Verification Code Error (400)
|
|
92
154
|
*
|
|
@@ -197,6 +259,14 @@ type authErrors_AccountAlreadyExistsError = AccountAlreadyExistsError;
|
|
|
197
259
|
declare const authErrors_AccountAlreadyExistsError: typeof AccountAlreadyExistsError;
|
|
198
260
|
type authErrors_AccountDisabledError = AccountDisabledError;
|
|
199
261
|
declare const authErrors_AccountDisabledError: typeof AccountDisabledError;
|
|
262
|
+
type authErrors_AccountPendingDeletionError = AccountPendingDeletionError;
|
|
263
|
+
declare const authErrors_AccountPendingDeletionError: typeof AccountPendingDeletionError;
|
|
264
|
+
type authErrors_DeletionAlreadyRequestedError = DeletionAlreadyRequestedError;
|
|
265
|
+
declare const authErrors_DeletionAlreadyRequestedError: typeof DeletionAlreadyRequestedError;
|
|
266
|
+
type authErrors_DeletionNotRequestedError = DeletionNotRequestedError;
|
|
267
|
+
declare const authErrors_DeletionNotRequestedError: typeof DeletionNotRequestedError;
|
|
268
|
+
type authErrors_ImmediateDeletionNotAllowedError = ImmediateDeletionNotAllowedError;
|
|
269
|
+
declare const authErrors_ImmediateDeletionNotAllowedError: typeof ImmediateDeletionNotAllowedError;
|
|
200
270
|
type authErrors_InsufficientPermissionsError = InsufficientPermissionsError;
|
|
201
271
|
declare const authErrors_InsufficientPermissionsError: typeof InsufficientPermissionsError;
|
|
202
272
|
type authErrors_InsufficientRoleError = InsufficientRoleError;
|
|
@@ -215,6 +285,8 @@ type authErrors_InvalidVerificationTokenError = InvalidVerificationTokenError;
|
|
|
215
285
|
declare const authErrors_InvalidVerificationTokenError: typeof InvalidVerificationTokenError;
|
|
216
286
|
type authErrors_KeyExpiredError = KeyExpiredError;
|
|
217
287
|
declare const authErrors_KeyExpiredError: typeof KeyExpiredError;
|
|
288
|
+
type authErrors_RegistrationRejectedError = RegistrationRejectedError;
|
|
289
|
+
declare const authErrors_RegistrationRejectedError: typeof RegistrationRejectedError;
|
|
218
290
|
type authErrors_ReservedUsernameError = ReservedUsernameError;
|
|
219
291
|
declare const authErrors_ReservedUsernameError: typeof ReservedUsernameError;
|
|
220
292
|
type authErrors_TokenExpiredError = TokenExpiredError;
|
|
@@ -226,7 +298,7 @@ declare const authErrors_VerificationTokenPurposeMismatchError: typeof Verificat
|
|
|
226
298
|
type authErrors_VerificationTokenTargetMismatchError = VerificationTokenTargetMismatchError;
|
|
227
299
|
declare const authErrors_VerificationTokenTargetMismatchError: typeof VerificationTokenTargetMismatchError;
|
|
228
300
|
declare namespace authErrors {
|
|
229
|
-
export { authErrors_AccountAlreadyExistsError as AccountAlreadyExistsError, authErrors_AccountDisabledError as AccountDisabledError, authErrors_InsufficientPermissionsError as InsufficientPermissionsError, authErrors_InsufficientRoleError as InsufficientRoleError, authErrors_InvalidCredentialsError as InvalidCredentialsError, authErrors_InvalidKeyFingerprintError as InvalidKeyFingerprintError, authErrors_InvalidSocialTokenError as InvalidSocialTokenError, authErrors_InvalidTokenError as InvalidTokenError, authErrors_InvalidVerificationCodeError as InvalidVerificationCodeError, authErrors_InvalidVerificationTokenError as InvalidVerificationTokenError, authErrors_KeyExpiredError as KeyExpiredError, authErrors_ReservedUsernameError as ReservedUsernameError, authErrors_TokenExpiredError as TokenExpiredError, authErrors_UsernameAlreadyTakenError as UsernameAlreadyTakenError, authErrors_VerificationTokenPurposeMismatchError as VerificationTokenPurposeMismatchError, authErrors_VerificationTokenTargetMismatchError as VerificationTokenTargetMismatchError };
|
|
301
|
+
export { authErrors_AccountAlreadyExistsError as AccountAlreadyExistsError, authErrors_AccountDisabledError as AccountDisabledError, authErrors_AccountPendingDeletionError as AccountPendingDeletionError, authErrors_DeletionAlreadyRequestedError as DeletionAlreadyRequestedError, authErrors_DeletionNotRequestedError as DeletionNotRequestedError, authErrors_ImmediateDeletionNotAllowedError as ImmediateDeletionNotAllowedError, authErrors_InsufficientPermissionsError as InsufficientPermissionsError, authErrors_InsufficientRoleError as InsufficientRoleError, authErrors_InvalidCredentialsError as InvalidCredentialsError, authErrors_InvalidKeyFingerprintError as InvalidKeyFingerprintError, authErrors_InvalidSocialTokenError as InvalidSocialTokenError, authErrors_InvalidTokenError as InvalidTokenError, authErrors_InvalidVerificationCodeError as InvalidVerificationCodeError, authErrors_InvalidVerificationTokenError as InvalidVerificationTokenError, authErrors_KeyExpiredError as KeyExpiredError, authErrors_RegistrationRejectedError as RegistrationRejectedError, authErrors_ReservedUsernameError as ReservedUsernameError, authErrors_TokenExpiredError as TokenExpiredError, authErrors_UsernameAlreadyTakenError as UsernameAlreadyTakenError, authErrors_VerificationTokenPurposeMismatchError as VerificationTokenPurposeMismatchError, authErrors_VerificationTokenTargetMismatchError as VerificationTokenTargetMismatchError };
|
|
230
302
|
}
|
|
231
303
|
|
|
232
304
|
/**
|
|
@@ -235,4 +307,4 @@ declare namespace authErrors {
|
|
|
235
307
|
|
|
236
308
|
declare const authErrorRegistry: ErrorRegistry;
|
|
237
309
|
|
|
238
|
-
export { AccountAlreadyExistsError, AccountDisabledError, authErrors as AuthError, InsufficientPermissionsError, InsufficientRoleError, InvalidCredentialsError, InvalidKeyFingerprintError, InvalidSocialTokenError, InvalidTokenError, InvalidVerificationCodeError, InvalidVerificationTokenError, KeyExpiredError, ReservedUsernameError, TokenExpiredError, UsernameAlreadyTakenError, VerificationTokenPurposeMismatchError, VerificationTokenTargetMismatchError, authErrorRegistry };
|
|
310
|
+
export { AccountAlreadyExistsError, AccountDisabledError, AccountPendingDeletionError, authErrors as AuthError, DeletionAlreadyRequestedError, DeletionNotRequestedError, ImmediateDeletionNotAllowedError, InsufficientPermissionsError, InsufficientRoleError, InvalidCredentialsError, InvalidKeyFingerprintError, InvalidSocialTokenError, InvalidTokenError, InvalidVerificationCodeError, InvalidVerificationTokenError, KeyExpiredError, RegistrationRejectedError, ReservedUsernameError, TokenExpiredError, UsernameAlreadyTakenError, VerificationTokenPurposeMismatchError, VerificationTokenTargetMismatchError, authErrorRegistry };
|
package/dist/errors.js
CHANGED
|
@@ -12,6 +12,10 @@ var auth_errors_exports = {};
|
|
|
12
12
|
__export(auth_errors_exports, {
|
|
13
13
|
AccountAlreadyExistsError: () => AccountAlreadyExistsError,
|
|
14
14
|
AccountDisabledError: () => AccountDisabledError,
|
|
15
|
+
AccountPendingDeletionError: () => AccountPendingDeletionError,
|
|
16
|
+
DeletionAlreadyRequestedError: () => DeletionAlreadyRequestedError,
|
|
17
|
+
DeletionNotRequestedError: () => DeletionNotRequestedError,
|
|
18
|
+
ImmediateDeletionNotAllowedError: () => ImmediateDeletionNotAllowedError,
|
|
15
19
|
InsufficientPermissionsError: () => InsufficientPermissionsError,
|
|
16
20
|
InsufficientRoleError: () => InsufficientRoleError,
|
|
17
21
|
InvalidCredentialsError: () => InvalidCredentialsError,
|
|
@@ -21,6 +25,7 @@ __export(auth_errors_exports, {
|
|
|
21
25
|
InvalidVerificationCodeError: () => InvalidVerificationCodeError,
|
|
22
26
|
InvalidVerificationTokenError: () => InvalidVerificationTokenError,
|
|
23
27
|
KeyExpiredError: () => KeyExpiredError,
|
|
28
|
+
RegistrationRejectedError: () => RegistrationRejectedError,
|
|
24
29
|
ReservedUsernameError: () => ReservedUsernameError,
|
|
25
30
|
TokenExpiredError: () => TokenExpiredError,
|
|
26
31
|
UsernameAlreadyTakenError: () => UsernameAlreadyTakenError,
|
|
@@ -31,7 +36,8 @@ import {
|
|
|
31
36
|
ValidationError,
|
|
32
37
|
UnauthorizedError,
|
|
33
38
|
ForbiddenError,
|
|
34
|
-
ConflictError
|
|
39
|
+
ConflictError,
|
|
40
|
+
NotFoundError
|
|
35
41
|
} from "@spfn/core/errors";
|
|
36
42
|
var InvalidCredentialsError = class extends UnauthorizedError {
|
|
37
43
|
constructor(data = {}) {
|
|
@@ -73,6 +79,33 @@ var AccountDisabledError = class extends ForbiddenError {
|
|
|
73
79
|
this.name = "AccountDisabledError";
|
|
74
80
|
}
|
|
75
81
|
};
|
|
82
|
+
var AccountPendingDeletionError = class extends ForbiddenError {
|
|
83
|
+
constructor(data = {}) {
|
|
84
|
+
super({
|
|
85
|
+
message: data.message || "Account is scheduled for deletion",
|
|
86
|
+
details: { status: "pending_deletion", purgeScheduledAt: data.purgeScheduledAt, ...data.details }
|
|
87
|
+
});
|
|
88
|
+
this.name = "AccountPendingDeletionError";
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var DeletionAlreadyRequestedError = class extends ConflictError {
|
|
92
|
+
constructor(data = {}) {
|
|
93
|
+
super({ message: data.message || "Account deletion has already been requested", details: data.details });
|
|
94
|
+
this.name = "DeletionAlreadyRequestedError";
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
var DeletionNotRequestedError = class extends NotFoundError {
|
|
98
|
+
constructor(data = {}) {
|
|
99
|
+
super({ message: data.message || "No pending account deletion request found", details: data.details });
|
|
100
|
+
this.name = "DeletionNotRequestedError";
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
var ImmediateDeletionNotAllowedError = class extends ForbiddenError {
|
|
104
|
+
constructor(data = {}) {
|
|
105
|
+
super({ message: data.message || "Immediate self-service deletion is not enabled", details: data.details });
|
|
106
|
+
this.name = "ImmediateDeletionNotAllowedError";
|
|
107
|
+
}
|
|
108
|
+
};
|
|
76
109
|
var AccountAlreadyExistsError = class extends ConflictError {
|
|
77
110
|
constructor(data = {}) {
|
|
78
111
|
super({
|
|
@@ -86,6 +119,12 @@ var AccountAlreadyExistsError = class extends ConflictError {
|
|
|
86
119
|
this.name = "AccountAlreadyExistsError";
|
|
87
120
|
}
|
|
88
121
|
};
|
|
122
|
+
var RegistrationRejectedError = class extends ForbiddenError {
|
|
123
|
+
constructor(data = {}) {
|
|
124
|
+
super({ message: data.message || "Registration rejected", details: data.details });
|
|
125
|
+
this.name = "RegistrationRejectedError";
|
|
126
|
+
}
|
|
127
|
+
};
|
|
89
128
|
var InvalidVerificationCodeError = class extends ValidationError {
|
|
90
129
|
constructor(data = {}) {
|
|
91
130
|
super({ message: data.message || "Invalid verification code", details: data.details });
|
|
@@ -172,7 +211,12 @@ authErrorRegistry.append([
|
|
|
172
211
|
TokenExpiredError,
|
|
173
212
|
KeyExpiredError,
|
|
174
213
|
AccountDisabledError,
|
|
214
|
+
AccountPendingDeletionError,
|
|
215
|
+
DeletionAlreadyRequestedError,
|
|
216
|
+
DeletionNotRequestedError,
|
|
217
|
+
ImmediateDeletionNotAllowedError,
|
|
175
218
|
AccountAlreadyExistsError,
|
|
219
|
+
RegistrationRejectedError,
|
|
176
220
|
ReservedUsernameError,
|
|
177
221
|
UsernameAlreadyTakenError,
|
|
178
222
|
InvalidVerificationCodeError,
|
|
@@ -186,7 +230,11 @@ authErrorRegistry.append([
|
|
|
186
230
|
export {
|
|
187
231
|
AccountAlreadyExistsError,
|
|
188
232
|
AccountDisabledError,
|
|
233
|
+
AccountPendingDeletionError,
|
|
189
234
|
auth_errors_exports as AuthError,
|
|
235
|
+
DeletionAlreadyRequestedError,
|
|
236
|
+
DeletionNotRequestedError,
|
|
237
|
+
ImmediateDeletionNotAllowedError,
|
|
190
238
|
InsufficientPermissionsError,
|
|
191
239
|
InsufficientRoleError,
|
|
192
240
|
InvalidCredentialsError,
|
|
@@ -196,6 +244,7 @@ export {
|
|
|
196
244
|
InvalidVerificationCodeError,
|
|
197
245
|
InvalidVerificationTokenError,
|
|
198
246
|
KeyExpiredError,
|
|
247
|
+
RegistrationRejectedError,
|
|
199
248
|
ReservedUsernameError,
|
|
200
249
|
TokenExpiredError,
|
|
201
250
|
UsernameAlreadyTakenError,
|