@spfn/auth 0.2.1 → 0.3.0-beta.1
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/LICENSE +1 -1
- package/README.md +1032 -2397
- package/dist/{authenticate-eucncHxN.d.ts → authenticate-DlTGaBT8.d.ts} +545 -82
- package/dist/client-proof.d.ts +606 -0
- package/dist/client-proof.js +1842 -0
- package/dist/client-proof.js.map +1 -0
- package/dist/config.d.ts +319 -3
- package/dist/config.js +155 -5
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +180 -3
- package/dist/errors.js +116 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +122 -18
- package/dist/index.js +129 -8
- package/dist/index.js.map +1 -1
- package/dist/nextjs/api.js +404 -96
- package/dist/nextjs/api.js.map +1 -1
- package/dist/nextjs/server.d.ts +5 -4
- package/dist/nextjs/server.js +165 -26
- package/dist/nextjs/server.js.map +1 -1
- package/dist/server.d.ts +2130 -1016
- package/dist/server.js +4916 -739
- package/dist/server.js.map +1 -1
- package/dist/session-DTHahDQ9.d.ts +53 -0
- package/dist/types-DYyhze28.d.ts +98 -0
- package/dist/wire-version-CtzMKvBB.d.ts +134 -0
- package/migrations/20251125021229_premium_famine/snapshot.json +2641 -0
- package/migrations/20260225130050_smooth_the_fury/snapshot.json +2686 -0
- package/migrations/20260308141417_deep_iceman/snapshot.json +2686 -0
- package/migrations/20260308151309_perfect_deathbird/snapshot.json +2731 -0
- package/migrations/20260308201135_concerned_rawhide_kid/snapshot.json +2786 -0
- package/migrations/20260629103209_lethal_lifeguard/migration.sql +32 -0
- package/migrations/20260629103209_lethal_lifeguard/snapshot.json +2786 -0
- package/migrations/20260709073531_easy_hardball/migration.sql +24 -0
- package/migrations/20260709073531_easy_hardball/snapshot.json +3119 -0
- package/migrations/20260714081434_glossy_major_mapleleaf/migration.sql +1 -0
- package/migrations/20260714081434_glossy_major_mapleleaf/snapshot.json +3112 -0
- package/migrations/20260804105939_amazing_bushwacker/migration.sql +3 -0
- package/migrations/20260804105939_amazing_bushwacker/snapshot.json +3112 -0
- package/migrations/20260804110033_fat_piledriver/migration.sql +2 -0
- package/migrations/20260804110033_fat_piledriver/snapshot.json +3138 -0
- package/migrations/20260805143152_vengeful_ravenous/migration.sql +4 -0
- package/migrations/20260805143152_vengeful_ravenous/snapshot.json +3190 -0
- package/package.json +54 -40
- package/migrations/meta/0000_snapshot.json +0 -1632
- package/migrations/meta/0001_snapshot.json +0 -1660
- package/migrations/meta/0002_snapshot.json +0 -1660
- package/migrations/meta/0003_snapshot.json +0 -1689
- package/migrations/meta/0004_snapshot.json +0 -1721
- package/migrations/meta/_journal.json +0 -41
- /package/migrations/{0000_premium_famine.sql → 20251125021229_premium_famine/migration.sql} +0 -0
- /package/migrations/{0001_smooth_the_fury.sql → 20260225130050_smooth_the_fury/migration.sql} +0 -0
- /package/migrations/{0002_deep_iceman.sql → 20260308141417_deep_iceman/migration.sql} +0 -0
- /package/migrations/{0003_perfect_deathbird.sql → 20260308151309_perfect_deathbird/migration.sql} +0 -0
- /package/migrations/{0004_concerned_rawhide_kid.sql → 20260308201135_concerned_rawhide_kid/migration.sql} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as _spfn_core_nextjs from '@spfn/core/nextjs';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { P as PermissionConfig, R as RoleConfig, m as mainAuthRouter, S as SendVerificationCodeResult, a as RegisterResult, L as LoginResult, b as RotateKeyResult, K as KeySummary, c as RevokeAllKeysResult, I as IssueOneTimeTokenResult, O as OAuthStartResult, d as OAuthNativeResult, U as UserProfile, e as ProfileInfo } from './authenticate-DlTGaBT8.js';
|
|
3
|
+
export { A as AuthInitOptions, f as AuthSession, g as PERMISSION_CATEGORIES, h as PermissionCategory, V as VERIFICATION_PURPOSES, i as VERIFICATION_TARGET_TYPES, j as VerificationPurpose, k as VerificationTargetType } from './authenticate-DlTGaBT8.js';
|
|
4
4
|
import * as _spfn_core_route from '@spfn/core/route';
|
|
5
5
|
import { HttpMethod } from '@spfn/core/route';
|
|
6
|
+
export { A as ACCOUNT_DELETION_REQUESTED_BY, a as ACCOUNT_DELETION_REQUEST_STATUSES, b as AccountDeletionRequestStatus, c as AccountDeletionRequestedBy, I as INVITATION_STATUSES, d as InvitationStatus, e as KEY_ALGORITHM, f as KEY_DEVICE_NAME_MAX_LENGTH, g as KEY_PLATFORM, K as KeyAlgorithmType, h as KeyPlatformType, P as PURGE_STRATEGIES, i as PurgeStrategy, S as SOCIAL_PROVIDERS, j as SocialProvider, U as USER_STATUSES, k as UserStatus } from './types-DYyhze28.js';
|
|
6
7
|
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
8
|
+
import 'hono';
|
|
7
9
|
import '@spfn/auth/server';
|
|
8
10
|
|
|
9
11
|
/**
|
|
@@ -87,18 +89,11 @@ declare const routeMap: Record<string, RouteInfo>;
|
|
|
87
89
|
* ```
|
|
88
90
|
*/
|
|
89
91
|
declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
90
|
-
checkAccountExists: _spfn_core_route.RouteDef<{
|
|
91
|
-
body: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{
|
|
92
|
-
email: _sinclair_typebox.TString;
|
|
93
|
-
}>, _sinclair_typebox.TObject<{
|
|
94
|
-
phone: _sinclair_typebox.TString;
|
|
95
|
-
}>]>;
|
|
96
|
-
}, {}, CheckAccountExistsResult>;
|
|
97
92
|
sendVerificationCode: _spfn_core_route.RouteDef<{
|
|
98
93
|
body: _sinclair_typebox.TObject<{
|
|
99
94
|
target: _sinclair_typebox.TString;
|
|
100
95
|
targetType: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"email">, _sinclair_typebox.TLiteral<"phone">]>;
|
|
101
|
-
purpose: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"registration">, _sinclair_typebox.TLiteral<"login">, _sinclair_typebox.TLiteral<"password_reset">, _sinclair_typebox.TLiteral<"email_change">, _sinclair_typebox.TLiteral<"phone_change">]>;
|
|
96
|
+
purpose: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"registration">, _sinclair_typebox.TLiteral<"login">, _sinclair_typebox.TLiteral<"password_reset">, _sinclair_typebox.TLiteral<"email_change">, _sinclair_typebox.TLiteral<"phone_change">, _sinclair_typebox.TLiteral<"account_deletion">]>;
|
|
102
97
|
}>;
|
|
103
98
|
}, {}, SendVerificationCodeResult>;
|
|
104
99
|
verifyCode: _spfn_core_route.RouteDef<{
|
|
@@ -106,7 +101,7 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
|
106
101
|
target: _sinclair_typebox.TString;
|
|
107
102
|
targetType: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"email">, _sinclair_typebox.TLiteral<"phone">]>;
|
|
108
103
|
code: _sinclair_typebox.TString;
|
|
109
|
-
purpose: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"registration">, _sinclair_typebox.TLiteral<"login">, _sinclair_typebox.TLiteral<"password_reset">, _sinclair_typebox.TLiteral<"email_change">, _sinclair_typebox.TLiteral<"phone_change">]>;
|
|
104
|
+
purpose: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"registration">, _sinclair_typebox.TLiteral<"login">, _sinclair_typebox.TLiteral<"password_reset">, _sinclair_typebox.TLiteral<"email_change">, _sinclair_typebox.TLiteral<"phone_change">, _sinclair_typebox.TLiteral<"account_deletion">]>;
|
|
110
105
|
}>;
|
|
111
106
|
}, {}, {
|
|
112
107
|
valid: boolean;
|
|
@@ -126,6 +121,8 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
|
126
121
|
keyId: _sinclair_typebox.TString;
|
|
127
122
|
fingerprint: _sinclair_typebox.TString;
|
|
128
123
|
algorithm: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ES256" | "RS256">[]>;
|
|
124
|
+
deviceName: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
125
|
+
platform: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ios" | "android" | "web" | "desktop">[]>>;
|
|
129
126
|
}>;
|
|
130
127
|
}, RegisterResult>;
|
|
131
128
|
login: _spfn_core_route.RouteDef<{
|
|
@@ -141,6 +138,8 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
|
141
138
|
fingerprint: _sinclair_typebox.TString;
|
|
142
139
|
algorithm: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ES256" | "RS256">[]>;
|
|
143
140
|
oldKeyId: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
141
|
+
deviceName: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
142
|
+
platform: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ios" | "android" | "web" | "desktop">[]>>;
|
|
144
143
|
}>;
|
|
145
144
|
}, LoginResult>;
|
|
146
145
|
logout: _spfn_core_route.RouteDef<{}, {}, void>;
|
|
@@ -150,11 +149,33 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
|
150
149
|
keyId: _sinclair_typebox.TString;
|
|
151
150
|
fingerprint: _sinclair_typebox.TString;
|
|
152
151
|
algorithm: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ES256" | "RS256">[]>;
|
|
152
|
+
deviceName: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
153
|
+
platform: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ios" | "android" | "web" | "desktop">[]>>;
|
|
153
154
|
}>;
|
|
154
155
|
}, RotateKeyResult>;
|
|
156
|
+
listKeys: _spfn_core_route.RouteDef<{
|
|
157
|
+
body: _sinclair_typebox.TObject<{
|
|
158
|
+
includeRevoked: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
|
|
159
|
+
}>;
|
|
160
|
+
}, {}, {
|
|
161
|
+
keys: KeySummary[];
|
|
162
|
+
}>;
|
|
163
|
+
revokeKey: _spfn_core_route.RouteDef<{
|
|
164
|
+
body: _sinclair_typebox.TObject<{
|
|
165
|
+
keyId: _sinclair_typebox.TString;
|
|
166
|
+
}>;
|
|
167
|
+
}, {}, {
|
|
168
|
+
keyId: string;
|
|
169
|
+
selfRevoked: boolean;
|
|
170
|
+
}>;
|
|
171
|
+
revokeAllKeys: _spfn_core_route.RouteDef<{
|
|
172
|
+
body: _sinclair_typebox.TObject<{
|
|
173
|
+
includeCurrent: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
|
|
174
|
+
}>;
|
|
175
|
+
}, {}, RevokeAllKeysResult>;
|
|
155
176
|
changePassword: _spfn_core_route.RouteDef<{
|
|
156
177
|
body: _sinclair_typebox.TObject<{
|
|
157
|
-
currentPassword: _sinclair_typebox.TString
|
|
178
|
+
currentPassword: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
158
179
|
newPassword: _sinclair_typebox.TString;
|
|
159
180
|
}>;
|
|
160
181
|
}, {}, void>;
|
|
@@ -176,8 +197,27 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
|
176
197
|
email: string | null;
|
|
177
198
|
emailVerified: boolean;
|
|
178
199
|
phoneVerified: boolean;
|
|
200
|
+
hasPassword: boolean;
|
|
179
201
|
}>;
|
|
180
202
|
issueOneTimeToken: _spfn_core_route.RouteDef<{}, {}, IssueOneTimeTokenResult>;
|
|
203
|
+
requestAccountDeletion: _spfn_core_route.RouteDef<{
|
|
204
|
+
body: _sinclair_typebox.TObject<{
|
|
205
|
+
password: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
206
|
+
verificationToken: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
207
|
+
reason: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
208
|
+
immediate: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
|
|
209
|
+
}>;
|
|
210
|
+
}, {}, {
|
|
211
|
+
purgeScheduledAt: string;
|
|
212
|
+
}>;
|
|
213
|
+
cancelAccountDeletion: _spfn_core_route.RouteDef<{
|
|
214
|
+
body: _sinclair_typebox.TObject<{
|
|
215
|
+
email: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
216
|
+
phone: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
217
|
+
password: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
218
|
+
verificationToken: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
219
|
+
}>;
|
|
220
|
+
}, {}, void>;
|
|
181
221
|
oauthGoogleStart: _spfn_core_route.RouteDef<{
|
|
182
222
|
query: _sinclair_typebox.TObject<{
|
|
183
223
|
state: _sinclair_typebox.TString;
|
|
@@ -193,7 +233,7 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
|
193
233
|
}, {}, Response>;
|
|
194
234
|
oauthStart: _spfn_core_route.RouteDef<{
|
|
195
235
|
body: _sinclair_typebox.TObject<{
|
|
196
|
-
provider: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"google" | "github" | "kakao" | "naver">[]>;
|
|
236
|
+
provider: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"google" | "apple" | "github" | "kakao" | "naver" | "superself">[]>;
|
|
197
237
|
returnUrl: _sinclair_typebox.TString;
|
|
198
238
|
publicKey: _sinclair_typebox.TString;
|
|
199
239
|
keyId: _sinclair_typebox.TString;
|
|
@@ -203,11 +243,12 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
|
203
243
|
}>;
|
|
204
244
|
}, {}, OAuthStartResult>;
|
|
205
245
|
oauthProviders: _spfn_core_route.RouteDef<{}, {}, {
|
|
206
|
-
providers: ("google" | "github" | "kakao" | "naver")[];
|
|
246
|
+
providers: ("google" | "apple" | "github" | "kakao" | "naver" | "superself")[];
|
|
207
247
|
}>;
|
|
208
248
|
getGoogleOAuthUrl: _spfn_core_route.RouteDef<{
|
|
209
249
|
body: _sinclair_typebox.TObject<{
|
|
210
250
|
returnUrl: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
251
|
+
metadata: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TUnknown>>;
|
|
211
252
|
state: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
212
253
|
}>;
|
|
213
254
|
}, {}, {
|
|
@@ -225,6 +266,67 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
|
225
266
|
keyId: string;
|
|
226
267
|
returnUrl: string;
|
|
227
268
|
}>;
|
|
269
|
+
oauthProviderStart: _spfn_core_route.RouteDef<{
|
|
270
|
+
params: _sinclair_typebox.TObject<{
|
|
271
|
+
provider: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"google" | "apple" | "github" | "kakao" | "naver" | "superself">[]>;
|
|
272
|
+
}>;
|
|
273
|
+
query: _sinclair_typebox.TObject<{
|
|
274
|
+
state: _sinclair_typebox.TString;
|
|
275
|
+
}>;
|
|
276
|
+
}, {}, Response>;
|
|
277
|
+
oauthProviderCallback: _spfn_core_route.RouteDef<{
|
|
278
|
+
params: _sinclair_typebox.TObject<{
|
|
279
|
+
provider: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"google" | "apple" | "github" | "kakao" | "naver" | "superself">[]>;
|
|
280
|
+
}>;
|
|
281
|
+
query: _sinclair_typebox.TObject<{
|
|
282
|
+
code: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
283
|
+
state: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
284
|
+
error: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
285
|
+
error_description: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
286
|
+
}>;
|
|
287
|
+
}, {}, Response>;
|
|
288
|
+
getProviderOAuthUrl: _spfn_core_route.RouteDef<{
|
|
289
|
+
params: _sinclair_typebox.TObject<{
|
|
290
|
+
provider: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"google" | "apple" | "github" | "kakao" | "naver" | "superself">[]>;
|
|
291
|
+
}>;
|
|
292
|
+
body: _sinclair_typebox.TObject<{
|
|
293
|
+
returnUrl: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
294
|
+
metadata: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TUnknown>>;
|
|
295
|
+
state: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
296
|
+
}>;
|
|
297
|
+
}, {}, {
|
|
298
|
+
authUrl: string;
|
|
299
|
+
}>;
|
|
300
|
+
oauthNative: _spfn_core_route.RouteDef<{
|
|
301
|
+
params: _sinclair_typebox.TObject<{
|
|
302
|
+
provider: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"google" | "apple" | "github" | "kakao" | "naver" | "superself">[]>;
|
|
303
|
+
}>;
|
|
304
|
+
body: _sinclair_typebox.TObject<{
|
|
305
|
+
idToken: _sinclair_typebox.TString;
|
|
306
|
+
nonce: _sinclair_typebox.TString;
|
|
307
|
+
accessToken: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
308
|
+
publicKey: _sinclair_typebox.TString;
|
|
309
|
+
keyId: _sinclair_typebox.TString;
|
|
310
|
+
fingerprint: _sinclair_typebox.TString;
|
|
311
|
+
algorithm: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ES256" | "RS256">[]>;
|
|
312
|
+
deviceName: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
313
|
+
platform: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ios" | "android" | "web" | "desktop">[]>>;
|
|
314
|
+
profile: _sinclair_typebox.TOptional<_sinclair_typebox.TObject<{
|
|
315
|
+
name: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
316
|
+
}>>;
|
|
317
|
+
metadata: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TUnknown>>;
|
|
318
|
+
}>;
|
|
319
|
+
}, {}, OAuthNativeResult>;
|
|
320
|
+
oauthUnlinkNotify: _spfn_core_route.RouteDef<{
|
|
321
|
+
params: _sinclair_typebox.TObject<{
|
|
322
|
+
provider: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"google" | "apple" | "github" | "kakao" | "naver" | "superself">[]>;
|
|
323
|
+
}>;
|
|
324
|
+
}, {}, void | Response>;
|
|
325
|
+
oauthUnlinkNotifyGet: _spfn_core_route.RouteDef<{
|
|
326
|
+
params: _sinclair_typebox.TObject<{
|
|
327
|
+
provider: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"google" | "apple" | "github" | "kakao" | "naver" | "superself">[]>;
|
|
328
|
+
}>;
|
|
329
|
+
}, {}, void | Response>;
|
|
228
330
|
getInvitation: _spfn_core_route.RouteDef<{
|
|
229
331
|
params: _sinclair_typebox.TObject<{
|
|
230
332
|
token: _sinclair_typebox.TString;
|
|
@@ -357,6 +459,8 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
|
357
459
|
username: _sinclair_typebox.TUnion<[_sinclair_typebox.TString, _sinclair_typebox.TNull]>;
|
|
358
460
|
}>;
|
|
359
461
|
}, {}, {
|
|
462
|
+
deletedAt: Date | null;
|
|
463
|
+
deletedBy: string | null;
|
|
360
464
|
createdAt: Date;
|
|
361
465
|
updatedAt: Date;
|
|
362
466
|
id: number;
|
|
@@ -367,7 +471,7 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
|
367
471
|
passwordHash: string | null;
|
|
368
472
|
passwordChangeRequired: boolean;
|
|
369
473
|
roleId: number;
|
|
370
|
-
status: "active" | "inactive" | "suspended";
|
|
474
|
+
status: "active" | "inactive" | "suspended" | "pending_deletion" | "deleted";
|
|
371
475
|
emailVerifiedAt: Date | null;
|
|
372
476
|
phoneVerifiedAt: Date | null;
|
|
373
477
|
lastLoginAt: Date | null;
|
|
@@ -386,8 +490,8 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
|
386
490
|
}, {}, {
|
|
387
491
|
roles: {
|
|
388
492
|
description: string | null;
|
|
389
|
-
id: number;
|
|
390
493
|
name: string;
|
|
494
|
+
id: number;
|
|
391
495
|
displayName: string;
|
|
392
496
|
isBuiltin: boolean;
|
|
393
497
|
isSystem: boolean;
|
|
@@ -408,8 +512,8 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
|
408
512
|
}, {}, {
|
|
409
513
|
role: {
|
|
410
514
|
description: string | null;
|
|
411
|
-
id: number;
|
|
412
515
|
name: string;
|
|
516
|
+
id: number;
|
|
413
517
|
displayName: string;
|
|
414
518
|
isBuiltin: boolean;
|
|
415
519
|
isSystem: boolean;
|
|
@@ -432,8 +536,8 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
|
432
536
|
}, {}, {
|
|
433
537
|
role: {
|
|
434
538
|
description: string | null;
|
|
435
|
-
id: number;
|
|
436
539
|
name: string;
|
|
540
|
+
id: number;
|
|
437
541
|
displayName: string;
|
|
438
542
|
isBuiltin: boolean;
|
|
439
543
|
isSystem: boolean;
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,8 @@ import {
|
|
|
15
15
|
ValidationError,
|
|
16
16
|
UnauthorizedError,
|
|
17
17
|
ForbiddenError,
|
|
18
|
-
ConflictError
|
|
18
|
+
ConflictError,
|
|
19
|
+
NotFoundError
|
|
19
20
|
} from "@spfn/core/errors";
|
|
20
21
|
var InvalidCredentialsError = class extends UnauthorizedError {
|
|
21
22
|
constructor(data = {}) {
|
|
@@ -29,6 +30,12 @@ var InvalidTokenError = class extends UnauthorizedError {
|
|
|
29
30
|
this.name = "InvalidTokenError";
|
|
30
31
|
}
|
|
31
32
|
};
|
|
33
|
+
var InvalidSocialTokenError = class extends UnauthorizedError {
|
|
34
|
+
constructor(data = {}) {
|
|
35
|
+
super({ message: data.message || "Invalid social id_token", details: data.details });
|
|
36
|
+
this.name = "InvalidSocialTokenError";
|
|
37
|
+
}
|
|
38
|
+
};
|
|
32
39
|
var TokenExpiredError = class extends UnauthorizedError {
|
|
33
40
|
constructor(data = {}) {
|
|
34
41
|
super({ message: data.message || "Authentication token has expired", details: data.details });
|
|
@@ -51,6 +58,33 @@ var AccountDisabledError = class extends ForbiddenError {
|
|
|
51
58
|
this.name = "AccountDisabledError";
|
|
52
59
|
}
|
|
53
60
|
};
|
|
61
|
+
var AccountPendingDeletionError = class extends ForbiddenError {
|
|
62
|
+
constructor(data = {}) {
|
|
63
|
+
super({
|
|
64
|
+
message: data.message || "Account is scheduled for deletion",
|
|
65
|
+
details: { status: "pending_deletion", purgeScheduledAt: data.purgeScheduledAt, ...data.details }
|
|
66
|
+
});
|
|
67
|
+
this.name = "AccountPendingDeletionError";
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
var DeletionAlreadyRequestedError = class extends ConflictError {
|
|
71
|
+
constructor(data = {}) {
|
|
72
|
+
super({ message: data.message || "Account deletion has already been requested", details: data.details });
|
|
73
|
+
this.name = "DeletionAlreadyRequestedError";
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var DeletionNotRequestedError = class extends NotFoundError {
|
|
77
|
+
constructor(data = {}) {
|
|
78
|
+
super({ message: data.message || "No pending account deletion request found", details: data.details });
|
|
79
|
+
this.name = "DeletionNotRequestedError";
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
var ImmediateDeletionNotAllowedError = class extends ForbiddenError {
|
|
83
|
+
constructor(data = {}) {
|
|
84
|
+
super({ message: data.message || "Immediate self-service deletion is not enabled", details: data.details });
|
|
85
|
+
this.name = "ImmediateDeletionNotAllowedError";
|
|
86
|
+
}
|
|
87
|
+
};
|
|
54
88
|
var AccountAlreadyExistsError = class extends ConflictError {
|
|
55
89
|
constructor(data = {}) {
|
|
56
90
|
super({
|
|
@@ -64,6 +98,12 @@ var AccountAlreadyExistsError = class extends ConflictError {
|
|
|
64
98
|
this.name = "AccountAlreadyExistsError";
|
|
65
99
|
}
|
|
66
100
|
};
|
|
101
|
+
var RegistrationRejectedError = class extends ForbiddenError {
|
|
102
|
+
constructor(data = {}) {
|
|
103
|
+
super({ message: data.message || "Registration rejected", details: data.details });
|
|
104
|
+
this.name = "RegistrationRejectedError";
|
|
105
|
+
}
|
|
106
|
+
};
|
|
67
107
|
var InvalidVerificationCodeError = class extends ValidationError {
|
|
68
108
|
constructor(data = {}) {
|
|
69
109
|
super({ message: data.message || "Invalid verification code", details: data.details });
|
|
@@ -76,12 +116,54 @@ var InvalidVerificationTokenError = class extends ValidationError {
|
|
|
76
116
|
this.name = "InvalidVerificationTokenError";
|
|
77
117
|
}
|
|
78
118
|
};
|
|
119
|
+
var KeyIdAlreadyRegisteredError = class extends ConflictError {
|
|
120
|
+
constructor(data = {}) {
|
|
121
|
+
super({
|
|
122
|
+
message: data.message || "This keyId is already registered. Generate a new keyId and retry.",
|
|
123
|
+
details: data.details
|
|
124
|
+
});
|
|
125
|
+
this.name = "KeyIdAlreadyRegisteredError";
|
|
126
|
+
}
|
|
127
|
+
};
|
|
79
128
|
var InvalidKeyFingerprintError = class extends ValidationError {
|
|
80
129
|
constructor(data = {}) {
|
|
81
130
|
super({ message: data.message || "Invalid key fingerprint", details: data.details });
|
|
82
131
|
this.name = "InvalidKeyFingerprintError";
|
|
83
132
|
}
|
|
84
133
|
};
|
|
134
|
+
var KeyNotFoundError = class extends NotFoundError {
|
|
135
|
+
constructor(data = {}) {
|
|
136
|
+
super({ message: data.message || "Key not found", details: data.details });
|
|
137
|
+
this.name = "KeyNotFoundError";
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
var NonceKeyBindingError = class extends ValidationError {
|
|
141
|
+
constructor(data = {}) {
|
|
142
|
+
super({
|
|
143
|
+
message: data.message || "nonce must be the fingerprint of the submitted public key",
|
|
144
|
+
details: data.details
|
|
145
|
+
});
|
|
146
|
+
this.name = "NonceKeyBindingError";
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
var NativeSignInUnsupportedError = class extends ValidationError {
|
|
150
|
+
constructor(data = {}) {
|
|
151
|
+
super({
|
|
152
|
+
message: data.message || "This provider does not support native id_token sign-in.",
|
|
153
|
+
details: data.details
|
|
154
|
+
});
|
|
155
|
+
this.name = "NativeSignInUnsupportedError";
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
var UnverifiedEmailLinkError = class extends ValidationError {
|
|
159
|
+
constructor(data = {}) {
|
|
160
|
+
super({
|
|
161
|
+
message: data.message || "Cannot link to existing account with unverified email. Please verify your email with the provider first.",
|
|
162
|
+
details: data.details
|
|
163
|
+
});
|
|
164
|
+
this.name = "UnverifiedEmailLinkError";
|
|
165
|
+
}
|
|
166
|
+
};
|
|
85
167
|
var VerificationTokenPurposeMismatchError = class extends ValidationError {
|
|
86
168
|
constructor(data = {}) {
|
|
87
169
|
const expected = data.expected || "unknown";
|
|
@@ -146,15 +228,26 @@ var authErrorRegistry = new ErrorRegistry();
|
|
|
146
228
|
authErrorRegistry.append([
|
|
147
229
|
InvalidCredentialsError,
|
|
148
230
|
InvalidTokenError,
|
|
231
|
+
InvalidSocialTokenError,
|
|
149
232
|
TokenExpiredError,
|
|
150
233
|
KeyExpiredError,
|
|
151
234
|
AccountDisabledError,
|
|
235
|
+
AccountPendingDeletionError,
|
|
236
|
+
DeletionAlreadyRequestedError,
|
|
237
|
+
DeletionNotRequestedError,
|
|
238
|
+
ImmediateDeletionNotAllowedError,
|
|
152
239
|
AccountAlreadyExistsError,
|
|
240
|
+
RegistrationRejectedError,
|
|
153
241
|
ReservedUsernameError,
|
|
154
242
|
UsernameAlreadyTakenError,
|
|
155
243
|
InvalidVerificationCodeError,
|
|
156
244
|
InvalidVerificationTokenError,
|
|
157
245
|
InvalidKeyFingerprintError,
|
|
246
|
+
NonceKeyBindingError,
|
|
247
|
+
NativeSignInUnsupportedError,
|
|
248
|
+
UnverifiedEmailLinkError,
|
|
249
|
+
KeyNotFoundError,
|
|
250
|
+
KeyIdAlreadyRegisteredError,
|
|
158
251
|
VerificationTokenPurposeMismatchError,
|
|
159
252
|
VerificationTokenTargetMismatchError,
|
|
160
253
|
InsufficientPermissionsError,
|
|
@@ -163,13 +256,15 @@ authErrorRegistry.append([
|
|
|
163
256
|
|
|
164
257
|
// src/generated/route-map.ts
|
|
165
258
|
var routeMap = {
|
|
166
|
-
checkAccountExists: { method: "POST", path: "/_auth/exists" },
|
|
167
259
|
sendVerificationCode: { method: "POST", path: "/_auth/codes" },
|
|
168
260
|
verifyCode: { method: "POST", path: "/_auth/codes/verify" },
|
|
169
261
|
register: { method: "POST", path: "/_auth/register" },
|
|
170
262
|
login: { method: "POST", path: "/_auth/login" },
|
|
171
263
|
logout: { method: "POST", path: "/_auth/logout" },
|
|
172
264
|
rotateKey: { method: "POST", path: "/_auth/keys/rotate" },
|
|
265
|
+
listKeys: { method: "POST", path: "/_auth/keys/list" },
|
|
266
|
+
revokeKey: { method: "POST", path: "/_auth/keys/revoke" },
|
|
267
|
+
revokeAllKeys: { method: "POST", path: "/_auth/keys/revoke-all" },
|
|
173
268
|
changePassword: { method: "PUT", path: "/_auth/password" },
|
|
174
269
|
getAuthSession: { method: "GET", path: "/_auth/session" },
|
|
175
270
|
issueOneTimeToken: { method: "POST", path: "/_auth/tokens" },
|
|
@@ -191,11 +286,19 @@ var routeMap = {
|
|
|
191
286
|
oauthProviders: { method: "GET", path: "/_auth/oauth/providers" },
|
|
192
287
|
getGoogleOAuthUrl: { method: "POST", path: "/_auth/oauth/google/url" },
|
|
193
288
|
oauthFinalize: { method: "POST", path: "/_auth/oauth/finalize" },
|
|
289
|
+
oauthProviderStart: { method: "GET", path: "/_auth/oauth/:provider" },
|
|
290
|
+
oauthProviderCallback: { method: "GET", path: "/_auth/oauth/:provider/callback" },
|
|
291
|
+
getProviderOAuthUrl: { method: "POST", path: "/_auth/oauth/:provider/url" },
|
|
292
|
+
oauthNative: { method: "POST", path: "/_auth/oauth/:provider/native" },
|
|
293
|
+
oauthUnlinkNotify: { method: "POST", path: "/_auth/oauth/:provider/unlink-notify" },
|
|
294
|
+
oauthUnlinkNotifyGet: { method: "GET", path: "/_auth/oauth/:provider/unlink-notify" },
|
|
194
295
|
listRoles: { method: "GET", path: "/_auth/admin/roles" },
|
|
195
296
|
createAdminRole: { method: "POST", path: "/_auth/admin/roles" },
|
|
196
297
|
updateAdminRole: { method: "PATCH", path: "/_auth/admin/roles/:id" },
|
|
197
298
|
deleteAdminRole: { method: "DELETE", path: "/_auth/admin/roles/:id" },
|
|
198
|
-
updateUserRole: { method: "PATCH", path: "/_auth/admin/users/:userId/role" }
|
|
299
|
+
updateUserRole: { method: "PATCH", path: "/_auth/admin/users/:userId/role" },
|
|
300
|
+
requestAccountDeletion: { method: "POST", path: "/_auth/deletion/request" },
|
|
301
|
+
cancelAccountDeletion: { method: "POST", path: "/_auth/deletion/cancel" }
|
|
199
302
|
};
|
|
200
303
|
|
|
201
304
|
// src/lib/types.ts
|
|
@@ -331,9 +434,14 @@ var BUILTIN_ROLE_PERMISSIONS = {
|
|
|
331
434
|
|
|
332
435
|
// src/server/types.ts
|
|
333
436
|
var KEY_ALGORITHM = ["ES256", "RS256"];
|
|
437
|
+
var KEY_PLATFORM = ["ios", "android", "web", "desktop"];
|
|
438
|
+
var KEY_DEVICE_NAME_MAX_LENGTH = 64;
|
|
334
439
|
var INVITATION_STATUSES = ["pending", "accepted", "expired", "cancelled"];
|
|
335
|
-
var USER_STATUSES = ["active", "inactive", "suspended"];
|
|
336
|
-
var SOCIAL_PROVIDERS = ["google", "github", "kakao", "naver"];
|
|
440
|
+
var USER_STATUSES = ["active", "inactive", "suspended", "pending_deletion", "deleted"];
|
|
441
|
+
var SOCIAL_PROVIDERS = ["google", "apple", "github", "kakao", "naver", "superself"];
|
|
442
|
+
var ACCOUNT_DELETION_REQUEST_STATUSES = ["pending", "cancelled", "completed"];
|
|
443
|
+
var ACCOUNT_DELETION_REQUESTED_BY = ["self", "admin"];
|
|
444
|
+
var PURGE_STRATEGIES = ["anonymize", "hard-delete"];
|
|
337
445
|
|
|
338
446
|
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
339
447
|
var value_exports = {};
|
|
@@ -2956,9 +3064,18 @@ var PhoneSchema = Type.String({
|
|
|
2956
3064
|
pattern: PHONE_PATTERN2,
|
|
2957
3065
|
description: "Phone number in E.164 format (e.g., +821012345678)"
|
|
2958
3066
|
});
|
|
3067
|
+
var DeviceNameSchema = Type.String({
|
|
3068
|
+
maxLength: KEY_DEVICE_NAME_MAX_LENGTH,
|
|
3069
|
+
description: `Device label shown in the key list (max ${KEY_DEVICE_NAME_MAX_LENGTH} chars)`
|
|
3070
|
+
});
|
|
3071
|
+
var PlatformSchema = Type.Union(
|
|
3072
|
+
KEY_PLATFORM.map((platform) => Type.Literal(platform)),
|
|
3073
|
+
{ description: "Platform the key lives on" }
|
|
3074
|
+
);
|
|
2959
3075
|
var PasswordSchema = Type.String({
|
|
2960
3076
|
minLength: 8,
|
|
2961
|
-
|
|
3077
|
+
maxLength: 72,
|
|
3078
|
+
description: "User password (8\u201372 characters). bcrypt silently ignores bytes past 72, so longer inputs are rejected rather than truncated."
|
|
2962
3079
|
});
|
|
2963
3080
|
var TargetTypeSchema = Type.Union([
|
|
2964
3081
|
Type.Literal("email"),
|
|
@@ -2972,17 +3089,20 @@ var VerificationPurposeSchema = Type.Union([
|
|
|
2972
3089
|
Type.Literal("login"),
|
|
2973
3090
|
Type.Literal("password_reset"),
|
|
2974
3091
|
Type.Literal("email_change"),
|
|
2975
|
-
Type.Literal("phone_change")
|
|
3092
|
+
Type.Literal("phone_change"),
|
|
3093
|
+
Type.Literal("account_deletion")
|
|
2976
3094
|
], {
|
|
2977
3095
|
description: "Purpose of verification"
|
|
2978
3096
|
});
|
|
2979
|
-
var VERIFICATION_PURPOSES = ["registration", "login", "password_reset", "email_change", "phone_change"];
|
|
3097
|
+
var VERIFICATION_PURPOSES = ["registration", "login", "password_reset", "email_change", "phone_change", "account_deletion"];
|
|
2980
3098
|
|
|
2981
3099
|
// src/index.ts
|
|
2982
3100
|
var authApi = createApi({
|
|
2983
3101
|
errorRegistry: [authErrorRegistry]
|
|
2984
3102
|
});
|
|
2985
3103
|
export {
|
|
3104
|
+
ACCOUNT_DELETION_REQUESTED_BY,
|
|
3105
|
+
ACCOUNT_DELETION_REQUEST_STATUSES,
|
|
2986
3106
|
BASE64_PATTERN,
|
|
2987
3107
|
BUILTIN_PERMISSIONS,
|
|
2988
3108
|
BUILTIN_ROLES,
|
|
@@ -2993,6 +3113,7 @@ export {
|
|
|
2993
3113
|
KEY_ALGORITHM,
|
|
2994
3114
|
PERMISSION_CATEGORIES,
|
|
2995
3115
|
PHONE_PATTERN,
|
|
3116
|
+
PURGE_STRATEGIES,
|
|
2996
3117
|
SOCIAL_PROVIDERS,
|
|
2997
3118
|
USER_STATUSES,
|
|
2998
3119
|
UUID_PATTERN,
|