@spfn/auth 0.2.0-beta.87 → 0.2.0-beta.88

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.
Files changed (50) hide show
  1. package/README.md +333 -18
  2. package/dist/{authenticate-C7w-pLOR.d.ts → authenticate-ZssfqJ7d.d.ts} +150 -9
  3. package/dist/client-proof.d.ts +1 -1
  4. package/dist/client-proof.js +30 -0
  5. package/dist/client-proof.js.map +1 -1
  6. package/dist/config.d.ts +36 -0
  7. package/dist/config.js +18 -0
  8. package/dist/config.js.map +1 -1
  9. package/dist/errors.d.ts +93 -2
  10. package/dist/errors.js +57 -0
  11. package/dist/errors.js.map +1 -1
  12. package/dist/index.d.ts +36 -7
  13. package/dist/index.js +60 -0
  14. package/dist/index.js.map +1 -1
  15. package/dist/nextjs/server.d.ts +2 -2
  16. package/dist/server.d.ts +195 -80
  17. package/dist/server.js +515 -106
  18. package/dist/server.js.map +1 -1
  19. package/dist/{session-CGxgH3C9.d.ts → session-CFK4BT25.d.ts} +1 -1
  20. package/dist/{types-1BMx0OX1.d.ts → types-CD95yudz.d.ts} +15 -1
  21. package/migrations/20251125021229_premium_famine/snapshot.json +2641 -0
  22. package/migrations/20260225130050_smooth_the_fury/snapshot.json +2686 -0
  23. package/migrations/20260308141417_deep_iceman/snapshot.json +2686 -0
  24. package/migrations/20260308151309_perfect_deathbird/snapshot.json +2731 -0
  25. package/migrations/20260308201135_concerned_rawhide_kid/snapshot.json +2786 -0
  26. package/migrations/20260629103209_lethal_lifeguard/snapshot.json +2786 -0
  27. package/migrations/20260709073531_easy_hardball/snapshot.json +3119 -0
  28. package/migrations/20260714081434_glossy_major_mapleleaf/snapshot.json +3112 -0
  29. package/migrations/20260804105939_amazing_bushwacker/migration.sql +3 -0
  30. package/migrations/20260804105939_amazing_bushwacker/snapshot.json +3112 -0
  31. package/migrations/20260804110033_fat_piledriver/migration.sql +2 -0
  32. package/migrations/20260804110033_fat_piledriver/snapshot.json +3138 -0
  33. package/package.json +3 -6
  34. package/migrations/meta/0000_snapshot.json +0 -1632
  35. package/migrations/meta/0001_snapshot.json +0 -1660
  36. package/migrations/meta/0002_snapshot.json +0 -1660
  37. package/migrations/meta/0003_snapshot.json +0 -1689
  38. package/migrations/meta/0004_snapshot.json +0 -1721
  39. package/migrations/meta/0005_snapshot.json +0 -1721
  40. package/migrations/meta/0006_snapshot.json +0 -1921
  41. package/migrations/meta/0007_snapshot.json +0 -1916
  42. package/migrations/meta/_journal.json +0 -62
  43. /package/migrations/{0000_premium_famine.sql → 20251125021229_premium_famine/migration.sql} +0 -0
  44. /package/migrations/{0001_smooth_the_fury.sql → 20260225130050_smooth_the_fury/migration.sql} +0 -0
  45. /package/migrations/{0002_deep_iceman.sql → 20260308141417_deep_iceman/migration.sql} +0 -0
  46. /package/migrations/{0003_perfect_deathbird.sql → 20260308151309_perfect_deathbird/migration.sql} +0 -0
  47. /package/migrations/{0004_concerned_rawhide_kid.sql → 20260308201135_concerned_rawhide_kid/migration.sql} +0 -0
  48. /package/migrations/{0005_lethal_lifeguard.sql → 20260629103209_lethal_lifeguard/migration.sql} +0 -0
  49. /package/migrations/{0006_easy_hardball.sql → 20260709073531_easy_hardball/migration.sql} +0 -0
  50. /package/migrations/{0007_glossy_major_mapleleaf.sql → 20260714081434_glossy_major_mapleleaf/migration.sql} +0 -0
package/dist/server.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { j as AuthInitOptions, k as OAuthProvider, e as VerificationPurpose, i as PermissionCategory, l as AuthContext } from './authenticate-C7w-pLOR.js';
2
- export { a5 as AuthProfileVerifier, C as ChangePasswordParams, a8 as EmailSchema, I as IssueOneTimeTokenResult, s as LoginParams, L as LoginResult, t as LogoutParams, af as NativeVerifyOptions, ad as NormalizedIdentity, _ as OAuthCallbackParams, $ as OAuthCallbackResult, ag as OAuthCodeExchangeOptions, a2 as OAuthNativeParams, c as OAuthNativeResult, Z as OAuthStartParams, O as OAuthStartResult, ae as OAuthTokens, aa as PasswordSchema, a9 as PhoneSchema, q as RegisterParams, E as RegisterPublicKeyParams, a as RegisterResult, G as RevokeKeyParams, F as RotateKeyParams, b as RotateKeyResult, w as SendVerificationCodeParams, S as SendVerificationCodeResult, ab as TargetTypeSchema, ai as UnlinkNotification, aj as UnlinkNotifyRejection, ah as UnlinkNotifyRequest, a0 as UnlinkNotifyResult, g as VERIFICATION_PURPOSES, f as VERIFICATION_TARGET_TYPES, ac as VerificationPurposeSchema, V as VerificationTargetType, x as VerifyCodeParams, y as VerifyCodeResult, m as authRouter, a6 as authenticate, N as buildOAuthErrorUrl, p as changePasswordService, W as getEnabledOAuthProviders, X as getGoogleAccessToken, al as getOAuthProvider, am as getRegisteredProviders, Q as isOAuthProviderEnabled, H as issueOneTimeTokenService, n as loginService, o as logoutService, M as oauthCallbackService, a1 as oauthNativeService, K as oauthStartService, Y as oauthUnlinkNotifyService, a7 as optionalAuth, ak as registerOAuthProvider, z as registerPublicKeyService, r as registerService, T as requireEnabledProvider, a4 as resolveAuthenticatedUser, D as revokeKeyService, B as rotateKeyService, a3 as selectAuthProfile, u as sendVerificationCodeService, v as verifyCodeService, J as verifyOneTimeTokenService } from './authenticate-C7w-pLOR.js';
1
+ import { k as AuthInitOptions, l as OAuthProvider, f as VerificationPurpose, j as PermissionCategory, n as AuthContext } from './authenticate-ZssfqJ7d.js';
2
+ export { ab as AuthProfileVerifier, C as ChangePasswordParams, ag as DeviceNameSchema, ae as EmailSchema, I as IssueOneTimeTokenResult, H as KEY_FINGERPRINT_PREFIX_LENGTH, K as KeySummary, t as LoginParams, L as LoginResult, u as LogoutParams, an as NativeVerifyOptions, al as NormalizedIdentity, a4 as OAuthCallbackParams, a5 as OAuthCallbackResult, ao as OAuthCodeExchangeOptions, a8 as OAuthNativeParams, d as OAuthNativeResult, a3 as OAuthStartParams, O as OAuthStartResult, am as OAuthTokens, ai as PasswordSchema, af as PhoneSchema, ah as PlatformSchema, s as RegisterParams, J as RegisterPublicKeyParams, a as RegisterResult, Q as RevokeAllKeysParams, c as RevokeAllKeysResult, N as RevokeKeyParams, M as RotateKeyParams, b as RotateKeyResult, x as SendVerificationCodeParams, S as SendVerificationCodeResult, aj as TargetTypeSchema, aq as UnlinkNotification, ar as UnlinkNotifyRejection, ap as UnlinkNotifyRequest, a6 as UnlinkNotifyResult, h as VERIFICATION_PURPOSES, g as VERIFICATION_TARGET_TYPES, ak as VerificationPurposeSchema, V as VerificationTargetType, y as VerifyCodeParams, z as VerifyCodeResult, m as authRouter, ac as authenticate, Z as buildOAuthErrorUrl, q as changePasswordService, a0 as getEnabledOAuthProviders, a1 as getGoogleAccessToken, at as getOAuthProvider, au as getRegisteredProviders, _ as isOAuthProviderEnabled, T as issueOneTimeTokenService, F as listKeysService, o as loginService, p as logoutService, Y as oauthCallbackService, a7 as oauthNativeService, X as oauthStartService, a2 as oauthUnlinkNotifyService, ad as optionalAuth, as as registerOAuthProvider, B as registerPublicKeyService, r as registerService, $ as requireEnabledProvider, aa as resolveAuthenticatedUser, G as revokeAllKeysService, E as revokeKeyService, D as rotateKeyService, a9 as selectAuthProfile, v as sendVerificationCodeService, w as verifyCodeService, W as verifyOneTimeTokenService } from './authenticate-ZssfqJ7d.js';
3
3
  import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
4
- import { K as KeyAlgorithmType, c as InvitationStatus, e as SocialProvider, g as AccountDeletionRequestedBy, h as PurgeStrategy } from './types-1BMx0OX1.js';
5
- export { b as ACCOUNT_DELETION_REQUESTED_BY, A as ACCOUNT_DELETION_REQUEST_STATUSES, f as AccountDeletionRequestStatus, I as INVITATION_STATUSES, a as KEY_ALGORITHM, P as PURGE_STRATEGIES, S as SOCIAL_PROVIDERS, U as USER_STATUSES, d as UserStatus } from './types-1BMx0OX1.js';
4
+ import { K as KeyAlgorithmType, f as InvitationStatus, h as SocialProvider, j as AccountDeletionRequestedBy, k as PurgeStrategy } from './types-CD95yudz.js';
5
+ export { b as ACCOUNT_DELETION_REQUESTED_BY, A as ACCOUNT_DELETION_REQUEST_STATUSES, i as AccountDeletionRequestStatus, I as INVITATION_STATUSES, a as KEY_ALGORITHM, e as KEY_DEVICE_NAME_MAX_LENGTH, c as KEY_PLATFORM, d as KeyPlatformType, P as PURGE_STRATEGIES, S as SOCIAL_PROVIDERS, U as USER_STATUSES, g as UserStatus } from './types-CD95yudz.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-CGxgH3C9.js';
11
+ export { S as SessionData, g as getSessionInfo, s as sealSession, a as shouldRefreshSession, u as unsealSession } from './session-CFK4BT25.js';
12
12
  import { JWTPayload } from 'jose';
13
13
  import { SSETokenStore, SSETokenManager } from '@spfn/core/event/sse';
14
14
  import * as _spfn_core_logger from '@spfn/core/logger';
@@ -1317,7 +1317,7 @@ declare function getAuthSessionService(userId: string | number | bigint): Promis
1317
1317
  id: number;
1318
1318
  name: string;
1319
1319
  displayName: string;
1320
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
1320
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
1321
1321
  }[];
1322
1322
  userId: number;
1323
1323
  publicId: string;
@@ -1526,7 +1526,7 @@ declare function verifyOAuthState(encryptedState: string): Promise<OAuthState>;
1526
1526
  *
1527
1527
  * 네이티브/웹 SDK가 받은 id_token을 provider의 공개키(JWKS)로 검증한다.
1528
1528
  * authorization code 교환이 없으므로 client secret을 쓰지 않는다.
1529
- * 서명·issuer·audience·만료는 jose가, nonce는 여기서 직접 대조한다.
1529
+ * 서명·issuer·audience·만료·발급 후 경과 시간은 jose가, nonce는 여기서 직접 대조한다.
1530
1530
  */
1531
1531
 
1532
1532
  interface VerifyIdTokenParams {
@@ -1542,7 +1542,7 @@ interface VerifyIdTokenParams {
1542
1542
  /**
1543
1543
  * id_token을 검증하고 claims(payload)를 반환한다.
1544
1544
  *
1545
- * @throws InvalidSocialTokenError 서명/issuer/audience/만료/알고리즘/nonce/sub 검증 실패 시
1545
+ * @throws InvalidSocialTokenError 서명/issuer/audience/만료/토큰 나이/알고리즘/nonce/sub 검증 실패 시
1546
1546
  */
1547
1547
  declare function verifyIdToken(params: VerifyIdTokenParams): Promise<JWTPayload>;
1548
1548
 
@@ -1617,13 +1617,13 @@ declare const appleProvider: OAuthProvider;
1617
1617
  declare const githubProvider: OAuthProvider;
1618
1618
 
1619
1619
  /**
1620
- * Kakao Login OAuthProvider (web authorization-code flow).
1620
+ * Kakao Login OAuthProvider (web authorization-code flow + native id_token verification).
1621
1621
  */
1622
1622
 
1623
1623
  declare const kakaoProvider: OAuthProvider;
1624
1624
 
1625
1625
  /**
1626
- * Naver Login OAuthProvider (web authorization-code flow).
1626
+ * Naver Login OAuthProvider (web authorization-code flow + native id_token verification).
1627
1627
  */
1628
1628
 
1629
1629
  declare const naverProvider: OAuthProvider;
@@ -1763,7 +1763,7 @@ declare const accountDeletionRequests: drizzle_orm_pg_core.PgTableWithColumns<{
1763
1763
  name: string;
1764
1764
  tableName: "account_deletion_requests";
1765
1765
  dataType: "string enum";
1766
- data: "admin" | "self";
1766
+ data: "self" | "admin";
1767
1767
  driverParam: string;
1768
1768
  notNull: true;
1769
1769
  hasDefault: true;
@@ -2341,6 +2341,36 @@ declare const userPublicKeys: drizzle_orm_pg_core.PgTableWithColumns<{
2341
2341
  identity: undefined;
2342
2342
  generated: undefined;
2343
2343
  }>;
2344
+ deviceName: drizzle_orm_pg_core.PgBuildColumn<"user_public_keys", drizzle_orm_pg_core.PgTextBuilder<[string, ...string[]]>, {
2345
+ name: string;
2346
+ tableName: "user_public_keys";
2347
+ dataType: "string";
2348
+ data: string;
2349
+ driverParam: string;
2350
+ notNull: false;
2351
+ hasDefault: false;
2352
+ isPrimaryKey: false;
2353
+ isAutoincrement: false;
2354
+ hasRuntimeDefault: false;
2355
+ enumValues: undefined;
2356
+ identity: undefined;
2357
+ generated: undefined;
2358
+ }>;
2359
+ platform: drizzle_orm_pg_core.PgBuildColumn<"user_public_keys", drizzle_orm_pg_core.PgTextBuilder<["ios", "android", "web", "desktop"] & [string, ...string[]]>, {
2360
+ name: string;
2361
+ tableName: "user_public_keys";
2362
+ dataType: "string enum";
2363
+ data: "ios" | "android" | "web" | "desktop";
2364
+ driverParam: string;
2365
+ notNull: false;
2366
+ hasDefault: false;
2367
+ isPrimaryKey: false;
2368
+ isAutoincrement: false;
2369
+ hasRuntimeDefault: false;
2370
+ enumValues: ["ios", "android", "web", "desktop"] & [string, ...string[]];
2371
+ identity: undefined;
2372
+ generated: undefined;
2373
+ }>;
2344
2374
  isActive: drizzle_orm_pg_core.PgBuildColumn<"user_public_keys", drizzle_orm_pg_core.SetHasDefault<drizzle_orm_pg_core.SetNotNull<drizzle_orm_pg_core.PgBooleanBuilder>>, {
2345
2375
  name: string;
2346
2376
  tableName: "user_public_keys";
@@ -2877,7 +2907,7 @@ declare const permissions: drizzle_orm_pg_core.PgTableWithColumns<{
2877
2907
  name: string;
2878
2908
  tableName: "permissions";
2879
2909
  dataType: "string enum";
2880
- data: "auth" | "custom" | "user" | "rbac" | "system";
2910
+ data: "custom" | "user" | "auth" | "rbac" | "system";
2881
2911
  driverParam: string;
2882
2912
  notNull: false;
2883
2913
  hasDefault: false;
@@ -3466,15 +3496,15 @@ declare class UsersRepository extends BaseRepository {
3466
3496
  create(data: NewUser): Promise<{
3467
3497
  email: string | null;
3468
3498
  phone: string | null;
3499
+ status: "active" | "inactive" | "suspended" | "pending_deletion" | "deleted";
3500
+ username: string | null;
3469
3501
  id: number;
3502
+ createdAt: Date;
3503
+ updatedAt: Date;
3470
3504
  publicId: string;
3471
- username: string | null;
3472
3505
  passwordHash: string | null;
3473
3506
  passwordChangeRequired: boolean;
3474
3507
  roleId: number;
3475
- createdAt: Date;
3476
- updatedAt: Date;
3477
- status: "active" | "inactive" | "suspended" | "pending_deletion" | "deleted";
3478
3508
  emailVerifiedAt: Date | null;
3479
3509
  phoneVerifiedAt: Date | null;
3480
3510
  lastLoginAt: Date | null;
@@ -3581,15 +3611,15 @@ declare class UsersRepository extends BaseRepository {
3581
3611
  deleteById(id: number): Promise<{
3582
3612
  email: string | null;
3583
3613
  phone: string | null;
3614
+ status: "active" | "inactive" | "suspended" | "pending_deletion" | "deleted";
3615
+ username: string | null;
3584
3616
  id: number;
3617
+ createdAt: Date;
3618
+ updatedAt: Date;
3585
3619
  publicId: string;
3586
- username: string | null;
3587
3620
  passwordHash: string | null;
3588
3621
  passwordChangeRequired: boolean;
3589
3622
  roleId: number;
3590
- createdAt: Date;
3591
- updatedAt: Date;
3592
- status: "active" | "inactive" | "suspended" | "pending_deletion" | "deleted";
3593
3623
  emailVerifiedAt: Date | null;
3594
3624
  phoneVerifiedAt: Date | null;
3595
3625
  lastLoginAt: Date | null;
@@ -3614,7 +3644,7 @@ declare class UsersRepository extends BaseRepository {
3614
3644
  id: number;
3615
3645
  name: string;
3616
3646
  displayName: string;
3617
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
3647
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
3618
3648
  }[];
3619
3649
  }>;
3620
3650
  /**
@@ -3681,6 +3711,8 @@ declare class KeysRepository extends BaseRepository {
3681
3711
  publicKey: string;
3682
3712
  algorithm: "ES256" | "RS256";
3683
3713
  fingerprint: string;
3714
+ deviceName: string | null;
3715
+ platform: "ios" | "android" | "web" | "desktop" | null;
3684
3716
  isActive: boolean;
3685
3717
  createdAt: Date;
3686
3718
  lastUsedAt: Date | null;
@@ -3699,6 +3731,8 @@ declare class KeysRepository extends BaseRepository {
3699
3731
  publicKey: string;
3700
3732
  algorithm: "ES256" | "RS256";
3701
3733
  fingerprint: string;
3734
+ deviceName: string | null;
3735
+ platform: "ios" | "android" | "web" | "desktop" | null;
3702
3736
  isActive: boolean;
3703
3737
  createdAt: Date;
3704
3738
  lastUsedAt: Date | null;
@@ -3717,6 +3751,8 @@ declare class KeysRepository extends BaseRepository {
3717
3751
  publicKey: string;
3718
3752
  algorithm: "ES256" | "RS256";
3719
3753
  fingerprint: string;
3754
+ deviceName: string | null;
3755
+ platform: "ios" | "android" | "web" | "desktop" | null;
3720
3756
  isActive: boolean;
3721
3757
  createdAt: Date;
3722
3758
  lastUsedAt: Date | null;
@@ -3724,21 +3760,45 @@ declare class KeysRepository extends BaseRepository {
3724
3760
  revokedAt: Date | null;
3725
3761
  revokedReason: string | null;
3726
3762
  }[]>;
3763
+ /**
3764
+ * 키 목록 화면이 쓰는 공개키 조회 — 최근 등록순
3765
+ *
3766
+ * publicKey 원문은 고르지 않는다. 목록의 용도는 기기를 알아보고 지목하는 것이고,
3767
+ * 공개키는 그 어느 쪽에도 필요 없다. fingerprint는 호출자가 잘라서 내보낸다.
3768
+ *
3769
+ * `includeRevoked`는 이미 끊은 기기까지 보여준다 — "내가 언제 무엇을 끊었나"를
3770
+ * 확인하는 용도라, 폐기 시각과 사유를 함께 고른다.
3771
+ * Read replica 사용
3772
+ */
3773
+ listForUser(userId: number, includeRevoked?: boolean): Promise<{
3774
+ keyId: string;
3775
+ deviceName: string | null;
3776
+ platform: "ios" | "android" | "web" | "desktop" | null;
3777
+ algorithm: "ES256" | "RS256";
3778
+ fingerprint: string;
3779
+ isActive: boolean;
3780
+ createdAt: Date;
3781
+ lastUsedAt: Date | null;
3782
+ expiresAt: Date | null;
3783
+ revokedAt: Date | null;
3784
+ }[]>;
3727
3785
  /**
3728
3786
  * 공개키 생성
3729
3787
  * Write primary 사용
3730
3788
  */
3731
3789
  create(data: NewUserPublicKey): Promise<{
3732
- publicKey: string;
3733
- keyId: string;
3734
- fingerprint: string;
3735
- algorithm: "ES256" | "RS256";
3736
3790
  userId: number;
3791
+ keyId: string;
3737
3792
  id: number;
3738
3793
  isActive: boolean;
3739
3794
  createdAt: Date;
3740
- expiresAt: Date | null;
3795
+ publicKey: string;
3796
+ algorithm: "ES256" | "RS256";
3797
+ fingerprint: string;
3798
+ deviceName: string | null;
3799
+ platform: "ios" | "android" | "web" | "desktop" | null;
3741
3800
  lastUsedAt: Date | null;
3801
+ expiresAt: Date | null;
3742
3802
  revokedAt: Date | null;
3743
3803
  revokedReason: string | null;
3744
3804
  }>;
@@ -3753,6 +3813,8 @@ declare class KeysRepository extends BaseRepository {
3753
3813
  publicKey: string;
3754
3814
  algorithm: "ES256" | "RS256";
3755
3815
  fingerprint: string;
3816
+ deviceName: string | null;
3817
+ platform: "ios" | "android" | "web" | "desktop" | null;
3756
3818
  isActive: boolean;
3757
3819
  createdAt: Date;
3758
3820
  lastUsedAt: Date | null;
@@ -3774,6 +3836,8 @@ declare class KeysRepository extends BaseRepository {
3774
3836
  publicKey: string;
3775
3837
  algorithm: "ES256" | "RS256";
3776
3838
  fingerprint: string;
3839
+ deviceName: string | null;
3840
+ platform: "ios" | "android" | "web" | "desktop" | null;
3777
3841
  isActive: boolean;
3778
3842
  createdAt: Date;
3779
3843
  lastUsedAt: Date | null;
@@ -3782,20 +3846,45 @@ declare class KeysRepository extends BaseRepository {
3782
3846
  revokedReason: string | null;
3783
3847
  }[]>;
3784
3848
  /**
3785
- * 공개키 삭제
3849
+ * 지정한 키 하나만 남기고 사용자의 활성 공개키를 전부 revoke
3850
+ *
3851
+ * "다른 기기 전부 로그아웃" — 요청을 보낸 기기는 살려 둔다. 남길 키를 별도 조회로
3852
+ * 확인하지 않고 조건에 담아, 그 사이에 다른 요청이 키를 바꾸는 경쟁을 만들지 않는다.
3786
3853
  * Write primary 사용
3787
3854
  */
3788
- deleteByKeyIdAndUserId(keyId: string, userId: number): Promise<{
3789
- publicKey: string;
3855
+ revokeAllActiveByUserIdExcept(userId: number, keepKeyId: string, reason: string): Promise<{
3856
+ id: number;
3857
+ userId: number;
3790
3858
  keyId: string;
3791
- fingerprint: string;
3859
+ publicKey: string;
3792
3860
  algorithm: "ES256" | "RS256";
3861
+ fingerprint: string;
3862
+ deviceName: string | null;
3863
+ platform: "ios" | "android" | "web" | "desktop" | null;
3864
+ isActive: boolean;
3865
+ createdAt: Date;
3866
+ lastUsedAt: Date | null;
3867
+ expiresAt: Date | null;
3868
+ revokedAt: Date | null;
3869
+ revokedReason: string | null;
3870
+ }[]>;
3871
+ /**
3872
+ * 공개키 삭제
3873
+ * Write primary 사용
3874
+ */
3875
+ deleteByKeyIdAndUserId(keyId: string, userId: number): Promise<{
3793
3876
  userId: number;
3877
+ keyId: string;
3794
3878
  id: number;
3795
3879
  isActive: boolean;
3796
3880
  createdAt: Date;
3797
- expiresAt: Date | null;
3881
+ publicKey: string;
3882
+ algorithm: "ES256" | "RS256";
3883
+ fingerprint: string;
3884
+ deviceName: string | null;
3885
+ platform: "ios" | "android" | "web" | "desktop" | null;
3798
3886
  lastUsedAt: Date | null;
3887
+ expiresAt: Date | null;
3799
3888
  revokedAt: Date | null;
3800
3889
  revokedReason: string | null;
3801
3890
  }>;
@@ -3818,6 +3907,28 @@ declare class KeysRepository extends BaseRepository {
3818
3907
  publicKey: string;
3819
3908
  algorithm: "ES256" | "RS256";
3820
3909
  fingerprint: string;
3910
+ deviceName: string | null;
3911
+ platform: "ios" | "android" | "web" | "desktop" | null;
3912
+ isActive: boolean;
3913
+ createdAt: Date;
3914
+ lastUsedAt: Date | null;
3915
+ expiresAt: Date | null;
3916
+ revokedAt: Date | null;
3917
+ revokedReason: string | null;
3918
+ }>;
3919
+ /**
3920
+ * 만료 시각 연장 — 같은 사용자가 로그인으로 신원을 다시 증명했을 때 쓴다.
3921
+ * Write primary 사용
3922
+ */
3923
+ extendExpiry(keyId: string, userId: number, expiresAt: Date): Promise<{
3924
+ id: number;
3925
+ userId: number;
3926
+ keyId: string;
3927
+ publicKey: string;
3928
+ algorithm: "ES256" | "RS256";
3929
+ fingerprint: string;
3930
+ deviceName: string | null;
3931
+ platform: "ios" | "android" | "web" | "desktop" | null;
3821
3932
  isActive: boolean;
3822
3933
  createdAt: Date;
3823
3934
  lastUsedAt: Date | null;
@@ -3839,6 +3950,8 @@ declare class KeysRepository extends BaseRepository {
3839
3950
  publicKey: string;
3840
3951
  algorithm: "ES256" | "RS256";
3841
3952
  fingerprint: string;
3953
+ deviceName: string | null;
3954
+ platform: "ios" | "android" | "web" | "desktop" | null;
3842
3955
  isActive: boolean;
3843
3956
  createdAt: Date;
3844
3957
  lastUsedAt: Date | null;
@@ -3857,6 +3970,8 @@ declare class KeysRepository extends BaseRepository {
3857
3970
  publicKey: string;
3858
3971
  algorithm: "ES256" | "RS256";
3859
3972
  fingerprint: string;
3973
+ deviceName: string | null;
3974
+ platform: "ios" | "android" | "web" | "desktop" | null;
3860
3975
  isActive: boolean;
3861
3976
  createdAt: Date;
3862
3977
  lastUsedAt: Date | null;
@@ -3931,14 +4046,14 @@ declare class VerificationCodesRepository extends BaseRepository {
3931
4046
  * Write primary 사용
3932
4047
  */
3933
4048
  create(data: NewVerificationCode): Promise<{
3934
- target: string;
3935
- targetType: "email" | "phone";
3936
- purpose: "registration" | "login" | "password_reset" | "email_change" | "phone_change" | "account_deletion";
3937
- code: string;
3938
4049
  id: number;
3939
4050
  createdAt: Date;
3940
4051
  updatedAt: Date;
3941
4052
  expiresAt: Date;
4053
+ target: string;
4054
+ targetType: "email" | "phone";
4055
+ code: string;
4056
+ purpose: "registration" | "login" | "password_reset" | "email_change" | "phone_change" | "account_deletion";
3942
4057
  usedAt: Date | null;
3943
4058
  attempts: number;
3944
4059
  }>;
@@ -4071,8 +4186,8 @@ declare class RolesRepository extends BaseRepository {
4071
4186
  */
4072
4187
  create(data: NewRoleEntity): Promise<{
4073
4188
  description: string | null;
4074
- name: string;
4075
4189
  id: number;
4190
+ name: string;
4076
4191
  displayName: string;
4077
4192
  isBuiltin: boolean;
4078
4193
  isSystem: boolean;
@@ -4101,8 +4216,8 @@ declare class RolesRepository extends BaseRepository {
4101
4216
  */
4102
4217
  deleteById(id: number): Promise<{
4103
4218
  description: string | null;
4104
- name: string;
4105
4219
  id: number;
4220
+ name: string;
4106
4221
  displayName: string;
4107
4222
  isBuiltin: boolean;
4108
4223
  isSystem: boolean;
@@ -4135,7 +4250,7 @@ declare class PermissionsRepository extends BaseRepository {
4135
4250
  name: string;
4136
4251
  displayName: string;
4137
4252
  description: string | null;
4138
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
4253
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
4139
4254
  isBuiltin: boolean;
4140
4255
  isSystem: boolean;
4141
4256
  isActive: boolean;
@@ -4151,7 +4266,7 @@ declare class PermissionsRepository extends BaseRepository {
4151
4266
  name: string;
4152
4267
  displayName: string;
4153
4268
  description: string | null;
4154
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
4269
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
4155
4270
  isBuiltin: boolean;
4156
4271
  isSystem: boolean;
4157
4272
  isActive: boolean;
@@ -4191,7 +4306,7 @@ declare class PermissionsRepository extends BaseRepository {
4191
4306
  name: string;
4192
4307
  displayName: string;
4193
4308
  description: string | null;
4194
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
4309
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
4195
4310
  isBuiltin: boolean;
4196
4311
  isSystem: boolean;
4197
4312
  isActive: boolean;
@@ -4202,16 +4317,16 @@ declare class PermissionsRepository extends BaseRepository {
4202
4317
  */
4203
4318
  deleteById(id: number): Promise<{
4204
4319
  description: string | null;
4205
- metadata: Record<string, any> | null;
4206
- name: string;
4207
4320
  id: number;
4321
+ name: string;
4208
4322
  displayName: string;
4209
4323
  isBuiltin: boolean;
4210
4324
  isSystem: boolean;
4211
4325
  isActive: boolean;
4212
4326
  createdAt: Date;
4213
4327
  updatedAt: Date;
4214
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
4328
+ metadata: Record<string, any> | null;
4329
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
4215
4330
  }>;
4216
4331
  }
4217
4332
  declare const permissionsRepository: PermissionsRepository;
@@ -4256,9 +4371,9 @@ declare class RolePermissionsRepository extends BaseRepository {
4256
4371
  */
4257
4372
  createMany(data: NewRolePermission[]): Promise<{
4258
4373
  id: number;
4259
- roleId: number;
4260
4374
  createdAt: Date;
4261
4375
  updatedAt: Date;
4376
+ roleId: number;
4262
4377
  permissionId: number;
4263
4378
  }[]>;
4264
4379
  /**
@@ -4274,9 +4389,9 @@ declare class RolePermissionsRepository extends BaseRepository {
4274
4389
  */
4275
4390
  setPermissionsForRole(roleId: number, permissionIds: number[]): Promise<{
4276
4391
  id: number;
4277
- roleId: number;
4278
4392
  createdAt: Date;
4279
4393
  updatedAt: Date;
4394
+ roleId: number;
4280
4395
  permissionId: number;
4281
4396
  }[]>;
4282
4397
  }
@@ -4341,9 +4456,9 @@ declare class UserPermissionsRepository extends BaseRepository {
4341
4456
  id: number;
4342
4457
  createdAt: Date;
4343
4458
  updatedAt: Date;
4344
- permissionId: number;
4345
- reason: string | null;
4346
4459
  expiresAt: Date | null;
4460
+ reason: string | null;
4461
+ permissionId: number;
4347
4462
  granted: boolean;
4348
4463
  }>;
4349
4464
  /**
@@ -4367,9 +4482,9 @@ declare class UserPermissionsRepository extends BaseRepository {
4367
4482
  id: number;
4368
4483
  createdAt: Date;
4369
4484
  updatedAt: Date;
4370
- permissionId: number;
4371
- reason: string | null;
4372
4485
  expiresAt: Date | null;
4486
+ reason: string | null;
4487
+ permissionId: number;
4373
4488
  granted: boolean;
4374
4489
  }>;
4375
4490
  /**
@@ -4448,7 +4563,6 @@ declare class UserProfilesRepository extends BaseRepository {
4448
4563
  * 프로필 생성
4449
4564
  */
4450
4565
  create(data: NewUserProfile): Promise<{
4451
- metadata: Record<string, any> | null;
4452
4566
  userId: number;
4453
4567
  id: number;
4454
4568
  displayName: string | null;
@@ -4466,6 +4580,7 @@ declare class UserProfilesRepository extends BaseRepository {
4466
4580
  location: string | null;
4467
4581
  company: string | null;
4468
4582
  jobTitle: string | null;
4583
+ metadata: Record<string, any> | null;
4469
4584
  }>;
4470
4585
  /**
4471
4586
  * 프로필 업데이트 (by ID)
@@ -4517,7 +4632,6 @@ declare class UserProfilesRepository extends BaseRepository {
4517
4632
  * 프로필 삭제 (by ID)
4518
4633
  */
4519
4634
  deleteById(id: number): Promise<{
4520
- metadata: Record<string, any> | null;
4521
4635
  userId: number;
4522
4636
  id: number;
4523
4637
  displayName: string | null;
@@ -4535,12 +4649,12 @@ declare class UserProfilesRepository extends BaseRepository {
4535
4649
  location: string | null;
4536
4650
  company: string | null;
4537
4651
  jobTitle: string | null;
4652
+ metadata: Record<string, any> | null;
4538
4653
  }>;
4539
4654
  /**
4540
4655
  * 프로필 삭제 (by User ID)
4541
4656
  */
4542
4657
  deleteByUserId(userId: number): Promise<{
4543
- metadata: Record<string, any> | null;
4544
4658
  userId: number;
4545
4659
  id: number;
4546
4660
  displayName: string | null;
@@ -4558,6 +4672,7 @@ declare class UserProfilesRepository extends BaseRepository {
4558
4672
  location: string | null;
4559
4673
  company: string | null;
4560
4674
  jobTitle: string | null;
4675
+ metadata: Record<string, any> | null;
4561
4676
  }>;
4562
4677
  /**
4563
4678
  * 프로필 Upsert (by User ID)
@@ -4566,7 +4681,6 @@ declare class UserProfilesRepository extends BaseRepository {
4566
4681
  * 새로 생성 시 displayName은 필수 (없으면 'User'로 설정)
4567
4682
  */
4568
4683
  upsertByUserId(userId: number, data: Partial<Omit<NewUserProfile, 'userId'>>): Promise<{
4569
- metadata: Record<string, any> | null;
4570
4684
  userId: number;
4571
4685
  id: number;
4572
4686
  displayName: string | null;
@@ -4584,6 +4698,7 @@ declare class UserProfilesRepository extends BaseRepository {
4584
4698
  location: string | null;
4585
4699
  company: string | null;
4586
4700
  jobTitle: string | null;
4701
+ metadata: Record<string, any> | null;
4587
4702
  }>;
4588
4703
  /**
4589
4704
  * User ID로 프로필 데이터 조회 (formatted)
@@ -4711,15 +4826,15 @@ declare class InvitationsRepository extends BaseRepository {
4711
4826
  */
4712
4827
  create(data: NewInvitation): Promise<{
4713
4828
  email: string;
4714
- metadata: Record<string, any> | null;
4829
+ status: "pending" | "accepted" | "expired" | "cancelled";
4715
4830
  id: number;
4716
- roleId: number;
4717
4831
  createdAt: Date;
4718
4832
  updatedAt: Date;
4719
- status: "pending" | "accepted" | "expired" | "cancelled";
4833
+ roleId: number;
4834
+ metadata: Record<string, any> | null;
4835
+ expiresAt: Date;
4720
4836
  token: string;
4721
4837
  invitedBy: number;
4722
- expiresAt: Date;
4723
4838
  acceptedAt: Date | null;
4724
4839
  cancelledAt: Date | null;
4725
4840
  }>;
@@ -4745,15 +4860,15 @@ declare class InvitationsRepository extends BaseRepository {
4745
4860
  */
4746
4861
  deleteById(id: number): Promise<{
4747
4862
  email: string;
4748
- metadata: Record<string, any> | null;
4863
+ status: "pending" | "accepted" | "expired" | "cancelled";
4749
4864
  id: number;
4750
- roleId: number;
4751
4865
  createdAt: Date;
4752
4866
  updatedAt: Date;
4753
- status: "pending" | "accepted" | "expired" | "cancelled";
4867
+ roleId: number;
4868
+ metadata: Record<string, any> | null;
4869
+ expiresAt: Date;
4754
4870
  token: string;
4755
4871
  invitedBy: number;
4756
- expiresAt: Date;
4757
4872
  acceptedAt: Date | null;
4758
4873
  cancelledAt: Date | null;
4759
4874
  }>;
@@ -5069,7 +5184,7 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
5069
5184
  requestedAt: Date;
5070
5185
  purgeScheduledAt: Date;
5071
5186
  status: "pending" | "cancelled" | "completed";
5072
- requestedBy: "admin" | "self";
5187
+ requestedBy: "self" | "admin";
5073
5188
  reason: string | null;
5074
5189
  cancelledAt: Date | null;
5075
5190
  completedAt: Date | null;
@@ -5088,7 +5203,7 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
5088
5203
  requestedAt: Date;
5089
5204
  purgeScheduledAt: Date;
5090
5205
  status: "pending" | "cancelled" | "completed";
5091
- requestedBy: "admin" | "self";
5206
+ requestedBy: "self" | "admin";
5092
5207
  reason: string | null;
5093
5208
  cancelledAt: Date | null;
5094
5209
  completedAt: Date | null;
@@ -5110,7 +5225,7 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
5110
5225
  requestedAt: Date;
5111
5226
  purgeScheduledAt: Date;
5112
5227
  status: "pending" | "cancelled" | "completed";
5113
- requestedBy: "admin" | "self";
5228
+ requestedBy: "self" | "admin";
5114
5229
  reason: string | null;
5115
5230
  cancelledAt: Date | null;
5116
5231
  completedAt: Date | null;
@@ -5129,7 +5244,7 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
5129
5244
  requestedAt: Date;
5130
5245
  purgeScheduledAt: Date;
5131
5246
  status: "pending" | "cancelled" | "completed";
5132
- requestedBy: "admin" | "self";
5247
+ requestedBy: "self" | "admin";
5133
5248
  reason: string | null;
5134
5249
  cancelledAt: Date | null;
5135
5250
  completedAt: Date | null;
@@ -5141,16 +5256,16 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
5141
5256
  */
5142
5257
  create(data: NewAccountDeletionRequest): Promise<{
5143
5258
  userId: number | null;
5259
+ status: "pending" | "cancelled" | "completed";
5260
+ purgeScheduledAt: Date;
5144
5261
  id: number;
5145
5262
  createdAt: Date;
5146
5263
  updatedAt: Date;
5147
- status: "pending" | "cancelled" | "completed";
5148
- reason: string | null;
5149
- purgeScheduledAt: Date;
5150
5264
  cancelledAt: Date | null;
5151
5265
  userPublicId: string;
5152
5266
  requestedAt: Date;
5153
- requestedBy: "admin" | "self";
5267
+ requestedBy: "self" | "admin";
5268
+ reason: string | null;
5154
5269
  completedAt: Date | null;
5155
5270
  purgeStrategy: "anonymize" | "hard-delete" | null;
5156
5271
  }>;
@@ -5171,7 +5286,7 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
5171
5286
  requestedAt: Date;
5172
5287
  purgeScheduledAt: Date;
5173
5288
  status: "pending" | "cancelled" | "completed";
5174
- requestedBy: "admin" | "self";
5289
+ requestedBy: "self" | "admin";
5175
5290
  reason: string | null;
5176
5291
  cancelledAt: Date | null;
5177
5292
  completedAt: Date | null;
@@ -5196,7 +5311,7 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
5196
5311
  requestedAt: Date;
5197
5312
  purgeScheduledAt: Date;
5198
5313
  status: "pending" | "cancelled" | "completed";
5199
- requestedBy: "admin" | "self";
5314
+ requestedBy: "self" | "admin";
5200
5315
  reason: string | null;
5201
5316
  cancelledAt: Date | null;
5202
5317
  completedAt: Date | null;
@@ -5648,15 +5763,15 @@ declare function getUser(c: Context | {
5648
5763
  }): {
5649
5764
  email: string | null;
5650
5765
  phone: string | null;
5766
+ status: "active" | "inactive" | "suspended" | "pending_deletion" | "deleted";
5767
+ username: string | null;
5651
5768
  id: number;
5769
+ createdAt: Date;
5770
+ updatedAt: Date;
5652
5771
  publicId: string;
5653
- username: string | null;
5654
5772
  passwordHash: string | null;
5655
5773
  passwordChangeRequired: boolean;
5656
5774
  roleId: number;
5657
- createdAt: Date;
5658
- updatedAt: Date;
5659
- status: "active" | "inactive" | "suspended" | "pending_deletion" | "deleted";
5660
5775
  emailVerifiedAt: Date | null;
5661
5776
  phoneVerifiedAt: Date | null;
5662
5777
  lastLoginAt: Date | null;
@@ -6333,7 +6448,7 @@ declare const authLoginEvent: _spfn_core_event.EventDef<{
6333
6448
  email?: string | undefined;
6334
6449
  phone?: string | undefined;
6335
6450
  userId: string;
6336
- provider: "email" | "phone" | "google" | "apple" | "github" | "kakao" | "naver" | "superself";
6451
+ provider: "google" | "apple" | "github" | "kakao" | "naver" | "superself" | "email" | "phone";
6337
6452
  }>;
6338
6453
  /**
6339
6454
  * auth.register - 회원가입 성공 이벤트
@@ -6356,7 +6471,7 @@ declare const authRegisterEvent: _spfn_core_event.EventDef<{
6356
6471
  [x: string]: unknown;
6357
6472
  } | undefined;
6358
6473
  userId: string;
6359
- provider: "email" | "phone" | "google" | "apple" | "github" | "kakao" | "naver" | "superself";
6474
+ provider: "google" | "apple" | "github" | "kakao" | "naver" | "superself" | "email" | "phone";
6360
6475
  }>;
6361
6476
  /**
6362
6477
  * auth.invitation.created - 초대 생성 이벤트
@@ -6384,9 +6499,9 @@ declare const invitationCreatedEvent: _spfn_core_event.EventDef<{
6384
6499
  } | undefined;
6385
6500
  email: string;
6386
6501
  roleId: number;
6502
+ expiresAt: string;
6387
6503
  token: string;
6388
6504
  invitedBy: string;
6389
- expiresAt: string;
6390
6505
  invitationId: string;
6391
6506
  isResend: boolean;
6392
6507
  }>;
@@ -6430,7 +6545,7 @@ declare const authDeletionRequestedEvent: _spfn_core_event.EventDef<{
6430
6545
  userId: string;
6431
6546
  purgeScheduledAt: string;
6432
6547
  userPublicId: string;
6433
- requestedBy: "admin" | "self";
6548
+ requestedBy: "self" | "admin";
6434
6549
  }>;
6435
6550
  /**
6436
6551
  * auth.deletion.cancelled - 계정 탈퇴 복구 이벤트
@@ -6475,7 +6590,7 @@ declare const authDeletionCompletedEvent: _spfn_core_event.EventDef<{
6475
6590
  declare const oauthUnlinkedEvent: _spfn_core_event.EventDef<{
6476
6591
  reason?: string | undefined;
6477
6592
  userId: string;
6478
- provider: "email" | "phone" | "google" | "apple" | "github" | "kakao" | "naver" | "superself";
6593
+ provider: "google" | "apple" | "github" | "kakao" | "naver" | "superself" | "email" | "phone";
6479
6594
  providerUserId: string;
6480
6595
  }>;
6481
6596
  /**