@spfn/auth 0.2.0-beta.61 → 0.2.0-beta.64

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/dist/server.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { i as AuthInitOptions, d as VerificationPurpose, h as PermissionCategory, j as AuthContext } from './authenticate-B_HkYBzq.js';
2
- export { u as ChangePasswordParams, p as CheckAccountExistsParams, C as CheckAccountExistsResult, a1 as EmailSchema, I as IssueOneTimeTokenResult, s as LoginParams, L as LoginResult, t as LogoutParams, Z as OAuthCallbackParams, _ as OAuthCallbackResult, Y as OAuthStartParams, O as OAuthStartResult, a3 as PasswordSchema, a2 as PhoneSchema, q as RegisterParams, F as RegisterPublicKeyParams, a as RegisterResult, H as RevokeKeyParams, G as RotateKeyParams, b as RotateKeyResult, x as SendVerificationCodeParams, S as SendVerificationCodeResult, a4 as TargetTypeSchema, f as VERIFICATION_PURPOSES, e as VERIFICATION_TARGET_TYPES, a5 as VerificationPurposeSchema, V as VerificationTargetType, y as VerifyCodeParams, z as VerifyCodeResult, m as authRouter, $ as authenticate, Q as buildOAuthErrorUrl, o as changePasswordService, k as checkAccountExistsService, W as getEnabledOAuthProviders, X as getGoogleAccessToken, T as isOAuthProviderEnabled, J as issueOneTimeTokenService, l as loginService, n as logoutService, N as oauthCallbackService, M as oauthStartService, a0 as optionalAuth, B as registerPublicKeyService, r as registerService, E as revokeKeyService, D as rotateKeyService, v as sendVerificationCodeService, w as verifyCodeService, K as verifyOneTimeTokenService } from './authenticate-B_HkYBzq.js';
1
+ import { i as AuthInitOptions, j as OAuthProvider, d as VerificationPurpose, h as PermissionCategory, k as AuthContext } from './authenticate-mfVRzeIK.js';
2
+ export { v as ChangePasswordParams, q as CheckAccountExistsParams, C as CheckAccountExistsResult, a3 as EmailSchema, I as IssueOneTimeTokenResult, t as LoginParams, L as LoginResult, u as LogoutParams, a8 as NormalizedIdentity, $ as OAuthCallbackParams, a0 as OAuthCallbackResult, _ as OAuthStartParams, O as OAuthStartResult, a9 as OAuthTokens, a5 as PasswordSchema, a4 as PhoneSchema, s as RegisterParams, G as RegisterPublicKeyParams, a as RegisterResult, J as RevokeKeyParams, H as RotateKeyParams, b as RotateKeyResult, y as SendVerificationCodeParams, S as SendVerificationCodeResult, a6 as TargetTypeSchema, f as VERIFICATION_PURPOSES, e as VERIFICATION_TARGET_TYPES, a7 as VerificationPurposeSchema, V as VerificationTargetType, z as VerifyCodeParams, B as VerifyCodeResult, m as authRouter, a1 as authenticate, T as buildOAuthErrorUrl, p as changePasswordService, l as checkAccountExistsService, Y as getEnabledOAuthProviders, Z as getGoogleAccessToken, ab as getOAuthProvider, ac as getRegisteredProviders, W as isOAuthProviderEnabled, K as issueOneTimeTokenService, n as loginService, o as logoutService, Q as oauthCallbackService, N as oauthStartService, a2 as optionalAuth, aa as registerOAuthProvider, D as registerPublicKeyService, r as registerService, X as requireEnabledProvider, F as revokeKeyService, E as rotateKeyService, w as sendVerificationCodeService, x as verifyCodeService, M as verifyOneTimeTokenService } from './authenticate-mfVRzeIK.js';
3
3
  import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
4
- import { K as KeyAlgorithmType, b as InvitationStatus, d as SocialProvider } from './types-B1CzVZkU.js';
5
- export { I as INVITATION_STATUSES, a as KEY_ALGORITHM, S as SOCIAL_PROVIDERS, U as USER_STATUSES, c as UserStatus } from './types-B1CzVZkU.js';
4
+ import { K as KeyAlgorithmType, b as InvitationStatus, d as SocialProvider } from './types-B4auHIax.js';
5
+ export { I as INVITATION_STATUSES, a as KEY_ALGORITHM, S as SOCIAL_PROVIDERS, U as USER_STATUSES, c as UserStatus } from './types-B4auHIax.js';
6
6
  import { UserProfile as UserProfile$1, ProfileInfo } from '@spfn/auth';
7
7
  import { BaseRepository } from '@spfn/core/db';
8
8
  import { Context } from 'hono';
9
9
  import * as _spfn_core_route from '@spfn/core/route';
10
10
  import { Algorithm } from 'jsonwebtoken';
11
- export { S as SessionData, g as getSessionInfo, s as sealSession, a as shouldRefreshSession, u as unsealSession } from './session-Dbvz9Sdp.js';
11
+ export { S as SessionData, g as getSessionInfo, s as sealSession, a as shouldRefreshSession, u as unsealSession } from './session-2CyIVxMY.js';
12
12
  import { SSETokenStore, SSETokenManager } from '@spfn/core/event/sse';
13
13
  import * as _spfn_core_logger from '@spfn/core/logger';
14
14
  import * as _spfn_core_event from '@spfn/core/event';
@@ -1333,7 +1333,7 @@ declare function getAuthSessionService(userId: string | number | bigint): Promis
1333
1333
  id: number;
1334
1334
  name: string;
1335
1335
  displayName: string;
1336
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
1336
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
1337
1337
  }[];
1338
1338
  userId: number;
1339
1339
  publicId: string;
@@ -1416,6 +1416,127 @@ declare function updateLocaleService(userId: string | number | bigint, locale: s
1416
1416
  */
1417
1417
  declare function updateUserProfileService(userId: string | number | bigint, params: UpdateProfileParams): Promise<ProfileInfo>;
1418
1418
 
1419
+ /**
1420
+ * Google OAuth 2.0 Client
1421
+ *
1422
+ * Authorization Code Flow 구현
1423
+ * - getGoogleAuthUrl: Google 로그인 URL 생성
1424
+ * - exchangeCodeForTokens: Code를 Token으로 교환
1425
+ * - getGoogleUserInfo: 사용자 정보 조회
1426
+ */
1427
+ interface GoogleTokenResponse {
1428
+ access_token: string;
1429
+ expires_in: number;
1430
+ refresh_token?: string;
1431
+ scope: string;
1432
+ token_type: string;
1433
+ id_token?: string;
1434
+ }
1435
+ interface GoogleUserInfo {
1436
+ id: string;
1437
+ email: string;
1438
+ verified_email: boolean;
1439
+ name?: string;
1440
+ given_name?: string;
1441
+ family_name?: string;
1442
+ picture?: string;
1443
+ locale?: string;
1444
+ }
1445
+ /**
1446
+ * Google OAuth가 활성화되어 있는지 확인
1447
+ */
1448
+ declare function isGoogleOAuthEnabled(): boolean;
1449
+ /**
1450
+ * Google OAuth 설정 가져오기
1451
+ */
1452
+ declare function getGoogleOAuthConfig(): {
1453
+ clientId: string;
1454
+ clientSecret: string;
1455
+ redirectUri: string;
1456
+ };
1457
+ /**
1458
+ * Google 로그인 URL 생성
1459
+ *
1460
+ * @param state - CSRF 방지용 state 파라미터 (암호화된 returnUrl + nonce 포함)
1461
+ * @param scopes - 요청할 OAuth scopes (기본: env 또는 email, profile)
1462
+ */
1463
+ declare function getGoogleAuthUrl(state: string, scopes?: string[]): string;
1464
+ /**
1465
+ * Authorization Code를 Token으로 교환
1466
+ *
1467
+ * @param code - Google에서 받은 authorization code
1468
+ */
1469
+ declare function exchangeCodeForTokens(code: string): Promise<GoogleTokenResponse>;
1470
+ /**
1471
+ * Access Token으로 Google 사용자 정보 조회
1472
+ *
1473
+ * @param accessToken - Google access token
1474
+ */
1475
+ declare function getGoogleUserInfo(accessToken: string): Promise<GoogleUserInfo>;
1476
+ /**
1477
+ * Refresh Token으로 새 Access Token 획득
1478
+ *
1479
+ * @param refreshToken - Google refresh token
1480
+ */
1481
+ declare function refreshAccessToken(refreshToken: string): Promise<GoogleTokenResponse>;
1482
+
1483
+ /**
1484
+ * OAuth State Management
1485
+ *
1486
+ * CSRF 방지를 위한 state 파라미터 암호화/복호화
1487
+ * - returnUrl: OAuth 성공 후 리다이렉트할 URL
1488
+ * - nonce: CSRF 방지용 일회용 토큰
1489
+ * - provider: OAuth provider (google, github 등)
1490
+ * - publicKey, keyId, fingerprint, algorithm: 클라이언트 키 정보
1491
+ * - expiresAt: state 만료 시간
1492
+ */
1493
+
1494
+ interface OAuthState {
1495
+ returnUrl: string;
1496
+ nonce: string;
1497
+ provider: string;
1498
+ publicKey: string;
1499
+ keyId: string;
1500
+ fingerprint: string;
1501
+ algorithm: KeyAlgorithmType;
1502
+ metadata?: Record<string, unknown>;
1503
+ }
1504
+ interface CreateOAuthStateParams {
1505
+ provider: string;
1506
+ returnUrl: string;
1507
+ publicKey: string;
1508
+ keyId: string;
1509
+ fingerprint: string;
1510
+ algorithm: KeyAlgorithmType;
1511
+ metadata?: Record<string, unknown>;
1512
+ }
1513
+ /**
1514
+ * OAuth state 생성 및 암호화
1515
+ *
1516
+ * @param params - state 생성에 필요한 파라미터
1517
+ * @returns 암호화된 state 문자열
1518
+ */
1519
+ declare function createOAuthState(params: CreateOAuthStateParams): Promise<string>;
1520
+ /**
1521
+ * OAuth state 복호화 및 검증
1522
+ *
1523
+ * @param encryptedState - 암호화된 state 문자열
1524
+ * @returns 복호화된 state 객체
1525
+ * @throws Error if state is invalid or expired (JWE exp claim으로 자동 검증)
1526
+ */
1527
+ declare function verifyOAuthState(encryptedState: string): Promise<OAuthState>;
1528
+
1529
+ /**
1530
+ * Google OAuthProvider 구현
1531
+ *
1532
+ * 기존 google.ts의 함수를 OAuthProvider 인터페이스로 래핑한다.
1533
+ * google.ts 자체는 그대로 유지(테스트·google 전용 route가 직접 의존).
1534
+ *
1535
+ * 이 모듈을 import 하는 것만으로 google provider가 registry에 자기 등록된다.
1536
+ */
1537
+
1538
+ declare const googleProvider: OAuthProvider;
1539
+
1419
1540
  /**
1420
1541
  * @spfn/auth - Database Schema Definition
1421
1542
  *
@@ -2063,14 +2184,14 @@ declare const userSocialAccounts: drizzle_orm_pg_core.PgTableWithColumns<{
2063
2184
  tableName: "user_social_accounts";
2064
2185
  dataType: "string";
2065
2186
  columnType: "PgText";
2066
- data: "google" | "github" | "kakao" | "naver";
2187
+ data: "google" | "github" | "kakao" | "naver" | "superself";
2067
2188
  driverParam: string;
2068
2189
  notNull: true;
2069
2190
  hasDefault: false;
2070
2191
  isPrimaryKey: false;
2071
2192
  isAutoincrement: false;
2072
2193
  hasRuntimeDefault: false;
2073
- enumValues: ["google", "github", "kakao", "naver"] & [string, ...string[]];
2194
+ enumValues: ["google", "github", "kakao", "naver", "superself"] & [string, ...string[]];
2074
2195
  baseColumn: never;
2075
2196
  identity: undefined;
2076
2197
  generated: undefined;
@@ -2474,7 +2595,7 @@ declare const permissions: drizzle_orm_pg_core.PgTableWithColumns<{
2474
2595
  tableName: "permissions";
2475
2596
  dataType: "string";
2476
2597
  columnType: "PgText";
2477
- data: "auth" | "custom" | "user" | "rbac" | "system";
2598
+ data: "custom" | "user" | "auth" | "rbac" | "system";
2478
2599
  driverParam: string;
2479
2600
  notNull: false;
2480
2601
  hasDefault: false;
@@ -3067,15 +3188,15 @@ declare class UsersRepository extends BaseRepository {
3067
3188
  create(data: NewUser): Promise<{
3068
3189
  email: string | null;
3069
3190
  phone: string | null;
3191
+ status: "active" | "inactive" | "suspended";
3192
+ username: string | null;
3070
3193
  id: number;
3194
+ createdAt: Date;
3195
+ updatedAt: Date;
3071
3196
  publicId: string;
3072
- username: string | null;
3073
3197
  passwordHash: string | null;
3074
3198
  passwordChangeRequired: boolean;
3075
3199
  roleId: number;
3076
- createdAt: Date;
3077
- updatedAt: Date;
3078
- status: "active" | "inactive" | "suspended";
3079
3200
  emailVerifiedAt: Date | null;
3080
3201
  phoneVerifiedAt: Date | null;
3081
3202
  lastLoginAt: Date | null;
@@ -3147,15 +3268,15 @@ declare class UsersRepository extends BaseRepository {
3147
3268
  deleteById(id: number): Promise<{
3148
3269
  email: string | null;
3149
3270
  phone: string | null;
3271
+ status: "active" | "inactive" | "suspended";
3272
+ username: string | null;
3150
3273
  id: number;
3274
+ createdAt: Date;
3275
+ updatedAt: Date;
3151
3276
  publicId: string;
3152
- username: string | null;
3153
3277
  passwordHash: string | null;
3154
3278
  passwordChangeRequired: boolean;
3155
3279
  roleId: number;
3156
- createdAt: Date;
3157
- updatedAt: Date;
3158
- status: "active" | "inactive" | "suspended";
3159
3280
  emailVerifiedAt: Date | null;
3160
3281
  phoneVerifiedAt: Date | null;
3161
3282
  lastLoginAt: Date | null;
@@ -3178,7 +3299,7 @@ declare class UsersRepository extends BaseRepository {
3178
3299
  id: number;
3179
3300
  name: string;
3180
3301
  displayName: string;
3181
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
3302
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
3182
3303
  }[];
3183
3304
  }>;
3184
3305
  /**
@@ -3293,16 +3414,16 @@ declare class KeysRepository extends BaseRepository {
3293
3414
  * Write primary 사용
3294
3415
  */
3295
3416
  create(data: NewUserPublicKey): Promise<{
3296
- publicKey: string;
3297
- keyId: string;
3298
- fingerprint: string;
3299
- algorithm: "ES256" | "RS256";
3300
3417
  userId: number;
3418
+ keyId: string;
3301
3419
  id: number;
3302
3420
  isActive: boolean;
3303
3421
  createdAt: Date;
3304
- expiresAt: Date | null;
3422
+ publicKey: string;
3423
+ algorithm: "ES256" | "RS256";
3424
+ fingerprint: string;
3305
3425
  lastUsedAt: Date | null;
3426
+ expiresAt: Date | null;
3306
3427
  revokedAt: Date | null;
3307
3428
  revokedReason: string | null;
3308
3429
  }>;
@@ -3329,16 +3450,16 @@ declare class KeysRepository extends BaseRepository {
3329
3450
  * Write primary 사용
3330
3451
  */
3331
3452
  deleteByKeyIdAndUserId(keyId: string, userId: number): Promise<{
3332
- publicKey: string;
3333
- keyId: string;
3334
- fingerprint: string;
3335
- algorithm: "ES256" | "RS256";
3336
3453
  userId: number;
3454
+ keyId: string;
3337
3455
  id: number;
3338
3456
  isActive: boolean;
3339
3457
  createdAt: Date;
3340
- expiresAt: Date | null;
3458
+ publicKey: string;
3459
+ algorithm: "ES256" | "RS256";
3460
+ fingerprint: string;
3341
3461
  lastUsedAt: Date | null;
3462
+ expiresAt: Date | null;
3342
3463
  revokedAt: Date | null;
3343
3464
  revokedReason: string | null;
3344
3465
  }>;
@@ -3453,14 +3574,14 @@ declare class VerificationCodesRepository extends BaseRepository {
3453
3574
  * Write primary 사용
3454
3575
  */
3455
3576
  create(data: NewVerificationCode): Promise<{
3456
- target: string;
3457
- targetType: "email" | "phone";
3458
- purpose: "registration" | "login" | "password_reset" | "email_change" | "phone_change";
3459
- code: string;
3460
3577
  id: number;
3461
3578
  createdAt: Date;
3462
3579
  updatedAt: Date;
3463
3580
  expiresAt: Date;
3581
+ target: string;
3582
+ targetType: "email" | "phone";
3583
+ code: string;
3584
+ purpose: "registration" | "login" | "password_reset" | "email_change" | "phone_change";
3464
3585
  usedAt: Date | null;
3465
3586
  attempts: number;
3466
3587
  }>;
@@ -3649,7 +3770,7 @@ declare class PermissionsRepository extends BaseRepository {
3649
3770
  name: string;
3650
3771
  displayName: string;
3651
3772
  description: string | null;
3652
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3773
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3653
3774
  isBuiltin: boolean;
3654
3775
  isSystem: boolean;
3655
3776
  isActive: boolean;
@@ -3665,7 +3786,7 @@ declare class PermissionsRepository extends BaseRepository {
3665
3786
  name: string;
3666
3787
  displayName: string;
3667
3788
  description: string | null;
3668
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3789
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3669
3790
  isBuiltin: boolean;
3670
3791
  isSystem: boolean;
3671
3792
  isActive: boolean;
@@ -3705,7 +3826,7 @@ declare class PermissionsRepository extends BaseRepository {
3705
3826
  name: string;
3706
3827
  displayName: string;
3707
3828
  description: string | null;
3708
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3829
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3709
3830
  isBuiltin: boolean;
3710
3831
  isSystem: boolean;
3711
3832
  isActive: boolean;
@@ -3716,7 +3837,6 @@ declare class PermissionsRepository extends BaseRepository {
3716
3837
  */
3717
3838
  deleteById(id: number): Promise<{
3718
3839
  description: string | null;
3719
- metadata: Record<string, any> | null;
3720
3840
  id: number;
3721
3841
  name: string;
3722
3842
  displayName: string;
@@ -3725,7 +3845,8 @@ declare class PermissionsRepository extends BaseRepository {
3725
3845
  isActive: boolean;
3726
3846
  createdAt: Date;
3727
3847
  updatedAt: Date;
3728
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3848
+ metadata: Record<string, any> | null;
3849
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3729
3850
  }>;
3730
3851
  }
3731
3852
  declare const permissionsRepository: PermissionsRepository;
@@ -3770,9 +3891,9 @@ declare class RolePermissionsRepository extends BaseRepository {
3770
3891
  */
3771
3892
  createMany(data: NewRolePermission[]): Promise<{
3772
3893
  id: number;
3773
- roleId: number;
3774
3894
  createdAt: Date;
3775
3895
  updatedAt: Date;
3896
+ roleId: number;
3776
3897
  permissionId: number;
3777
3898
  }[]>;
3778
3899
  /**
@@ -3788,9 +3909,9 @@ declare class RolePermissionsRepository extends BaseRepository {
3788
3909
  */
3789
3910
  setPermissionsForRole(roleId: number, permissionIds: number[]): Promise<{
3790
3911
  id: number;
3791
- roleId: number;
3792
3912
  createdAt: Date;
3793
3913
  updatedAt: Date;
3914
+ roleId: number;
3794
3915
  permissionId: number;
3795
3916
  }[]>;
3796
3917
  }
@@ -3855,10 +3976,10 @@ declare class UserPermissionsRepository extends BaseRepository {
3855
3976
  id: number;
3856
3977
  createdAt: Date;
3857
3978
  updatedAt: Date;
3858
- permissionId: number;
3859
3979
  expiresAt: Date | null;
3860
- reason: string | null;
3980
+ permissionId: number;
3861
3981
  granted: boolean;
3982
+ reason: string | null;
3862
3983
  }>;
3863
3984
  /**
3864
3985
  * 사용자 권한 오버라이드 업데이트
@@ -3881,10 +4002,10 @@ declare class UserPermissionsRepository extends BaseRepository {
3881
4002
  id: number;
3882
4003
  createdAt: Date;
3883
4004
  updatedAt: Date;
3884
- permissionId: number;
3885
4005
  expiresAt: Date | null;
3886
- reason: string | null;
4006
+ permissionId: number;
3887
4007
  granted: boolean;
4008
+ reason: string | null;
3888
4009
  }>;
3889
4010
  /**
3890
4011
  * 사용자의 모든 권한 오버라이드 삭제
@@ -3962,7 +4083,6 @@ declare class UserProfilesRepository extends BaseRepository {
3962
4083
  * 프로필 생성
3963
4084
  */
3964
4085
  create(data: NewUserProfile): Promise<{
3965
- metadata: Record<string, any> | null;
3966
4086
  userId: number;
3967
4087
  id: number;
3968
4088
  displayName: string | null;
@@ -3980,6 +4100,7 @@ declare class UserProfilesRepository extends BaseRepository {
3980
4100
  location: string | null;
3981
4101
  company: string | null;
3982
4102
  jobTitle: string | null;
4103
+ metadata: Record<string, any> | null;
3983
4104
  }>;
3984
4105
  /**
3985
4106
  * 프로필 업데이트 (by ID)
@@ -4031,7 +4152,6 @@ declare class UserProfilesRepository extends BaseRepository {
4031
4152
  * 프로필 삭제 (by ID)
4032
4153
  */
4033
4154
  deleteById(id: number): Promise<{
4034
- metadata: Record<string, any> | null;
4035
4155
  userId: number;
4036
4156
  id: number;
4037
4157
  displayName: string | null;
@@ -4049,12 +4169,12 @@ declare class UserProfilesRepository extends BaseRepository {
4049
4169
  location: string | null;
4050
4170
  company: string | null;
4051
4171
  jobTitle: string | null;
4172
+ metadata: Record<string, any> | null;
4052
4173
  }>;
4053
4174
  /**
4054
4175
  * 프로필 삭제 (by User ID)
4055
4176
  */
4056
4177
  deleteByUserId(userId: number): Promise<{
4057
- metadata: Record<string, any> | null;
4058
4178
  userId: number;
4059
4179
  id: number;
4060
4180
  displayName: string | null;
@@ -4072,6 +4192,7 @@ declare class UserProfilesRepository extends BaseRepository {
4072
4192
  location: string | null;
4073
4193
  company: string | null;
4074
4194
  jobTitle: string | null;
4195
+ metadata: Record<string, any> | null;
4075
4196
  }>;
4076
4197
  /**
4077
4198
  * 프로필 Upsert (by User ID)
@@ -4080,7 +4201,6 @@ declare class UserProfilesRepository extends BaseRepository {
4080
4201
  * 새로 생성 시 displayName은 필수 (없으면 'User'로 설정)
4081
4202
  */
4082
4203
  upsertByUserId(userId: number, data: Partial<Omit<NewUserProfile, 'userId'>>): Promise<{
4083
- metadata: Record<string, any> | null;
4084
4204
  userId: number;
4085
4205
  id: number;
4086
4206
  displayName: string | null;
@@ -4098,6 +4218,7 @@ declare class UserProfilesRepository extends BaseRepository {
4098
4218
  location: string | null;
4099
4219
  company: string | null;
4100
4220
  jobTitle: string | null;
4221
+ metadata: Record<string, any> | null;
4101
4222
  }>;
4102
4223
  /**
4103
4224
  * User ID로 프로필 데이터 조회 (formatted)
@@ -4225,15 +4346,15 @@ declare class InvitationsRepository extends BaseRepository {
4225
4346
  */
4226
4347
  create(data: NewInvitation): Promise<{
4227
4348
  email: string;
4228
- metadata: Record<string, any> | null;
4349
+ status: "pending" | "accepted" | "expired" | "cancelled";
4229
4350
  id: number;
4230
- roleId: number;
4231
4351
  createdAt: Date;
4232
4352
  updatedAt: Date;
4233
- status: "pending" | "accepted" | "expired" | "cancelled";
4353
+ roleId: number;
4354
+ metadata: Record<string, any> | null;
4355
+ expiresAt: Date;
4234
4356
  token: string;
4235
4357
  invitedBy: number;
4236
- expiresAt: Date;
4237
4358
  acceptedAt: Date | null;
4238
4359
  cancelledAt: Date | null;
4239
4360
  }>;
@@ -4259,15 +4380,15 @@ declare class InvitationsRepository extends BaseRepository {
4259
4380
  */
4260
4381
  deleteById(id: number): Promise<{
4261
4382
  email: string;
4262
- metadata: Record<string, any> | null;
4383
+ status: "pending" | "accepted" | "expired" | "cancelled";
4263
4384
  id: number;
4264
- roleId: number;
4265
4385
  createdAt: Date;
4266
4386
  updatedAt: Date;
4267
- status: "pending" | "accepted" | "expired" | "cancelled";
4387
+ roleId: number;
4388
+ metadata: Record<string, any> | null;
4389
+ expiresAt: Date;
4268
4390
  token: string;
4269
4391
  invitedBy: number;
4270
- expiresAt: Date;
4271
4392
  acceptedAt: Date | null;
4272
4393
  cancelledAt: Date | null;
4273
4394
  }>;
@@ -4412,7 +4533,7 @@ declare class SocialAccountsRepository extends BaseRepository {
4412
4533
  updatedAt: Date;
4413
4534
  id: number;
4414
4535
  userId: number;
4415
- provider: "google" | "github" | "kakao" | "naver";
4536
+ provider: "google" | "github" | "kakao" | "naver" | "superself";
4416
4537
  providerUserId: string;
4417
4538
  providerEmail: string | null;
4418
4539
  accessToken: string | null;
@@ -4428,7 +4549,7 @@ declare class SocialAccountsRepository extends BaseRepository {
4428
4549
  updatedAt: Date;
4429
4550
  id: number;
4430
4551
  userId: number;
4431
- provider: "google" | "github" | "kakao" | "naver";
4552
+ provider: "google" | "github" | "kakao" | "naver" | "superself";
4432
4553
  providerUserId: string;
4433
4554
  providerEmail: string | null;
4434
4555
  accessToken: string | null;
@@ -4444,7 +4565,7 @@ declare class SocialAccountsRepository extends BaseRepository {
4444
4565
  updatedAt: Date;
4445
4566
  id: number;
4446
4567
  userId: number;
4447
- provider: "google" | "github" | "kakao" | "naver";
4568
+ provider: "google" | "github" | "kakao" | "naver" | "superself";
4448
4569
  providerUserId: string;
4449
4570
  providerEmail: string | null;
4450
4571
  accessToken: string | null;
@@ -4460,7 +4581,7 @@ declare class SocialAccountsRepository extends BaseRepository {
4460
4581
  id: number;
4461
4582
  createdAt: Date;
4462
4583
  updatedAt: Date;
4463
- provider: "google" | "github" | "kakao" | "naver";
4584
+ provider: "google" | "github" | "kakao" | "naver" | "superself";
4464
4585
  providerUserId: string;
4465
4586
  providerEmail: string | null;
4466
4587
  accessToken: string | null;
@@ -4480,7 +4601,7 @@ declare class SocialAccountsRepository extends BaseRepository {
4480
4601
  updatedAt: Date;
4481
4602
  id: number;
4482
4603
  userId: number;
4483
- provider: "google" | "github" | "kakao" | "naver";
4604
+ provider: "google" | "github" | "kakao" | "naver" | "superself";
4484
4605
  providerUserId: string;
4485
4606
  providerEmail: string | null;
4486
4607
  accessToken: string | null;
@@ -4496,7 +4617,7 @@ declare class SocialAccountsRepository extends BaseRepository {
4496
4617
  id: number;
4497
4618
  createdAt: Date;
4498
4619
  updatedAt: Date;
4499
- provider: "google" | "github" | "kakao" | "naver";
4620
+ provider: "google" | "github" | "kakao" | "naver" | "superself";
4500
4621
  providerUserId: string;
4501
4622
  providerEmail: string | null;
4502
4623
  accessToken: string | null;
@@ -4512,7 +4633,7 @@ declare class SocialAccountsRepository extends BaseRepository {
4512
4633
  id: number;
4513
4634
  createdAt: Date;
4514
4635
  updatedAt: Date;
4515
- provider: "google" | "github" | "kakao" | "naver";
4636
+ provider: "google" | "github" | "kakao" | "naver" | "superself";
4516
4637
  providerUserId: string;
4517
4638
  providerEmail: string | null;
4518
4639
  accessToken: string | null;
@@ -4976,15 +5097,15 @@ declare function getUser(c: Context | {
4976
5097
  }): {
4977
5098
  email: string | null;
4978
5099
  phone: string | null;
5100
+ status: "active" | "inactive" | "suspended";
5101
+ username: string | null;
4979
5102
  id: number;
5103
+ createdAt: Date;
5104
+ updatedAt: Date;
4980
5105
  publicId: string;
4981
- username: string | null;
4982
5106
  passwordHash: string | null;
4983
5107
  passwordChangeRequired: boolean;
4984
5108
  roleId: number;
4985
- createdAt: Date;
4986
- updatedAt: Date;
4987
- status: "active" | "inactive" | "suspended";
4988
5109
  emailVerifiedAt: Date | null;
4989
5110
  phoneVerifiedAt: Date | null;
4990
5111
  lastLoginAt: Date | null;
@@ -5181,116 +5302,6 @@ declare function getAuthConfig(): AuthConfig;
5181
5302
  */
5182
5303
  declare function getSessionTtl(override?: string | number): number;
5183
5304
 
5184
- /**
5185
- * Google OAuth 2.0 Client
5186
- *
5187
- * Authorization Code Flow 구현
5188
- * - getGoogleAuthUrl: Google 로그인 URL 생성
5189
- * - exchangeCodeForTokens: Code를 Token으로 교환
5190
- * - getGoogleUserInfo: 사용자 정보 조회
5191
- */
5192
- interface GoogleTokenResponse {
5193
- access_token: string;
5194
- expires_in: number;
5195
- refresh_token?: string;
5196
- scope: string;
5197
- token_type: string;
5198
- id_token?: string;
5199
- }
5200
- interface GoogleUserInfo {
5201
- id: string;
5202
- email: string;
5203
- verified_email: boolean;
5204
- name?: string;
5205
- given_name?: string;
5206
- family_name?: string;
5207
- picture?: string;
5208
- locale?: string;
5209
- }
5210
- /**
5211
- * Google OAuth가 활성화되어 있는지 확인
5212
- */
5213
- declare function isGoogleOAuthEnabled(): boolean;
5214
- /**
5215
- * Google OAuth 설정 가져오기
5216
- */
5217
- declare function getGoogleOAuthConfig(): {
5218
- clientId: string;
5219
- clientSecret: string;
5220
- redirectUri: string;
5221
- };
5222
- /**
5223
- * Google 로그인 URL 생성
5224
- *
5225
- * @param state - CSRF 방지용 state 파라미터 (암호화된 returnUrl + nonce 포함)
5226
- * @param scopes - 요청할 OAuth scopes (기본: env 또는 email, profile)
5227
- */
5228
- declare function getGoogleAuthUrl(state: string, scopes?: string[]): string;
5229
- /**
5230
- * Authorization Code를 Token으로 교환
5231
- *
5232
- * @param code - Google에서 받은 authorization code
5233
- */
5234
- declare function exchangeCodeForTokens(code: string): Promise<GoogleTokenResponse>;
5235
- /**
5236
- * Access Token으로 Google 사용자 정보 조회
5237
- *
5238
- * @param accessToken - Google access token
5239
- */
5240
- declare function getGoogleUserInfo(accessToken: string): Promise<GoogleUserInfo>;
5241
- /**
5242
- * Refresh Token으로 새 Access Token 획득
5243
- *
5244
- * @param refreshToken - Google refresh token
5245
- */
5246
- declare function refreshAccessToken(refreshToken: string): Promise<GoogleTokenResponse>;
5247
-
5248
- /**
5249
- * OAuth State Management
5250
- *
5251
- * CSRF 방지를 위한 state 파라미터 암호화/복호화
5252
- * - returnUrl: OAuth 성공 후 리다이렉트할 URL
5253
- * - nonce: CSRF 방지용 일회용 토큰
5254
- * - provider: OAuth provider (google, github 등)
5255
- * - publicKey, keyId, fingerprint, algorithm: 클라이언트 키 정보
5256
- * - expiresAt: state 만료 시간
5257
- */
5258
-
5259
- interface OAuthState {
5260
- returnUrl: string;
5261
- nonce: string;
5262
- provider: string;
5263
- publicKey: string;
5264
- keyId: string;
5265
- fingerprint: string;
5266
- algorithm: KeyAlgorithmType;
5267
- metadata?: Record<string, unknown>;
5268
- }
5269
- interface CreateOAuthStateParams {
5270
- provider: string;
5271
- returnUrl: string;
5272
- publicKey: string;
5273
- keyId: string;
5274
- fingerprint: string;
5275
- algorithm: KeyAlgorithmType;
5276
- metadata?: Record<string, unknown>;
5277
- }
5278
- /**
5279
- * OAuth state 생성 및 암호화
5280
- *
5281
- * @param params - state 생성에 필요한 파라미터
5282
- * @returns 암호화된 state 문자열
5283
- */
5284
- declare function createOAuthState(params: CreateOAuthStateParams): Promise<string>;
5285
- /**
5286
- * OAuth state 복호화 및 검증
5287
- *
5288
- * @param encryptedState - 암호화된 state 문자열
5289
- * @returns 복호화된 state 객체
5290
- * @throws Error if state is invalid or expired (JWE exp claim으로 자동 검증)
5291
- */
5292
- declare function verifyOAuthState(encryptedState: string): Promise<OAuthState>;
5293
-
5294
5305
  /**
5295
5306
  * One-Time Token Manager
5296
5307
  *
@@ -5483,8 +5494,10 @@ declare function createAuthLifecycle(options?: AuthLifecycleOptions): AuthLifecy
5483
5494
  */
5484
5495
  /**
5485
5496
  * Auth provider type
5497
+ *
5498
+ * 직접 인증(email/phone) + 등록 가능한 모든 소셜 provider(SOCIAL_PROVIDERS).
5486
5499
  */
5487
- declare const AuthProviderSchema: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"email">, _sinclair_typebox.TLiteral<"phone">, _sinclair_typebox.TLiteral<"google">]>;
5500
+ declare const AuthProviderSchema: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"email">, _sinclair_typebox.TLiteral<"phone">, ..._sinclair_typebox.TLiteral<"google" | "github" | "kakao" | "naver" | "superself">[]]>;
5488
5501
  /**
5489
5502
  * auth.login - 로그인 성공 이벤트
5490
5503
  *
@@ -5503,7 +5516,7 @@ declare const authLoginEvent: _spfn_core_event.EventDef<{
5503
5516
  email?: string | undefined;
5504
5517
  phone?: string | undefined;
5505
5518
  userId: string;
5506
- provider: "email" | "phone" | "google";
5519
+ provider: "email" | "phone" | "google" | "github" | "kakao" | "naver" | "superself";
5507
5520
  }>;
5508
5521
  /**
5509
5522
  * auth.register - 회원가입 성공 이벤트
@@ -5526,7 +5539,7 @@ declare const authRegisterEvent: _spfn_core_event.EventDef<{
5526
5539
  [x: string]: unknown;
5527
5540
  } | undefined;
5528
5541
  userId: string;
5529
- provider: "email" | "phone" | "google";
5542
+ provider: "email" | "phone" | "google" | "github" | "kakao" | "naver" | "superself";
5530
5543
  }>;
5531
5544
  /**
5532
5545
  * auth.invitation.created - 초대 생성 이벤트
@@ -5554,9 +5567,9 @@ declare const invitationCreatedEvent: _spfn_core_event.EventDef<{
5554
5567
  } | undefined;
5555
5568
  email: string;
5556
5569
  roleId: number;
5570
+ expiresAt: string;
5557
5571
  token: string;
5558
5572
  invitedBy: string;
5559
- expiresAt: string;
5560
5573
  invitationId: string;
5561
5574
  isResend: boolean;
5562
5575
  }>;
@@ -5591,4 +5604,4 @@ type AuthRegisterPayload = typeof authRegisterEvent._payload;
5591
5604
  type InvitationCreatedPayload = typeof invitationCreatedEvent._payload;
5592
5605
  type InvitationAcceptedPayload = typeof invitationAcceptedEvent._payload;
5593
5606
 
5594
- export { type AuthConfig, AuthContext, type AuthLifecycleConfig, type AuthLifecycleOptions, type AuthLoginPayload, type AuthMetadataEntity, AuthMetadataRepository, AuthProviderSchema, type AuthRegisterPayload, COOKIE_NAMES, type CreateOAuthStateParams, type GoogleTokenResponse, type GoogleUserInfo, type Invitation, type InvitationAcceptedPayload, type InvitationCreatedPayload, InvitationStatus, InvitationsRepository, KeyAlgorithmType, type KeyPair, KeysRepository, type NewAuthMetadataEntity, type NewInvitation, type NewPermission, type NewPermissionEntity, type NewRole, type NewRoleEntity, type NewRolePermission, type NewUser, type NewUserPermission, type NewUserProfile, type NewUserPublicKey, type NewUserSocialAccount, type NewVerificationCode, type OAuthState, type Permission, type PermissionEntity, PermissionsRepository, type Role, type RoleEntity, type RoleGuardOptions, type RolePermission, RolePermissionsRepository, RolesRepository, type SessionPayload, SocialAccountsRepository, SocialProvider, type TokenPayload, type UpdateProfileParams, type User, type UserPermission, UserPermissionsRepository, type UserProfile, UserProfilesRepository, type UserPublicKey, type UserSocialAccount, UsersRepository, type VerificationCode, VerificationCodesRepository, VerificationPurpose, acceptInvitation, addPermissionToRole, authLogger, authLoginEvent, authMetadata, authMetadataRepository, authRegisterEvent, authSchema, cancelInvitation, checkUsernameAvailableService, configureAuth, createAuthLifecycle, createInvitation, createOAuthState, createRole, decodeToken, deleteInvitation, deleteRole, exchangeCodeForTokens, expireOldInvitations, generateClientToken, generateKeyPair, generateKeyPairES256, generateKeyPairRS256, generateToken, getAllRoles, getAuth, getAuthConfig, getAuthSessionService, getGoogleAuthUrl, getGoogleOAuthConfig, getGoogleUserInfo, getInvitationByToken, getInvitationWithDetails, getKeyId, getKeySize, getLocale, getOneTimeTokenManager, getOptionalAuth, getRole, getRoleByName, getRolePermissions, getSessionTtl, getUser, getUserByEmailService, getUserByIdService, getUserByPhoneService, getUserId, getUserPermissions, getUserProfileService, getUserRole, hasAllPermissions, hasAnyPermission, hasAnyRole, hasPermission, hasRole, hashPassword, initOneTimeTokenManager, initializeAuth, invitationAcceptedEvent, invitationCreatedEvent, invitationsRepository, isGoogleOAuthEnabled, keysRepository, listInvitations, oneTimeTokenAuth, parseDuration, permissions, permissionsRepository, refreshAccessToken, removePermissionFromRole, requireAnyPermission, requirePermissions, requireRole, resendInvitation, roleGuard, rolePermissions, rolePermissionsRepository, roles, rolesRepository, setRolePermissions, shouldRotateKey, socialAccountsRepository, updateLastLoginService, updateLocaleService, updateRole, updateUserProfileService, updateUserService, updateUsernameService, userInvitations, userPermissions, userPermissionsRepository, userProfiles, userProfilesRepository, userPublicKeys, userSocialAccounts, users, usersRepository, validateInvitation, validatePasswordStrength, verificationCodes, verificationCodesRepository, verifyClientToken, verifyKeyFingerprint, verifyOAuthState, verifyPassword, verifyToken };
5607
+ export { type AuthConfig, AuthContext, type AuthLifecycleConfig, type AuthLifecycleOptions, type AuthLoginPayload, type AuthMetadataEntity, AuthMetadataRepository, AuthProviderSchema, type AuthRegisterPayload, COOKIE_NAMES, type CreateOAuthStateParams, type GoogleTokenResponse, type GoogleUserInfo, type Invitation, type InvitationAcceptedPayload, type InvitationCreatedPayload, InvitationStatus, InvitationsRepository, KeyAlgorithmType, type KeyPair, KeysRepository, type NewAuthMetadataEntity, type NewInvitation, type NewPermission, type NewPermissionEntity, type NewRole, type NewRoleEntity, type NewRolePermission, type NewUser, type NewUserPermission, type NewUserProfile, type NewUserPublicKey, type NewUserSocialAccount, type NewVerificationCode, OAuthProvider, type OAuthState, type Permission, type PermissionEntity, PermissionsRepository, type Role, type RoleEntity, type RoleGuardOptions, type RolePermission, RolePermissionsRepository, RolesRepository, type SessionPayload, SocialAccountsRepository, SocialProvider, type TokenPayload, type UpdateProfileParams, type User, type UserPermission, UserPermissionsRepository, type UserProfile, UserProfilesRepository, type UserPublicKey, type UserSocialAccount, UsersRepository, type VerificationCode, VerificationCodesRepository, VerificationPurpose, acceptInvitation, addPermissionToRole, authLogger, authLoginEvent, authMetadata, authMetadataRepository, authRegisterEvent, authSchema, cancelInvitation, checkUsernameAvailableService, configureAuth, createAuthLifecycle, createInvitation, createOAuthState, createRole, decodeToken, deleteInvitation, deleteRole, exchangeCodeForTokens, expireOldInvitations, generateClientToken, generateKeyPair, generateKeyPairES256, generateKeyPairRS256, generateToken, getAllRoles, getAuth, getAuthConfig, getAuthSessionService, getGoogleAuthUrl, getGoogleOAuthConfig, getGoogleUserInfo, getInvitationByToken, getInvitationWithDetails, getKeyId, getKeySize, getLocale, getOneTimeTokenManager, getOptionalAuth, getRole, getRoleByName, getRolePermissions, getSessionTtl, getUser, getUserByEmailService, getUserByIdService, getUserByPhoneService, getUserId, getUserPermissions, getUserProfileService, getUserRole, googleProvider, hasAllPermissions, hasAnyPermission, hasAnyRole, hasPermission, hasRole, hashPassword, initOneTimeTokenManager, initializeAuth, invitationAcceptedEvent, invitationCreatedEvent, invitationsRepository, isGoogleOAuthEnabled, keysRepository, listInvitations, oneTimeTokenAuth, parseDuration, permissions, permissionsRepository, refreshAccessToken, removePermissionFromRole, requireAnyPermission, requirePermissions, requireRole, resendInvitation, roleGuard, rolePermissions, rolePermissionsRepository, roles, rolesRepository, setRolePermissions, shouldRotateKey, socialAccountsRepository, updateLastLoginService, updateLocaleService, updateRole, updateUserProfileService, updateUserService, updateUsernameService, userInvitations, userPermissions, userPermissionsRepository, userProfiles, userProfilesRepository, userPublicKeys, userSocialAccounts, users, usersRepository, validateInvitation, validatePasswordStrength, verificationCodes, verificationCodesRepository, verifyClientToken, verifyKeyFingerprint, verifyOAuthState, verifyPassword, verifyToken };