@spfn/auth 0.2.0-beta.53 → 0.2.0-beta.55

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.
@@ -40,6 +40,7 @@ interface AuthSession {
40
40
  email: string | null;
41
41
  emailVerified: boolean;
42
42
  phoneVerified: boolean;
43
+ hasPassword: boolean;
43
44
  role: Role;
44
45
  permissions: Permission[];
45
46
  }
@@ -573,13 +574,14 @@ declare const mainAuthRouter: _spfn_core_route.Router<{
573
574
  id: number;
574
575
  name: string;
575
576
  displayName: string;
576
- category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
577
+ category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
577
578
  }[];
578
579
  userId: number;
579
580
  publicId: string;
580
581
  email: string | null;
581
582
  emailVerified: boolean;
582
583
  phoneVerified: boolean;
584
+ hasPassword: boolean;
583
585
  }>;
584
586
  issueOneTimeToken: _spfn_core_route.RouteDef<{}, {}, IssueOneTimeTokenResult>;
585
587
  oauthGoogleStart: _spfn_core_route.RouteDef<{
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _spfn_core_nextjs from '@spfn/core/nextjs';
2
- import { R as RoleConfig, P as PermissionConfig, C as CheckAccountExistsResult, S as SendVerificationCodeResult, a as RegisterResult, L as LoginResult, b as RotateKeyResult, I as IssueOneTimeTokenResult, O as OAuthStartResult, U as UserProfile, c as ProfileInfo, m as mainAuthRouter } from './authenticate-CVLJS7C7.js';
3
- export { l as AuthInitOptions, A as AuthSession, d as INVITATION_STATUSES, o as InvitationStatus, K as KEY_ALGORITHM, n as KeyAlgorithmType, j as PERMISSION_CATEGORIES, k as PermissionCategory, f as SOCIAL_PROVIDERS, q as SocialProvider, e as USER_STATUSES, p as UserStatus, i as VERIFICATION_PURPOSES, h as VERIFICATION_TARGET_TYPES, g as VerificationPurpose, V as VerificationTargetType } from './authenticate-CVLJS7C7.js';
2
+ import { R as RoleConfig, P as PermissionConfig, C as CheckAccountExistsResult, S as SendVerificationCodeResult, a as RegisterResult, L as LoginResult, b as RotateKeyResult, I as IssueOneTimeTokenResult, O as OAuthStartResult, U as UserProfile, c as ProfileInfo, m as mainAuthRouter } from './authenticate-D11PAt8l.js';
3
+ export { l as AuthInitOptions, A as AuthSession, d as INVITATION_STATUSES, o as InvitationStatus, K as KEY_ALGORITHM, n as KeyAlgorithmType, j as PERMISSION_CATEGORIES, k as PermissionCategory, f as SOCIAL_PROVIDERS, q as SocialProvider, e as USER_STATUSES, p as UserStatus, i as VERIFICATION_PURPOSES, h as VERIFICATION_TARGET_TYPES, g as VerificationPurpose, V as VerificationTargetType } from './authenticate-D11PAt8l.js';
4
4
  import * as _spfn_core_route from '@spfn/core/route';
5
5
  import { HttpMethod } from '@spfn/core/route';
6
6
  import * as _sinclair_typebox from '@sinclair/typebox';
@@ -169,13 +169,14 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
169
169
  id: number;
170
170
  name: string;
171
171
  displayName: string;
172
- category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
172
+ category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
173
173
  }[];
174
174
  userId: number;
175
175
  publicId: string;
176
176
  email: string | null;
177
177
  emailVerified: boolean;
178
178
  phoneVerified: boolean;
179
+ hasPassword: boolean;
179
180
  }>;
180
181
  issueOneTimeToken: _spfn_core_route.RouteDef<{}, {}, IssueOneTimeTokenResult>;
181
182
  oauthGoogleStart: _spfn_core_route.RouteDef<{
@@ -160,6 +160,7 @@ declare function getAuthSessionData(): Promise<{
160
160
  email: string | null;
161
161
  emailVerified: boolean;
162
162
  phoneVerified: boolean;
163
+ hasPassword: boolean;
163
164
  } | null>;
164
165
  /**
165
166
  * Get user role
package/dist/server.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { l as AuthInitOptions, n as KeyAlgorithmType, o as InvitationStatus, g as VerificationPurpose, k as PermissionCategory, q as SocialProvider, r as AuthContext } from './authenticate-CVLJS7C7.js';
2
- export { D as ChangePasswordParams, x as CheckAccountExistsParams, C as CheckAccountExistsResult, a9 as EmailSchema, d as INVITATION_STATUSES, I as IssueOneTimeTokenResult, K as KEY_ALGORITHM, z as LoginParams, L as LoginResult, B as LogoutParams, a5 as OAuthCallbackParams, a6 as OAuthCallbackResult, a4 as OAuthStartParams, O as OAuthStartResult, ab as PasswordSchema, aa as PhoneSchema, y as RegisterParams, T as RegisterPublicKeyParams, a as RegisterResult, X as RevokeKeyParams, W as RotateKeyParams, b as RotateKeyResult, f as SOCIAL_PROVIDERS, G as SendVerificationCodeParams, S as SendVerificationCodeResult, ac as TargetTypeSchema, e as USER_STATUSES, p as UserStatus, i as VERIFICATION_PURPOSES, h as VERIFICATION_TARGET_TYPES, ad as VerificationPurposeSchema, V as VerificationTargetType, H as VerifyCodeParams, J as VerifyCodeResult, m as authRouter, a7 as authenticate, a0 as buildOAuthErrorUrl, w as changePasswordService, s as checkAccountExistsService, a2 as getEnabledOAuthProviders, a3 as getGoogleAccessToken, a1 as isOAuthProviderEnabled, Y as issueOneTimeTokenService, u as loginService, v as logoutService, $ as oauthCallbackService, _ as oauthStartService, a8 as optionalAuth, M as registerPublicKeyService, t as registerService, Q as revokeKeyService, N as rotateKeyService, E as sendVerificationCodeService, F as verifyCodeService, Z as verifyOneTimeTokenService } from './authenticate-CVLJS7C7.js';
1
+ import { l as AuthInitOptions, n as KeyAlgorithmType, o as InvitationStatus, g as VerificationPurpose, k as PermissionCategory, q as SocialProvider, r as AuthContext } from './authenticate-D11PAt8l.js';
2
+ export { D as ChangePasswordParams, x as CheckAccountExistsParams, C as CheckAccountExistsResult, a9 as EmailSchema, d as INVITATION_STATUSES, I as IssueOneTimeTokenResult, K as KEY_ALGORITHM, z as LoginParams, L as LoginResult, B as LogoutParams, a5 as OAuthCallbackParams, a6 as OAuthCallbackResult, a4 as OAuthStartParams, O as OAuthStartResult, ab as PasswordSchema, aa as PhoneSchema, y as RegisterParams, T as RegisterPublicKeyParams, a as RegisterResult, X as RevokeKeyParams, W as RotateKeyParams, b as RotateKeyResult, f as SOCIAL_PROVIDERS, G as SendVerificationCodeParams, S as SendVerificationCodeResult, ac as TargetTypeSchema, e as USER_STATUSES, p as UserStatus, i as VERIFICATION_PURPOSES, h as VERIFICATION_TARGET_TYPES, ad as VerificationPurposeSchema, V as VerificationTargetType, H as VerifyCodeParams, J as VerifyCodeResult, m as authRouter, a7 as authenticate, a0 as buildOAuthErrorUrl, w as changePasswordService, s as checkAccountExistsService, a2 as getEnabledOAuthProviders, a3 as getGoogleAccessToken, a1 as isOAuthProviderEnabled, Y as issueOneTimeTokenService, u as loginService, v as logoutService, $ as oauthCallbackService, _ as oauthStartService, a8 as optionalAuth, M as registerPublicKeyService, t as registerService, Q as revokeKeyService, N as rotateKeyService, E as sendVerificationCodeService, F as verifyCodeService, Z as verifyOneTimeTokenService } from './authenticate-D11PAt8l.js';
3
3
  import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
4
4
  import { UserProfile as UserProfile$1, ProfileInfo } from '@spfn/auth';
5
5
  import { BaseRepository } from '@spfn/core/db';
6
6
  import { Context } from 'hono';
7
7
  import * as _spfn_core_route from '@spfn/core/route';
8
8
  import { Algorithm } from 'jsonwebtoken';
9
- import { SSETokenManager } from '@spfn/core/event/sse';
9
+ import { SSETokenStore, SSETokenManager } from '@spfn/core/event/sse';
10
10
  import * as _spfn_core_logger from '@spfn/core/logger';
11
11
  import * as _spfn_core_event from '@spfn/core/event';
12
12
  import * as _sinclair_typebox from '@sinclair/typebox';
@@ -1330,13 +1330,14 @@ declare function getAuthSessionService(userId: string | number | bigint): Promis
1330
1330
  id: number;
1331
1331
  name: string;
1332
1332
  displayName: string;
1333
- category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
1333
+ category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
1334
1334
  }[];
1335
1335
  userId: number;
1336
1336
  publicId: string;
1337
1337
  email: string | null;
1338
1338
  emailVerified: boolean;
1339
1339
  phoneVerified: boolean;
1340
+ hasPassword: boolean;
1340
1341
  }>;
1341
1342
 
1342
1343
  /**
@@ -2470,7 +2471,7 @@ declare const permissions: drizzle_orm_pg_core.PgTableWithColumns<{
2470
2471
  tableName: "permissions";
2471
2472
  dataType: "string";
2472
2473
  columnType: "PgText";
2473
- data: "custom" | "user" | "auth" | "rbac" | "system";
2474
+ data: "auth" | "custom" | "user" | "rbac" | "system";
2474
2475
  driverParam: string;
2475
2476
  notNull: false;
2476
2477
  hasDefault: false;
@@ -3061,17 +3062,17 @@ declare class UsersRepository extends BaseRepository {
3061
3062
  * Write primary 사용
3062
3063
  */
3063
3064
  create(data: NewUser): Promise<{
3064
- username: string | null;
3065
- status: "active" | "inactive" | "suspended";
3066
3065
  email: string | null;
3067
3066
  phone: string | null;
3068
3067
  id: number;
3069
- createdAt: Date;
3070
- updatedAt: Date;
3071
3068
  publicId: string;
3069
+ username: string | null;
3072
3070
  passwordHash: string | null;
3073
3071
  passwordChangeRequired: boolean;
3074
3072
  roleId: number;
3073
+ createdAt: Date;
3074
+ updatedAt: Date;
3075
+ status: "active" | "inactive" | "suspended";
3075
3076
  emailVerifiedAt: Date | null;
3076
3077
  phoneVerifiedAt: Date | null;
3077
3078
  lastLoginAt: Date | null;
@@ -3141,17 +3142,17 @@ declare class UsersRepository extends BaseRepository {
3141
3142
  * Write primary 사용
3142
3143
  */
3143
3144
  deleteById(id: number): Promise<{
3144
- username: string | null;
3145
- status: "active" | "inactive" | "suspended";
3146
3145
  email: string | null;
3147
3146
  phone: string | null;
3148
3147
  id: number;
3149
- createdAt: Date;
3150
- updatedAt: Date;
3151
3148
  publicId: string;
3149
+ username: string | null;
3152
3150
  passwordHash: string | null;
3153
3151
  passwordChangeRequired: boolean;
3154
3152
  roleId: number;
3153
+ createdAt: Date;
3154
+ updatedAt: Date;
3155
+ status: "active" | "inactive" | "suspended";
3155
3156
  emailVerifiedAt: Date | null;
3156
3157
  phoneVerifiedAt: Date | null;
3157
3158
  lastLoginAt: Date | null;
@@ -3174,7 +3175,7 @@ declare class UsersRepository extends BaseRepository {
3174
3175
  id: number;
3175
3176
  name: string;
3176
3177
  displayName: string;
3177
- category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
3178
+ category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
3178
3179
  }[];
3179
3180
  }>;
3180
3181
  /**
@@ -3191,6 +3192,7 @@ declare class UsersRepository extends BaseRepository {
3191
3192
  username: string | null;
3192
3193
  isEmailVerified: boolean;
3193
3194
  isPhoneVerified: boolean;
3195
+ hasPassword: boolean;
3194
3196
  }>;
3195
3197
  /**
3196
3198
  * Full user data 조회 (user profile용)
@@ -3288,16 +3290,16 @@ declare class KeysRepository extends BaseRepository {
3288
3290
  * Write primary 사용
3289
3291
  */
3290
3292
  create(data: NewUserPublicKey): Promise<{
3291
- userId: number;
3293
+ publicKey: string;
3292
3294
  keyId: string;
3295
+ fingerprint: string;
3296
+ algorithm: "ES256" | "RS256";
3297
+ userId: number;
3293
3298
  id: number;
3294
3299
  isActive: boolean;
3295
3300
  createdAt: Date;
3296
- publicKey: string;
3297
- algorithm: "ES256" | "RS256";
3298
- fingerprint: string;
3299
- lastUsedAt: Date | null;
3300
3301
  expiresAt: Date | null;
3302
+ lastUsedAt: Date | null;
3301
3303
  revokedAt: Date | null;
3302
3304
  revokedReason: string | null;
3303
3305
  }>;
@@ -3324,16 +3326,16 @@ declare class KeysRepository extends BaseRepository {
3324
3326
  * Write primary 사용
3325
3327
  */
3326
3328
  deleteByKeyIdAndUserId(keyId: string, userId: number): Promise<{
3327
- userId: number;
3329
+ publicKey: string;
3328
3330
  keyId: string;
3331
+ fingerprint: string;
3332
+ algorithm: "ES256" | "RS256";
3333
+ userId: number;
3329
3334
  id: number;
3330
3335
  isActive: boolean;
3331
3336
  createdAt: Date;
3332
- publicKey: string;
3333
- algorithm: "ES256" | "RS256";
3334
- fingerprint: string;
3335
- lastUsedAt: Date | null;
3336
3337
  expiresAt: Date | null;
3338
+ lastUsedAt: Date | null;
3337
3339
  revokedAt: Date | null;
3338
3340
  revokedReason: string | null;
3339
3341
  }>;
@@ -3448,14 +3450,14 @@ declare class VerificationCodesRepository extends BaseRepository {
3448
3450
  * Write primary 사용
3449
3451
  */
3450
3452
  create(data: NewVerificationCode): Promise<{
3453
+ target: string;
3454
+ targetType: "email" | "phone";
3455
+ purpose: "registration" | "login" | "password_reset" | "email_change" | "phone_change";
3456
+ code: string;
3451
3457
  id: number;
3452
3458
  createdAt: Date;
3453
3459
  updatedAt: Date;
3454
3460
  expiresAt: Date;
3455
- target: string;
3456
- targetType: "email" | "phone";
3457
- code: string;
3458
- purpose: "registration" | "login" | "password_reset" | "email_change" | "phone_change";
3459
3461
  usedAt: Date | null;
3460
3462
  attempts: number;
3461
3463
  }>;
@@ -3644,7 +3646,7 @@ declare class PermissionsRepository extends BaseRepository {
3644
3646
  name: string;
3645
3647
  displayName: string;
3646
3648
  description: string | null;
3647
- category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3649
+ category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3648
3650
  isBuiltin: boolean;
3649
3651
  isSystem: boolean;
3650
3652
  isActive: boolean;
@@ -3660,7 +3662,7 @@ declare class PermissionsRepository extends BaseRepository {
3660
3662
  name: string;
3661
3663
  displayName: string;
3662
3664
  description: string | null;
3663
- category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3665
+ category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3664
3666
  isBuiltin: boolean;
3665
3667
  isSystem: boolean;
3666
3668
  isActive: boolean;
@@ -3700,7 +3702,7 @@ declare class PermissionsRepository extends BaseRepository {
3700
3702
  name: string;
3701
3703
  displayName: string;
3702
3704
  description: string | null;
3703
- category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3705
+ category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3704
3706
  isBuiltin: boolean;
3705
3707
  isSystem: boolean;
3706
3708
  isActive: boolean;
@@ -3711,6 +3713,7 @@ declare class PermissionsRepository extends BaseRepository {
3711
3713
  */
3712
3714
  deleteById(id: number): Promise<{
3713
3715
  description: string | null;
3716
+ metadata: Record<string, any> | null;
3714
3717
  id: number;
3715
3718
  name: string;
3716
3719
  displayName: string;
@@ -3719,8 +3722,7 @@ declare class PermissionsRepository extends BaseRepository {
3719
3722
  isActive: boolean;
3720
3723
  createdAt: Date;
3721
3724
  updatedAt: Date;
3722
- metadata: Record<string, any> | null;
3723
- category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3725
+ category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3724
3726
  }>;
3725
3727
  }
3726
3728
  declare const permissionsRepository: PermissionsRepository;
@@ -3765,9 +3767,9 @@ declare class RolePermissionsRepository extends BaseRepository {
3765
3767
  */
3766
3768
  createMany(data: NewRolePermission[]): Promise<{
3767
3769
  id: number;
3770
+ roleId: number;
3768
3771
  createdAt: Date;
3769
3772
  updatedAt: Date;
3770
- roleId: number;
3771
3773
  permissionId: number;
3772
3774
  }[]>;
3773
3775
  /**
@@ -3783,9 +3785,9 @@ declare class RolePermissionsRepository extends BaseRepository {
3783
3785
  */
3784
3786
  setPermissionsForRole(roleId: number, permissionIds: number[]): Promise<{
3785
3787
  id: number;
3788
+ roleId: number;
3786
3789
  createdAt: Date;
3787
3790
  updatedAt: Date;
3788
- roleId: number;
3789
3791
  permissionId: number;
3790
3792
  }[]>;
3791
3793
  }
@@ -3850,10 +3852,10 @@ declare class UserPermissionsRepository extends BaseRepository {
3850
3852
  id: number;
3851
3853
  createdAt: Date;
3852
3854
  updatedAt: Date;
3853
- expiresAt: Date | null;
3854
3855
  permissionId: number;
3855
- granted: boolean;
3856
+ expiresAt: Date | null;
3856
3857
  reason: string | null;
3858
+ granted: boolean;
3857
3859
  }>;
3858
3860
  /**
3859
3861
  * 사용자 권한 오버라이드 업데이트
@@ -3876,10 +3878,10 @@ declare class UserPermissionsRepository extends BaseRepository {
3876
3878
  id: number;
3877
3879
  createdAt: Date;
3878
3880
  updatedAt: Date;
3879
- expiresAt: Date | null;
3880
3881
  permissionId: number;
3881
- granted: boolean;
3882
+ expiresAt: Date | null;
3882
3883
  reason: string | null;
3884
+ granted: boolean;
3883
3885
  }>;
3884
3886
  /**
3885
3887
  * 사용자의 모든 권한 오버라이드 삭제
@@ -3957,6 +3959,7 @@ declare class UserProfilesRepository extends BaseRepository {
3957
3959
  * 프로필 생성
3958
3960
  */
3959
3961
  create(data: NewUserProfile): Promise<{
3962
+ metadata: Record<string, any> | null;
3960
3963
  userId: number;
3961
3964
  id: number;
3962
3965
  displayName: string | null;
@@ -3974,7 +3977,6 @@ declare class UserProfilesRepository extends BaseRepository {
3974
3977
  location: string | null;
3975
3978
  company: string | null;
3976
3979
  jobTitle: string | null;
3977
- metadata: Record<string, any> | null;
3978
3980
  }>;
3979
3981
  /**
3980
3982
  * 프로필 업데이트 (by ID)
@@ -4026,6 +4028,7 @@ declare class UserProfilesRepository extends BaseRepository {
4026
4028
  * 프로필 삭제 (by ID)
4027
4029
  */
4028
4030
  deleteById(id: number): Promise<{
4031
+ metadata: Record<string, any> | null;
4029
4032
  userId: number;
4030
4033
  id: number;
4031
4034
  displayName: string | null;
@@ -4043,12 +4046,12 @@ declare class UserProfilesRepository extends BaseRepository {
4043
4046
  location: string | null;
4044
4047
  company: string | null;
4045
4048
  jobTitle: string | null;
4046
- metadata: Record<string, any> | null;
4047
4049
  }>;
4048
4050
  /**
4049
4051
  * 프로필 삭제 (by User ID)
4050
4052
  */
4051
4053
  deleteByUserId(userId: number): Promise<{
4054
+ metadata: Record<string, any> | null;
4052
4055
  userId: number;
4053
4056
  id: number;
4054
4057
  displayName: string | null;
@@ -4066,7 +4069,6 @@ declare class UserProfilesRepository extends BaseRepository {
4066
4069
  location: string | null;
4067
4070
  company: string | null;
4068
4071
  jobTitle: string | null;
4069
- metadata: Record<string, any> | null;
4070
4072
  }>;
4071
4073
  /**
4072
4074
  * 프로필 Upsert (by User ID)
@@ -4075,6 +4077,7 @@ declare class UserProfilesRepository extends BaseRepository {
4075
4077
  * 새로 생성 시 displayName은 필수 (없으면 'User'로 설정)
4076
4078
  */
4077
4079
  upsertByUserId(userId: number, data: Partial<Omit<NewUserProfile, 'userId'>>): Promise<{
4080
+ metadata: Record<string, any> | null;
4078
4081
  userId: number;
4079
4082
  id: number;
4080
4083
  displayName: string | null;
@@ -4092,7 +4095,6 @@ declare class UserProfilesRepository extends BaseRepository {
4092
4095
  location: string | null;
4093
4096
  company: string | null;
4094
4097
  jobTitle: string | null;
4095
- metadata: Record<string, any> | null;
4096
4098
  }>;
4097
4099
  /**
4098
4100
  * User ID로 프로필 데이터 조회 (formatted)
@@ -4219,16 +4221,16 @@ declare class InvitationsRepository extends BaseRepository {
4219
4221
  * 초대 생성
4220
4222
  */
4221
4223
  create(data: NewInvitation): Promise<{
4222
- status: "pending" | "accepted" | "expired" | "cancelled";
4223
4224
  email: string;
4225
+ metadata: Record<string, any> | null;
4224
4226
  id: number;
4227
+ roleId: number;
4225
4228
  createdAt: Date;
4226
4229
  updatedAt: Date;
4227
- roleId: number;
4228
- metadata: Record<string, any> | null;
4229
- expiresAt: Date;
4230
+ status: "pending" | "accepted" | "expired" | "cancelled";
4230
4231
  token: string;
4231
4232
  invitedBy: number;
4233
+ expiresAt: Date;
4232
4234
  acceptedAt: Date | null;
4233
4235
  cancelledAt: Date | null;
4234
4236
  }>;
@@ -4253,16 +4255,16 @@ declare class InvitationsRepository extends BaseRepository {
4253
4255
  * 초대 삭제
4254
4256
  */
4255
4257
  deleteById(id: number): Promise<{
4256
- status: "pending" | "accepted" | "expired" | "cancelled";
4257
4258
  email: string;
4259
+ metadata: Record<string, any> | null;
4258
4260
  id: number;
4261
+ roleId: number;
4259
4262
  createdAt: Date;
4260
4263
  updatedAt: Date;
4261
- roleId: number;
4262
- metadata: Record<string, any> | null;
4263
- expiresAt: Date;
4264
+ status: "pending" | "accepted" | "expired" | "cancelled";
4264
4265
  token: string;
4265
4266
  invitedBy: number;
4267
+ expiresAt: Date;
4266
4268
  acceptedAt: Date | null;
4267
4269
  cancelledAt: Date | null;
4268
4270
  }>;
@@ -4969,17 +4971,17 @@ declare function getOptionalAuth(c: Context | {
4969
4971
  declare function getUser(c: Context | {
4970
4972
  raw: Context;
4971
4973
  }): {
4972
- username: string | null;
4973
- status: "active" | "inactive" | "suspended";
4974
4974
  email: string | null;
4975
4975
  phone: string | null;
4976
4976
  id: number;
4977
- createdAt: Date;
4978
- updatedAt: Date;
4979
4977
  publicId: string;
4978
+ username: string | null;
4980
4979
  passwordHash: string | null;
4981
4980
  passwordChangeRequired: boolean;
4982
4981
  roleId: number;
4982
+ createdAt: Date;
4983
+ updatedAt: Date;
4984
+ status: "active" | "inactive" | "suspended";
4983
4985
  emailVerifiedAt: Date | null;
4984
4986
  phoneVerifiedAt: Date | null;
4985
4987
  lastLoginAt: Date | null;
@@ -5351,9 +5353,11 @@ declare function verifyOAuthState(encryptedState: string): Promise<OAuthState>;
5351
5353
  *
5352
5354
  * @param config - Optional configuration
5353
5355
  * @param config.ttl - Token time-to-live in milliseconds (default: 30000)
5356
+ * @param config.store - Custom token store (e.g., CacheTokenStore for Redis)
5354
5357
  */
5355
5358
  declare function initOneTimeTokenManager(config?: {
5356
5359
  ttl?: number;
5360
+ store?: SSETokenStore;
5357
5361
  }): void;
5358
5362
  /**
5359
5363
  * Get the one-time token manager instance
@@ -5493,6 +5497,26 @@ interface AuthLifecycleOptions extends AuthInitOptions {
5493
5497
  * @default 30000
5494
5498
  */
5495
5499
  ttl?: number;
5500
+ /**
5501
+ * Custom token store (e.g., CacheTokenStore for Redis/Valkey)
5502
+ *
5503
+ * When provided, tokens are stored in the external store instead of in-memory Map.
5504
+ * Required for multi-instance deployments where token issuance and verification
5505
+ * may happen on different server instances.
5506
+ *
5507
+ * @example
5508
+ * ```typescript
5509
+ * import { CacheTokenStore } from '@spfn/core/event/sse';
5510
+ * import { getCache } from '@spfn/core/cache';
5511
+ *
5512
+ * createAuthLifecycle({
5513
+ * oneTimeToken: {
5514
+ * store: new CacheTokenStore(getCache()),
5515
+ * },
5516
+ * })
5517
+ * ```
5518
+ */
5519
+ store?: SSETokenStore;
5496
5520
  };
5497
5521
  }
5498
5522
  declare function createAuthLifecycle(options?: AuthLifecycleOptions): AuthLifecycleConfig;
@@ -5577,9 +5601,9 @@ declare const invitationCreatedEvent: _spfn_core_event.EventDef<{
5577
5601
  } | undefined;
5578
5602
  email: string;
5579
5603
  roleId: number;
5580
- expiresAt: string;
5581
5604
  token: string;
5582
5605
  invitedBy: string;
5606
+ expiresAt: string;
5583
5607
  invitationId: string;
5584
5608
  isResend: boolean;
5585
5609
  }>;
package/dist/server.js CHANGED
@@ -5533,7 +5533,8 @@ var init_users_repository = __esm({
5533
5533
  email: users.email,
5534
5534
  username: users.username,
5535
5535
  emailVerifiedAt: users.emailVerifiedAt,
5536
- phoneVerifiedAt: users.phoneVerifiedAt
5536
+ phoneVerifiedAt: users.phoneVerifiedAt,
5537
+ passwordHash: users.passwordHash
5537
5538
  }).from(users).where(eq(users.id, userId)).limit(1).then((rows) => rows[0] ?? null);
5538
5539
  if (!user) {
5539
5540
  throw new NotFoundError({ message: "[@spfn/auth] User not found" });
@@ -5544,7 +5545,8 @@ var init_users_repository = __esm({
5544
5545
  email: user.email,
5545
5546
  username: user.username,
5546
5547
  isEmailVerified: !!user.emailVerifiedAt,
5547
- isPhoneVerified: !!user.phoneVerifiedAt
5548
+ isPhoneVerified: !!user.phoneVerifiedAt,
5549
+ hasPassword: !!user.passwordHash
5548
5550
  };
5549
5551
  }
5550
5552
  /**
@@ -7897,6 +7899,7 @@ async function getAuthSessionService(userId) {
7897
7899
  email: user.email,
7898
7900
  emailVerified: user.isEmailVerified,
7899
7901
  phoneVerified: user.isPhoneVerified,
7902
+ hasPassword: user.hasPassword,
7900
7903
  ...roleAndPerms
7901
7904
  };
7902
7905
  }
@@ -7909,7 +7912,8 @@ function initOneTimeTokenManager(config) {
7909
7912
  manager.destroy();
7910
7913
  }
7911
7914
  manager = new SSETokenManager({
7912
- ttl: config?.ttl
7915
+ ttl: config?.ttl,
7916
+ store: config?.store
7913
7917
  });
7914
7918
  }
7915
7919
  function getOneTimeTokenManager() {