@spfn/auth 0.2.0-beta.10 → 0.2.0-beta.12
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 +459 -172
- package/dist/{dto-CRlgoCP5.d.ts → authenticate-xfEpwIjH.d.ts} +284 -182
- package/dist/config.d.ts +104 -0
- package/dist/config.js +61 -0
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +187 -130
- package/dist/index.js +24 -1
- package/dist/index.js.map +1 -1
- package/dist/nextjs/api.js +186 -0
- package/dist/nextjs/api.js.map +1 -1
- package/dist/nextjs/client.js +80 -0
- package/dist/nextjs/client.js.map +1 -0
- package/dist/nextjs/server.d.ts +68 -2
- package/dist/nextjs/server.js +125 -3
- package/dist/nextjs/server.js.map +1 -1
- package/dist/server.d.ts +243 -366
- package/dist/server.js +596 -476
- package/dist/server.js.map +1 -1
- package/package.json +11 -11
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 * 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 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 { authEnvSchema } from '@spfn/auth/config';\n *\n * // Access schema information\n * console.log(authEnvSchema.SPFN_AUTH_SESSION_SECRET.description);\n * console.log(authEnvSchema.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_BCRYPT_SALT_ROUNDS: {\n ...envNumber({\n description: 'Bcrypt salt rounds (cost factor, higher = more secure but slower)',\n default: 10,\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 // API Configuration\n // ============================================================================\n SPFN_API_URL: {\n ...envString({\n description: 'Base API URL for invitation links and other external-facing URLs',\n default: 'http://localhost:8790',\n required: false,\n examples: [\n 'https://api.example.com',\n 'http://localhost:8790',\n ],\n }),\n },\n\n // ============================================================================\n // AWS SNS Configuration (SMS)\n // ============================================================================\n SPFN_AUTH_AWS_REGION: {\n ...envString({\n description: 'AWS region for SNS service',\n default: 'ap-northeast-2',\n required: false,\n examples: ['ap-northeast-2', 'us-east-1', 'eu-west-1'],\n }),\n },\n\n SPFN_AUTH_AWS_SNS_ACCESS_KEY_ID: {\n ...envString({\n description: 'AWS SNS access key ID (optional, uses default credentials chain if not provided)',\n required: false,\n sensitive: true,\n examples: ['AKIAIOSFODNN7EXAMPLE'],\n }),\n },\n\n SPFN_AUTH_AWS_SNS_SECRET_ACCESS_KEY: {\n ...envString({\n description: 'AWS SNS secret access key (optional, uses default credentials chain if not provided)',\n required: false,\n sensitive: true,\n examples: ['wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'],\n }),\n },\n\n SPFN_AUTH_AWS_SNS_SENDER_ID: {\n ...envString({\n description: 'SMS sender ID displayed to recipients (max 11 characters, alphanumeric)',\n required: false,\n examples: ['MyApp', 'YourBrand'],\n }),\n },\n\n // ============================================================================\n // AWS SES Configuration (Email)\n // ============================================================================\n SPFN_AUTH_AWS_SES_ACCESS_KEY_ID: {\n ...envString({\n description: 'AWS SES access key ID (optional, uses default credentials chain if not provided)',\n required: false,\n sensitive: true,\n examples: ['AKIAIOSFODNN7EXAMPLE'],\n }),\n },\n\n SPFN_AUTH_AWS_SES_SECRET_ACCESS_KEY: {\n ...envString({\n description: 'AWS SES secret access key (optional, uses default credentials chain if not provided)',\n required: false,\n sensitive: true,\n examples: ['wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'],\n }),\n },\n\n SPFN_AUTH_AWS_SES_FROM_EMAIL: {\n ...envString({\n description: 'Sender email address (must be verified in AWS SES)',\n required: false,\n examples: ['noreply@example.com', 'auth@yourdomain.com'],\n }),\n },\n\n SPFN_AUTH_AWS_SES_FROM_NAME: {\n ...envString({\n description: 'Sender display name',\n required: false,\n examples: ['MyApp', 'Your Company'],\n }),\n },\n});"],"mappings":";AAcA,SAAS,yBAAyB;;;ACLlC;AAAA,EACI;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,8BAA8B;AAAA,IAC1B,GAAG,UAAU;AAAA,MACT,aAAa;AAAA,M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U,CAAC,0CAA0C;AAAA,IACzD,CAAC;AAAA,EACL;AAAA,EAEA,8BAA8B;AAAA,IAC1B,GAAG,UAAU;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,MACV,UAAU,CAAC,uBAAuB,qBAAqB;AAAA,IAC3D,CAAC;AAAA,EACL;AAAA,EAEA,6BAA6B;AAAA,IACzB,GAAG,UAAU;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,MACV,UAAU,CAAC,SAAS,cAAc;AAAA,IACtC,CAAC;AAAA,EACL;AACJ,CAAC;;;AD9PD,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 * 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 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 { authEnvSchema } from '@spfn/auth/config';\n *\n * // Access schema information\n * console.log(authEnvSchema.SPFN_AUTH_SESSION_SECRET.description);\n * console.log(authEnvSchema.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_BCRYPT_SALT_ROUNDS: {\n ...envNumber({\n description: 'Bcrypt salt rounds (cost factor, higher = more secure but slower)',\n default: 10,\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 // API Configuration\n // ============================================================================\n SPFN_API_URL: {\n ...envString({\n description: 'Base API URL for invitation links and other external-facing URLs',\n default: 'http://localhost:8790',\n required: false,\n examples: [\n 'https://api.example.com',\n 'http://localhost:8790',\n ],\n }),\n },\n\n // ============================================================================\n // AWS SNS Configuration (SMS)\n // ============================================================================\n SPFN_AUTH_AWS_REGION: {\n ...envString({\n description: 'AWS region for SNS service',\n default: 'ap-northeast-2',\n required: false,\n examples: ['ap-northeast-2', 'us-east-1', 'eu-west-1'],\n }),\n },\n\n SPFN_AUTH_AWS_SNS_ACCESS_KEY_ID: {\n ...envString({\n description: 'AWS SNS access key ID (optional, uses default credentials chain if not provided)',\n required: false,\n sensitive: true,\n examples: ['AKIAIOSFODNN7EXAMPLE'],\n }),\n },\n\n SPFN_AUTH_AWS_SNS_SECRET_ACCESS_KEY: {\n ...envString({\n description: 'AWS SNS secret access key (optional, uses default credentials chain if not provided)',\n required: false,\n sensitive: true,\n examples: ['wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'],\n }),\n },\n\n SPFN_AUTH_AWS_SNS_SENDER_ID: {\n ...envString({\n description: 'SMS sender ID displayed to recipients (max 11 characters, alphanumeric)',\n required: false,\n examples: ['MyApp', 'YourBrand'],\n }),\n },\n\n // ============================================================================\n // AWS SES Configuration (Email)\n // ============================================================================\n SPFN_AUTH_AWS_SES_ACCESS_KEY_ID: {\n ...envString({\n description: 'AWS SES access key ID (optional, uses default credentials chain if not provided)',\n required: false,\n sensitive: true,\n examples: ['AKIAIOSFODNN7EXAMPLE'],\n }),\n },\n\n SPFN_AUTH_AWS_SES_SECRET_ACCESS_KEY: {\n ...envString({\n description: 'AWS SES secret access key (optional, uses default credentials chain if not provided)',\n required: false,\n sensitive: true,\n examples: ['wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'],\n }),\n },\n\n SPFN_AUTH_AWS_SES_FROM_EMAIL: {\n ...envString({\n description: 'Sender email address (must be verified in AWS SES)',\n required: false,\n examples: ['noreply@example.com', 'auth@yourdomain.com'],\n }),\n },\n\n SPFN_AUTH_AWS_SES_FROM_NAME: {\n ...envString({\n description: 'Sender display name',\n required: false,\n examples: ['MyApp', 'Your Company'],\n }),\n },\n\n SPFN_APP_URL: {\n ...envString({\n description: 'Next.js application URL. Used for OAuth callback redirects.',\n default: 'http://localhost:3000',\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_REDIRECT_URI: {\n ...envString({\n description: 'Google OAuth callback URL. Defaults to {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 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: 'http://localhost:3000/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});"],"mappings":";AAcA,SAAS,yBAAyB;;;ACLlC;AAAA,EACI;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,Q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AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,QACN;AAAA,QACA;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA,EAKA,4BAA4B;AAAA,IACxB,GAAG,UAAU;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,MACV,UAAU,CAAC,6CAA6C;AAAA,IAC5D,CAAC;AAAA,EACL;AAAA,EAEA,gCAAgC;AAAA,IAC5B,GAAG,UAAU;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,MACV,WAAW;AAAA,MACX,UAAU,CAAC,yBAAyB;AAAA,IACxC,CAAC;AAAA,EACL;AAAA,EAEA,+BAA+B;AAAA,IAC3B,GAAG,UAAU;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,MACV,UAAU;AAAA,QACN;AAAA,QACA;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,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;;;ADjUD,IAAM,WAAW,kBAAkB,aAAa;AACzC,IAAM,MAAM,SAAS,SAAS;","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,38 @@
|
|
|
1
1
|
import * as _spfn_core_nextjs from '@spfn/core/nextjs';
|
|
2
|
-
import { R as RoleConfig, P as PermissionConfig,
|
|
3
|
-
export { k as AuthInitOptions, A as AuthSession, I as INVITATION_STATUSES, n as InvitationStatus, K as KEY_ALGORITHM, l as KeyAlgorithmType, i as PERMISSION_CATEGORIES, j as PermissionCategory, e as SOCIAL_PROVIDERS, p as SocialProvider, d as USER_STATUSES, o as UserStatus, h as VERIFICATION_PURPOSES, g as VERIFICATION_TARGET_TYPES, f as VerificationPurpose, V as VerificationTargetType } from './
|
|
2
|
+
import { R as RoleConfig, P as PermissionConfig, C as CheckAccountExistsResult, S as SendVerificationCodeResult, a as RegisterResult, L as LoginResult, b as RotateKeyResult, O as OAuthStartResult, U as UserProfile, c as ProfileInfo, m as mainAuthRouter } from './authenticate-xfEpwIjH.js';
|
|
3
|
+
export { k as AuthInitOptions, A as AuthSession, I as INVITATION_STATUSES, n as InvitationStatus, K as KEY_ALGORITHM, l as KeyAlgorithmType, i as PERMISSION_CATEGORIES, j as PermissionCategory, e as SOCIAL_PROVIDERS, p as SocialProvider, d as USER_STATUSES, o as UserStatus, h as VERIFICATION_PURPOSES, g as VERIFICATION_TARGET_TYPES, f as VerificationPurpose, V as VerificationTargetType } from './authenticate-xfEpwIjH.js';
|
|
4
4
|
import * as _spfn_core_route from '@spfn/core/route';
|
|
5
|
+
import { HttpMethod } from '@spfn/core/route';
|
|
5
6
|
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
6
7
|
import '@spfn/auth/server';
|
|
7
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Email regex pattern (RFC 5322 compliant)
|
|
11
|
+
* Validates: local-part@domain.tld
|
|
12
|
+
* - Local part: alphanumeric, dots, hyphens, underscores
|
|
13
|
+
* - Domain: alphanumeric, hyphens, dots
|
|
14
|
+
* - TLD: minimum 2 characters
|
|
15
|
+
*/
|
|
16
|
+
declare const EMAIL_PATTERN = "^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$";
|
|
17
|
+
/**
|
|
18
|
+
* Phone regex pattern (E.164 format)
|
|
19
|
+
* Format: +[country code][number] (1-15 digits total)
|
|
20
|
+
*/
|
|
21
|
+
declare const PHONE_PATTERN = "^\\+[1-9]\\d{1,14}$";
|
|
22
|
+
/**
|
|
23
|
+
* SHA-256 fingerprint pattern (64 hex characters)
|
|
24
|
+
*/
|
|
25
|
+
declare const FINGERPRINT_PATTERN = "^[a-f0-9]{64}$";
|
|
26
|
+
/**
|
|
27
|
+
* UUID v4 pattern (8-4-4-4-12 format)
|
|
28
|
+
*/
|
|
29
|
+
declare const UUID_PATTERN = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
30
|
+
/**
|
|
31
|
+
* Base64 pattern (DER encoded keys)
|
|
32
|
+
* Matches standard Base64 with padding
|
|
33
|
+
*/
|
|
34
|
+
declare const BASE64_PATTERN = "^[A-Za-z0-9+/]+=*$";
|
|
35
|
+
|
|
8
36
|
/**
|
|
9
37
|
* @spfn/auth - Built-in Roles and Permissions
|
|
10
38
|
*
|
|
@@ -31,31 +59,16 @@ type BuiltinRoleName = keyof typeof BUILTIN_ROLE_PERMISSIONS;
|
|
|
31
59
|
type BuiltinPermissionName = typeof BUILTIN_PERMISSIONS[keyof typeof BUILTIN_PERMISSIONS]['name'];
|
|
32
60
|
|
|
33
61
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* -
|
|
37
|
-
* - Domain: alphanumeric, hyphens, dots
|
|
38
|
-
* - TLD: minimum 2 characters
|
|
39
|
-
*/
|
|
40
|
-
declare const EMAIL_PATTERN = "^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$";
|
|
41
|
-
/**
|
|
42
|
-
* Phone regex pattern (E.164 format)
|
|
43
|
-
* Format: +[country code][number] (1-15 digits total)
|
|
44
|
-
*/
|
|
45
|
-
declare const PHONE_PATTERN = "^\\+[1-9]\\d{1,14}$";
|
|
46
|
-
/**
|
|
47
|
-
* SHA-256 fingerprint pattern (64 hex characters)
|
|
48
|
-
*/
|
|
49
|
-
declare const FINGERPRINT_PATTERN = "^[a-f0-9]{64}$";
|
|
50
|
-
/**
|
|
51
|
-
* UUID v4 pattern (8-4-4-4-12 format)
|
|
52
|
-
*/
|
|
53
|
-
declare const UUID_PATTERN = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
54
|
-
/**
|
|
55
|
-
* Base64 pattern (DER encoded keys)
|
|
56
|
-
* Matches standard Base64 with padding
|
|
62
|
+
* Route Map (Auto-generated)
|
|
63
|
+
*
|
|
64
|
+
* DO NOT EDIT - This file is generated by @spfn/core:route-map generator
|
|
57
65
|
*/
|
|
58
|
-
|
|
66
|
+
|
|
67
|
+
interface RouteInfo {
|
|
68
|
+
method: HttpMethod;
|
|
69
|
+
path: string;
|
|
70
|
+
}
|
|
71
|
+
declare const routeMap: Record<string, RouteInfo>;
|
|
59
72
|
|
|
60
73
|
/**
|
|
61
74
|
* Type-safe API client for auth routes
|
|
@@ -74,25 +87,138 @@ declare const BASE64_PATTERN = "^[A-Za-z0-9+/]+=*$";
|
|
|
74
87
|
* ```
|
|
75
88
|
*/
|
|
76
89
|
declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
77
|
-
|
|
78
|
-
|
|
90
|
+
checkAccountExists: _spfn_core_route.RouteDef<{
|
|
91
|
+
body: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{
|
|
92
|
+
email: _sinclair_typebox.TString;
|
|
93
|
+
}>, _sinclair_typebox.TObject<{
|
|
94
|
+
phone: _sinclair_typebox.TString;
|
|
95
|
+
}>]>;
|
|
96
|
+
}, {}, CheckAccountExistsResult>;
|
|
97
|
+
sendVerificationCode: _spfn_core_route.RouteDef<{
|
|
79
98
|
body: _sinclair_typebox.TObject<{
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
avatarUrl: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
84
|
-
bio: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
85
|
-
locale: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
86
|
-
timezone: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
87
|
-
dateOfBirth: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
88
|
-
gender: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
89
|
-
website: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
90
|
-
location: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
91
|
-
company: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
92
|
-
jobTitle: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
93
|
-
metadata: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TAny>>;
|
|
99
|
+
target: _sinclair_typebox.TString;
|
|
100
|
+
targetType: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"email">, _sinclair_typebox.TLiteral<"phone">]>;
|
|
101
|
+
purpose: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"registration">, _sinclair_typebox.TLiteral<"login">, _sinclair_typebox.TLiteral<"password_reset">, _sinclair_typebox.TLiteral<"email_change">, _sinclair_typebox.TLiteral<"phone_change">]>;
|
|
94
102
|
}>;
|
|
95
|
-
}, {},
|
|
103
|
+
}, {}, SendVerificationCodeResult>;
|
|
104
|
+
verifyCode: _spfn_core_route.RouteDef<{
|
|
105
|
+
body: _sinclair_typebox.TObject<{
|
|
106
|
+
target: _sinclair_typebox.TString;
|
|
107
|
+
targetType: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"email">, _sinclair_typebox.TLiteral<"phone">]>;
|
|
108
|
+
code: _sinclair_typebox.TString;
|
|
109
|
+
purpose: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"registration">, _sinclair_typebox.TLiteral<"login">, _sinclair_typebox.TLiteral<"password_reset">, _sinclair_typebox.TLiteral<"email_change">, _sinclair_typebox.TLiteral<"phone_change">]>;
|
|
110
|
+
}>;
|
|
111
|
+
}, {}, {
|
|
112
|
+
valid: boolean;
|
|
113
|
+
verificationToken: string;
|
|
114
|
+
}>;
|
|
115
|
+
register: _spfn_core_route.RouteDef<{
|
|
116
|
+
body: _sinclair_typebox.TObject<{
|
|
117
|
+
email: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
118
|
+
phone: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
119
|
+
verificationToken: _sinclair_typebox.TString;
|
|
120
|
+
password: _sinclair_typebox.TString;
|
|
121
|
+
}>;
|
|
122
|
+
}, {
|
|
123
|
+
body: _sinclair_typebox.TObject<{
|
|
124
|
+
publicKey: _sinclair_typebox.TString;
|
|
125
|
+
keyId: _sinclair_typebox.TString;
|
|
126
|
+
fingerprint: _sinclair_typebox.TString;
|
|
127
|
+
algorithm: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ES256" | "RS256">[]>;
|
|
128
|
+
}>;
|
|
129
|
+
}, RegisterResult>;
|
|
130
|
+
login: _spfn_core_route.RouteDef<{
|
|
131
|
+
body: _sinclair_typebox.TObject<{
|
|
132
|
+
email: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
133
|
+
phone: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
134
|
+
password: _sinclair_typebox.TString;
|
|
135
|
+
}>;
|
|
136
|
+
}, {
|
|
137
|
+
body: _sinclair_typebox.TObject<{
|
|
138
|
+
publicKey: _sinclair_typebox.TString;
|
|
139
|
+
keyId: _sinclair_typebox.TString;
|
|
140
|
+
fingerprint: _sinclair_typebox.TString;
|
|
141
|
+
algorithm: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ES256" | "RS256">[]>;
|
|
142
|
+
oldKeyId: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
143
|
+
}>;
|
|
144
|
+
}, LoginResult>;
|
|
145
|
+
logout: _spfn_core_route.RouteDef<{}, {}, void>;
|
|
146
|
+
rotateKey: _spfn_core_route.RouteDef<{}, {
|
|
147
|
+
body: _sinclair_typebox.TObject<{
|
|
148
|
+
publicKey: _sinclair_typebox.TString;
|
|
149
|
+
keyId: _sinclair_typebox.TString;
|
|
150
|
+
fingerprint: _sinclair_typebox.TString;
|
|
151
|
+
algorithm: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ES256" | "RS256">[]>;
|
|
152
|
+
}>;
|
|
153
|
+
}, RotateKeyResult>;
|
|
154
|
+
changePassword: _spfn_core_route.RouteDef<{
|
|
155
|
+
body: _sinclair_typebox.TObject<{
|
|
156
|
+
currentPassword: _sinclair_typebox.TString;
|
|
157
|
+
newPassword: _sinclair_typebox.TString;
|
|
158
|
+
}>;
|
|
159
|
+
}, {}, void>;
|
|
160
|
+
getAuthSession: _spfn_core_route.RouteDef<{}, {}, {
|
|
161
|
+
role: {
|
|
162
|
+
id: number;
|
|
163
|
+
name: string;
|
|
164
|
+
displayName: string;
|
|
165
|
+
priority: number;
|
|
166
|
+
};
|
|
167
|
+
permissions: {
|
|
168
|
+
id: number;
|
|
169
|
+
name: string;
|
|
170
|
+
displayName: string;
|
|
171
|
+
category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
|
|
172
|
+
}[];
|
|
173
|
+
userId: number;
|
|
174
|
+
email: string | null;
|
|
175
|
+
emailVerified: boolean;
|
|
176
|
+
phoneVerified: boolean;
|
|
177
|
+
}>;
|
|
178
|
+
oauthGoogleStart: _spfn_core_route.RouteDef<{
|
|
179
|
+
query: _sinclair_typebox.TObject<{
|
|
180
|
+
state: _sinclair_typebox.TString;
|
|
181
|
+
}>;
|
|
182
|
+
}, {}, Response>;
|
|
183
|
+
oauthGoogleCallback: _spfn_core_route.RouteDef<{
|
|
184
|
+
query: _sinclair_typebox.TObject<{
|
|
185
|
+
code: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
186
|
+
state: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
187
|
+
error: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
188
|
+
error_description: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
189
|
+
}>;
|
|
190
|
+
}, {}, Response>;
|
|
191
|
+
oauthStart: _spfn_core_route.RouteDef<{
|
|
192
|
+
body: _sinclair_typebox.TObject<{
|
|
193
|
+
provider: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"google" | "github" | "kakao" | "naver">[]>;
|
|
194
|
+
returnUrl: _sinclair_typebox.TString;
|
|
195
|
+
publicKey: _sinclair_typebox.TString;
|
|
196
|
+
keyId: _sinclair_typebox.TString;
|
|
197
|
+
fingerprint: _sinclair_typebox.TString;
|
|
198
|
+
algorithm: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ES256" | "RS256">[]>;
|
|
199
|
+
}>;
|
|
200
|
+
}, {}, OAuthStartResult>;
|
|
201
|
+
oauthProviders: _spfn_core_route.RouteDef<{}, {}, {
|
|
202
|
+
providers: ("google" | "github" | "kakao" | "naver")[];
|
|
203
|
+
}>;
|
|
204
|
+
getGoogleOAuthUrl: _spfn_core_route.RouteDef<{
|
|
205
|
+
body: _sinclair_typebox.TObject<{
|
|
206
|
+
returnUrl: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
207
|
+
state: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
208
|
+
}>;
|
|
209
|
+
}, {}, {
|
|
210
|
+
authUrl: string;
|
|
211
|
+
}>;
|
|
212
|
+
oauthFinalize: _spfn_core_route.RouteDef<{
|
|
213
|
+
body: _sinclair_typebox.TObject<{
|
|
214
|
+
userId: _sinclair_typebox.TString;
|
|
215
|
+
keyId: _sinclair_typebox.TString;
|
|
216
|
+
returnUrl: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
217
|
+
}>;
|
|
218
|
+
}, {}, {
|
|
219
|
+
success: boolean;
|
|
220
|
+
returnUrl: string;
|
|
221
|
+
}>;
|
|
96
222
|
getInvitation: _spfn_core_route.RouteDef<{
|
|
97
223
|
params: _sinclair_typebox.TObject<{
|
|
98
224
|
token: _sinclair_typebox.TString;
|
|
@@ -193,95 +319,26 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
|
193
319
|
id: _sinclair_typebox.TNumber;
|
|
194
320
|
}>;
|
|
195
321
|
}, {}, void>;
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
email: _sinclair_typebox.TString;
|
|
199
|
-
}>, _sinclair_typebox.TObject<{
|
|
200
|
-
phone: _sinclair_typebox.TString;
|
|
201
|
-
}>]>;
|
|
202
|
-
}, {}, CheckAccountExistsResult>;
|
|
203
|
-
sendVerificationCode: _spfn_core_route.RouteDef<{
|
|
204
|
-
body: _sinclair_typebox.TObject<{
|
|
205
|
-
target: _sinclair_typebox.TString;
|
|
206
|
-
targetType: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"email">, _sinclair_typebox.TLiteral<"phone">]>;
|
|
207
|
-
purpose: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"registration">, _sinclair_typebox.TLiteral<"login">, _sinclair_typebox.TLiteral<"password_reset">, _sinclair_typebox.TLiteral<"email_change">, _sinclair_typebox.TLiteral<"phone_change">]>;
|
|
208
|
-
}>;
|
|
209
|
-
}, {}, SendVerificationCodeResult>;
|
|
210
|
-
verifyCode: _spfn_core_route.RouteDef<{
|
|
211
|
-
body: _sinclair_typebox.TObject<{
|
|
212
|
-
target: _sinclair_typebox.TString;
|
|
213
|
-
targetType: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"email">, _sinclair_typebox.TLiteral<"phone">]>;
|
|
214
|
-
code: _sinclair_typebox.TString;
|
|
215
|
-
purpose: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"registration">, _sinclair_typebox.TLiteral<"login">, _sinclair_typebox.TLiteral<"password_reset">, _sinclair_typebox.TLiteral<"email_change">, _sinclair_typebox.TLiteral<"phone_change">]>;
|
|
216
|
-
}>;
|
|
217
|
-
}, {}, {
|
|
218
|
-
valid: boolean;
|
|
219
|
-
verificationToken: string;
|
|
220
|
-
}>;
|
|
221
|
-
register: _spfn_core_route.RouteDef<{
|
|
222
|
-
body: _sinclair_typebox.TObject<{
|
|
223
|
-
email: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
224
|
-
phone: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
225
|
-
verificationToken: _sinclair_typebox.TString;
|
|
226
|
-
password: _sinclair_typebox.TString;
|
|
227
|
-
}>;
|
|
228
|
-
}, {
|
|
229
|
-
body: _sinclair_typebox.TObject<{
|
|
230
|
-
publicKey: _sinclair_typebox.TString;
|
|
231
|
-
keyId: _sinclair_typebox.TString;
|
|
232
|
-
fingerprint: _sinclair_typebox.TString;
|
|
233
|
-
algorithm: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ES256" | "RS256">[]>;
|
|
234
|
-
}>;
|
|
235
|
-
}, RegisterResult>;
|
|
236
|
-
login: _spfn_core_route.RouteDef<{
|
|
237
|
-
body: _sinclair_typebox.TObject<{
|
|
238
|
-
email: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
239
|
-
phone: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
240
|
-
password: _sinclair_typebox.TString;
|
|
241
|
-
}>;
|
|
242
|
-
}, {
|
|
243
|
-
body: _sinclair_typebox.TObject<{
|
|
244
|
-
publicKey: _sinclair_typebox.TString;
|
|
245
|
-
keyId: _sinclair_typebox.TString;
|
|
246
|
-
fingerprint: _sinclair_typebox.TString;
|
|
247
|
-
algorithm: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ES256" | "RS256">[]>;
|
|
248
|
-
oldKeyId: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
249
|
-
}>;
|
|
250
|
-
}, LoginResult>;
|
|
251
|
-
logout: _spfn_core_route.RouteDef<{}, {}, void>;
|
|
252
|
-
rotateKey: _spfn_core_route.RouteDef<{}, {
|
|
253
|
-
body: _sinclair_typebox.TObject<{
|
|
254
|
-
publicKey: _sinclair_typebox.TString;
|
|
255
|
-
keyId: _sinclair_typebox.TString;
|
|
256
|
-
fingerprint: _sinclair_typebox.TString;
|
|
257
|
-
algorithm: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ES256" | "RS256">[]>;
|
|
258
|
-
}>;
|
|
259
|
-
}, RotateKeyResult>;
|
|
260
|
-
changePassword: _spfn_core_route.RouteDef<{
|
|
322
|
+
getUserProfile: _spfn_core_route.RouteDef<{}, {}, UserProfile>;
|
|
323
|
+
updateUserProfile: _spfn_core_route.RouteDef<{
|
|
261
324
|
body: _sinclair_typebox.TObject<{
|
|
262
|
-
|
|
263
|
-
|
|
325
|
+
displayName: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
326
|
+
firstName: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
327
|
+
lastName: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
328
|
+
avatarUrl: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
329
|
+
bio: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
330
|
+
locale: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
331
|
+
timezone: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
332
|
+
dateOfBirth: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
333
|
+
gender: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
334
|
+
website: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
335
|
+
location: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
336
|
+
company: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
337
|
+
jobTitle: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
338
|
+
metadata: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TAny>>;
|
|
264
339
|
}>;
|
|
265
|
-
}, {},
|
|
266
|
-
getAuthSession: _spfn_core_route.RouteDef<{}, {}, {
|
|
267
|
-
role: {
|
|
268
|
-
id: number;
|
|
269
|
-
name: string;
|
|
270
|
-
displayName: string;
|
|
271
|
-
priority: number;
|
|
272
|
-
};
|
|
273
|
-
permissions: {
|
|
274
|
-
id: number;
|
|
275
|
-
name: string;
|
|
276
|
-
displayName: string;
|
|
277
|
-
category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
|
|
278
|
-
}[];
|
|
279
|
-
userId: number;
|
|
280
|
-
email: string | null;
|
|
281
|
-
emailVerified: boolean;
|
|
282
|
-
phoneVerified: boolean;
|
|
283
|
-
}>;
|
|
340
|
+
}, {}, ProfileInfo>;
|
|
284
341
|
}>>;
|
|
285
342
|
type AuthRouter = typeof mainAuthRouter;
|
|
286
343
|
|
|
287
|
-
export { type AuthRouter, BASE64_PATTERN, BUILTIN_PERMISSIONS, BUILTIN_ROLES, BUILTIN_ROLE_PERMISSIONS, type BuiltinPermissionName, type BuiltinRoleName, EMAIL_PATTERN, FINGERPRINT_PATTERN, PHONE_PATTERN, PermissionConfig, ProfileInfo, RoleConfig, UUID_PATTERN, UserProfile, authApi };
|
|
344
|
+
export { type AuthRouter, BASE64_PATTERN, BUILTIN_PERMISSIONS, BUILTIN_ROLES, BUILTIN_ROLE_PERMISSIONS, type BuiltinPermissionName, type BuiltinRoleName, EMAIL_PATTERN, FINGERPRINT_PATTERN, PHONE_PATTERN, PermissionConfig, ProfileInfo, RoleConfig, UUID_PATTERN, UserProfile, authApi, routeMap as authRouteMap };
|
package/dist/index.js
CHANGED
|
@@ -141,6 +141,28 @@ authErrorRegistry.append([
|
|
|
141
141
|
InsufficientRoleError
|
|
142
142
|
]);
|
|
143
143
|
|
|
144
|
+
// src/generated/route-map.ts
|
|
145
|
+
var routeMap = {
|
|
146
|
+
checkAccountExists: { method: "POST", path: "/_auth/exists" },
|
|
147
|
+
sendVerificationCode: { method: "POST", path: "/_auth/codes" },
|
|
148
|
+
verifyCode: { method: "POST", path: "/_auth/codes/verify" },
|
|
149
|
+
register: { method: "POST", path: "/_auth/register" },
|
|
150
|
+
login: { method: "POST", path: "/_auth/login" },
|
|
151
|
+
logout: { method: "POST", path: "/_auth/logout" },
|
|
152
|
+
rotateKey: { method: "POST", path: "/_auth/keys/rotate" },
|
|
153
|
+
changePassword: { method: "PUT", path: "/_auth/password" },
|
|
154
|
+
getAuthSession: { method: "GET", path: "/_auth/session" },
|
|
155
|
+
getInvitation: { method: "GET", path: "/_auth/invitations/:token" },
|
|
156
|
+
acceptInvitation: { method: "POST", path: "/_auth/invitations/accept" },
|
|
157
|
+
createInvitation: { method: "POST", path: "/_auth/invitations" },
|
|
158
|
+
listInvitations: { method: "GET", path: "/_auth/invitations" },
|
|
159
|
+
cancelInvitation: { method: "POST", path: "/_auth/invitations/cancel" },
|
|
160
|
+
resendInvitation: { method: "POST", path: "/_auth/invitations/resend" },
|
|
161
|
+
deleteInvitation: { method: "POST", path: "/_auth/invitations/delete" },
|
|
162
|
+
getUserProfile: { method: "GET", path: "/_auth/users/profile" },
|
|
163
|
+
updateUserProfile: { method: "PATCH", path: "/_auth/users/profile" }
|
|
164
|
+
};
|
|
165
|
+
|
|
144
166
|
// src/lib/types.ts
|
|
145
167
|
var EMAIL_PATTERN = "^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$";
|
|
146
168
|
var PHONE_PATTERN = "^\\+[1-9]\\d{1,14}$";
|
|
@@ -2941,6 +2963,7 @@ export {
|
|
|
2941
2963
|
UUID_PATTERN,
|
|
2942
2964
|
VERIFICATION_PURPOSES,
|
|
2943
2965
|
VERIFICATION_TARGET_TYPES,
|
|
2944
|
-
authApi
|
|
2966
|
+
authApi,
|
|
2967
|
+
routeMap as authRouteMap
|
|
2945
2968
|
};
|
|
2946
2969
|
//# sourceMappingURL=index.js.map
|