@spfn/auth 0.3.0-beta.2 → 0.3.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1488 -25
- package/dist/client-proof.d.ts +45 -15
- package/dist/client-proof.js +201 -5
- package/dist/client-proof.js.map +1 -1
- package/dist/client.d.ts +92 -1
- package/dist/client.js +58 -0
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +342 -0
- package/dist/config.js +153 -4
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +396 -3
- package/dist/errors.js +257 -2
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +202 -2
- package/dist/index.js +277 -3
- package/dist/index.js.map +1 -1
- package/dist/machine-principals-B7N8gux0.d.ts +3087 -0
- package/dist/nextjs/api.js +350 -12
- package/dist/nextjs/api.js.map +1 -1
- package/dist/nextjs/client.d.ts +28 -1
- package/dist/nextjs/client.js +24 -3
- package/dist/nextjs/client.js.map +1 -1
- package/dist/nextjs/server.d.ts +173 -3
- package/dist/nextjs/server.js +372 -10
- package/dist/nextjs/server.js.map +1 -1
- package/dist/server.d.ts +4167 -582
- package/dist/server.js +9618 -4341
- package/dist/server.js.map +1 -1
- package/dist/{session-DTHahDQ9.d.ts → session-Dfwu5g2W.d.ts} +28 -1
- package/migrations/20260810112144_colorful_tomorrow_man/migration.sql +18 -0
- package/migrations/20260810112144_colorful_tomorrow_man/snapshot.json +3576 -0
- package/migrations/20260901091716_fine_arclight/migration.sql +21 -0
- package/migrations/20260901091716_fine_arclight/snapshot.json +3849 -0
- package/migrations/20260906155957_natural_moonstone/migration.sql +33 -0
- package/migrations/20260906155957_natural_moonstone/snapshot.json +4275 -0
- package/migrations/20260907020904_giant_eternals/migration.sql +21 -0
- package/migrations/20260907020904_giant_eternals/snapshot.json +4561 -0
- package/migrations/20260907044807_eminent_angel/migration.sql +2 -0
- package/migrations/20260907044807_eminent_angel/snapshot.json +4561 -0
- package/migrations/20260918083158_foamy_roughhouse/migration.sql +55 -0
- package/migrations/20260918083158_foamy_roughhouse/snapshot.json +5271 -0
- package/migrations/20260918142743_smart_cassandra_nova/migration.sql +2 -0
- package/migrations/20260918142743_smart_cassandra_nova/snapshot.json +5297 -0
- package/migrations/20260918143800_fat_princess_powerful/migration.sql +17 -0
- package/migrations/20260918143800_fat_princess_powerful/snapshot.json +5523 -0
- package/package.json +9 -6
- package/dist/authenticate-55LeXHqZ.d.ts +0 -1447
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import * as _spfn_core_nextjs from '@spfn/core/nextjs';
|
|
2
|
-
import { P as PermissionConfig, R as RoleConfig, m as mainAuthRouter, S as SendVerificationCodeResult, a as RegisterResult, L as LoginResult,
|
|
3
|
-
export { A as AuthInitOptions,
|
|
2
|
+
import { P as PermissionConfig, R as RoleConfig, m as mainAuthRouter, S as SendVerificationCodeResult, a as RegisterResult, b as RequestSignupLinkResult, C as ConfirmSignupLinkResult, c as RequestPasswordResetResult, d as ConfirmPasswordResetResult, L as LoginResult, e as StartDeviceAuthResult, D as DeviceAuthInfoResult, F as FinishPasskeyEnrollmentResult, f as PasskeySummary, g as RotateKeyResult, K as KeySummary, h as RevokeAllKeysResult, I as IssueOneTimeTokenResult, O as OAuthStartResult, i as OAuthNativeResult, U as UserProfile, j as ProfileInfo, k as OAuth2ConsentView, l as OAuth2AuthorizationCodeIssued, n as OAuth2GrantSummary } from './machine-principals-B7N8gux0.js';
|
|
3
|
+
export { A as AuthInitOptions, o as AuthSession, p as PERMISSION_CATEGORIES, q as PermissionCategory, V as VERIFICATION_PURPOSES, r as VERIFICATION_TARGET_TYPES, s as VerificationPurpose, t as VerificationTargetType } from './machine-principals-B7N8gux0.js';
|
|
4
|
+
import * as _simplewebauthn_server from '@simplewebauthn/server';
|
|
4
5
|
import * as _spfn_core_route from '@spfn/core/route';
|
|
5
6
|
import { HttpMethod } from '@spfn/core/route';
|
|
6
7
|
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';
|
|
7
8
|
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
9
|
+
import 'drizzle-orm/pg-core';
|
|
10
|
+
import '@spfn/core/event';
|
|
8
11
|
import 'hono';
|
|
9
12
|
import '@spfn/auth/server';
|
|
10
13
|
|
|
@@ -125,6 +128,59 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
|
125
128
|
platform: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ios" | "android" | "web" | "desktop">[]>>;
|
|
126
129
|
}>;
|
|
127
130
|
}, RegisterResult>;
|
|
131
|
+
requestSignupLink: _spfn_core_route.RouteDef<{
|
|
132
|
+
body: _sinclair_typebox.TObject<{
|
|
133
|
+
email: _sinclair_typebox.TString;
|
|
134
|
+
returnPath: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
135
|
+
}>;
|
|
136
|
+
}, {}, RequestSignupLinkResult>;
|
|
137
|
+
confirmSignupLink: _spfn_core_route.RouteDef<{
|
|
138
|
+
body: _sinclair_typebox.TObject<{
|
|
139
|
+
token: _sinclair_typebox.TString;
|
|
140
|
+
}>;
|
|
141
|
+
}, {}, ConfirmSignupLinkResult>;
|
|
142
|
+
completeSignup: _spfn_core_route.RouteDef<{
|
|
143
|
+
body: _sinclair_typebox.TObject<{
|
|
144
|
+
password: _sinclair_typebox.TString;
|
|
145
|
+
metadata: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TUnknown>>;
|
|
146
|
+
}>;
|
|
147
|
+
}, {
|
|
148
|
+
body: _sinclair_typebox.TObject<{
|
|
149
|
+
setupSecret: _sinclair_typebox.TString;
|
|
150
|
+
publicKey: _sinclair_typebox.TString;
|
|
151
|
+
keyId: _sinclair_typebox.TString;
|
|
152
|
+
fingerprint: _sinclair_typebox.TString;
|
|
153
|
+
algorithm: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ES256" | "RS256">[]>;
|
|
154
|
+
deviceName: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
155
|
+
platform: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ios" | "android" | "web" | "desktop">[]>>;
|
|
156
|
+
}>;
|
|
157
|
+
}, RegisterResult>;
|
|
158
|
+
requestPasswordReset: _spfn_core_route.RouteDef<{
|
|
159
|
+
body: _sinclair_typebox.TObject<{
|
|
160
|
+
email: _sinclair_typebox.TString;
|
|
161
|
+
returnPath: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
162
|
+
}>;
|
|
163
|
+
}, {}, RequestPasswordResetResult>;
|
|
164
|
+
confirmPasswordReset: _spfn_core_route.RouteDef<{
|
|
165
|
+
body: _sinclair_typebox.TObject<{
|
|
166
|
+
token: _sinclair_typebox.TString;
|
|
167
|
+
}>;
|
|
168
|
+
}, {}, ConfirmPasswordResetResult>;
|
|
169
|
+
completePasswordReset: _spfn_core_route.RouteDef<{
|
|
170
|
+
body: _sinclair_typebox.TObject<{
|
|
171
|
+
password: _sinclair_typebox.TString;
|
|
172
|
+
}>;
|
|
173
|
+
}, {
|
|
174
|
+
body: _sinclair_typebox.TObject<{
|
|
175
|
+
setupSecret: _sinclair_typebox.TString;
|
|
176
|
+
publicKey: _sinclair_typebox.TString;
|
|
177
|
+
keyId: _sinclair_typebox.TString;
|
|
178
|
+
fingerprint: _sinclair_typebox.TString;
|
|
179
|
+
algorithm: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ES256" | "RS256">[]>;
|
|
180
|
+
deviceName: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
181
|
+
platform: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ios" | "android" | "web" | "desktop">[]>>;
|
|
182
|
+
}>;
|
|
183
|
+
}, RegisterResult>;
|
|
128
184
|
login: _spfn_core_route.RouteDef<{
|
|
129
185
|
body: _sinclair_typebox.TObject<{
|
|
130
186
|
email: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
@@ -142,6 +198,97 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
|
142
198
|
platform: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ios" | "android" | "web" | "desktop">[]>>;
|
|
143
199
|
}>;
|
|
144
200
|
}, LoginResult>;
|
|
201
|
+
startDeviceAuth: _spfn_core_route.RouteDef<{
|
|
202
|
+
body: _sinclair_typebox.TObject<{
|
|
203
|
+
publicKey: _sinclair_typebox.TString;
|
|
204
|
+
keyId: _sinclair_typebox.TString;
|
|
205
|
+
fingerprint: _sinclair_typebox.TString;
|
|
206
|
+
algorithm: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ES256" | "RS256">[]>>;
|
|
207
|
+
deviceName: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
208
|
+
platform: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ios" | "android" | "web" | "desktop">[]>>;
|
|
209
|
+
}>;
|
|
210
|
+
}, {}, StartDeviceAuthResult>;
|
|
211
|
+
pollDeviceAuth: _spfn_core_route.RouteDef<{
|
|
212
|
+
body: _sinclair_typebox.TObject<{
|
|
213
|
+
deviceCode: _sinclair_typebox.TString;
|
|
214
|
+
}>;
|
|
215
|
+
}, {}, {
|
|
216
|
+
status: "pending";
|
|
217
|
+
intervalMillis: number;
|
|
218
|
+
} | {
|
|
219
|
+
email?: string | undefined;
|
|
220
|
+
phone?: string | undefined;
|
|
221
|
+
status: "approved";
|
|
222
|
+
userId: string;
|
|
223
|
+
publicId: string;
|
|
224
|
+
passwordChangeRequired: boolean;
|
|
225
|
+
}>;
|
|
226
|
+
getDeviceAuthInfo: _spfn_core_route.RouteDef<{
|
|
227
|
+
body: _sinclair_typebox.TObject<{
|
|
228
|
+
userCode: _sinclair_typebox.TString;
|
|
229
|
+
}>;
|
|
230
|
+
}, {}, DeviceAuthInfoResult>;
|
|
231
|
+
approveDeviceAuth: _spfn_core_route.RouteDef<{
|
|
232
|
+
body: _sinclair_typebox.TObject<{
|
|
233
|
+
userCode: _sinclair_typebox.TString;
|
|
234
|
+
}>;
|
|
235
|
+
}, {}, DeviceAuthInfoResult>;
|
|
236
|
+
denyDeviceAuth: _spfn_core_route.RouteDef<{
|
|
237
|
+
body: _sinclair_typebox.TObject<{
|
|
238
|
+
userCode: _sinclair_typebox.TString;
|
|
239
|
+
}>;
|
|
240
|
+
}, {}, void>;
|
|
241
|
+
passkeyRegisterOptions: _spfn_core_route.RouteDef<{
|
|
242
|
+
body: _sinclair_typebox.TObject<{
|
|
243
|
+
currentPassword: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
244
|
+
}>;
|
|
245
|
+
}, {}, _simplewebauthn_server.PublicKeyCredentialCreationOptionsJSON>;
|
|
246
|
+
passkeyRegisterVerify: _spfn_core_route.RouteDef<{
|
|
247
|
+
body: _sinclair_typebox.TObject<{
|
|
248
|
+
response: _sinclair_typebox.TUnknown;
|
|
249
|
+
label: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
250
|
+
}>;
|
|
251
|
+
}, {}, FinishPasskeyEnrollmentResult>;
|
|
252
|
+
passkeyLoginOptions: _spfn_core_route.RouteDef<{
|
|
253
|
+
body: _sinclair_typebox.TObject<{}>;
|
|
254
|
+
}, {}, _simplewebauthn_server.PublicKeyCredentialRequestOptionsJSON>;
|
|
255
|
+
passkeyLoginVerify: _spfn_core_route.RouteDef<{
|
|
256
|
+
body: _sinclair_typebox.TObject<{
|
|
257
|
+
response: _sinclair_typebox.TUnknown;
|
|
258
|
+
}>;
|
|
259
|
+
}, {
|
|
260
|
+
body: _sinclair_typebox.TObject<{
|
|
261
|
+
publicKey: _sinclair_typebox.TString;
|
|
262
|
+
keyId: _sinclair_typebox.TString;
|
|
263
|
+
fingerprint: _sinclair_typebox.TString;
|
|
264
|
+
algorithm: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ES256" | "RS256">[]>;
|
|
265
|
+
oldKeyId: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
266
|
+
deviceName: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
267
|
+
platform: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ios" | "android" | "web" | "desktop">[]>>;
|
|
268
|
+
}>;
|
|
269
|
+
}, LoginResult>;
|
|
270
|
+
listPasskeys: _spfn_core_route.RouteDef<{
|
|
271
|
+
body: _sinclair_typebox.TObject<{}>;
|
|
272
|
+
}, {}, {
|
|
273
|
+
passkeys: PasskeySummary[];
|
|
274
|
+
}>;
|
|
275
|
+
renamePasskey: _spfn_core_route.RouteDef<{
|
|
276
|
+
body: _sinclair_typebox.TObject<{
|
|
277
|
+
passkeyId: _sinclair_typebox.TString;
|
|
278
|
+
label: _sinclair_typebox.TString;
|
|
279
|
+
}>;
|
|
280
|
+
}, {}, {
|
|
281
|
+
passkeyId: string;
|
|
282
|
+
label: string;
|
|
283
|
+
}>;
|
|
284
|
+
revokePasskey: _spfn_core_route.RouteDef<{
|
|
285
|
+
body: _sinclair_typebox.TObject<{
|
|
286
|
+
passkeyId: _sinclair_typebox.TString;
|
|
287
|
+
currentPassword: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
288
|
+
}>;
|
|
289
|
+
}, {}, {
|
|
290
|
+
passkeyId: string;
|
|
291
|
+
}>;
|
|
145
292
|
logout: _spfn_core_route.RouteDef<{}, {}, void>;
|
|
146
293
|
rotateKey: _spfn_core_route.RouteDef<{}, {
|
|
147
294
|
body: _sinclair_typebox.TObject<{
|
|
@@ -173,6 +320,21 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
|
173
320
|
includeCurrent: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
|
|
174
321
|
}>;
|
|
175
322
|
}, {}, RevokeAllKeysResult>;
|
|
323
|
+
confirmRevokeAllLink: _spfn_core_route.RouteDef<{
|
|
324
|
+
body: _sinclair_typebox.TObject<{
|
|
325
|
+
token: _sinclair_typebox.TString;
|
|
326
|
+
}>;
|
|
327
|
+
}, {}, {
|
|
328
|
+
expiresAt: string;
|
|
329
|
+
activeKeyCount: number;
|
|
330
|
+
}>;
|
|
331
|
+
consumeRevokeAllLink: _spfn_core_route.RouteDef<{
|
|
332
|
+
body: _sinclair_typebox.TObject<{
|
|
333
|
+
token: _sinclair_typebox.TString;
|
|
334
|
+
}>;
|
|
335
|
+
}, {}, {
|
|
336
|
+
revokedCount: number;
|
|
337
|
+
}>;
|
|
176
338
|
changePassword: _spfn_core_route.RouteDef<{
|
|
177
339
|
body: _sinclair_typebox.TObject<{
|
|
178
340
|
currentPassword: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
@@ -474,6 +636,7 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
|
474
636
|
status: "active" | "inactive" | "suspended" | "pending_deletion" | "deleted";
|
|
475
637
|
emailVerifiedAt: Date | null;
|
|
476
638
|
phoneVerifiedAt: Date | null;
|
|
639
|
+
keyEpoch: number;
|
|
477
640
|
lastLoginAt: Date | null;
|
|
478
641
|
}>;
|
|
479
642
|
updateLocale: _spfn_core_route.RouteDef<{
|
|
@@ -607,6 +770,43 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
|
|
|
607
770
|
createdAt: string | null;
|
|
608
771
|
};
|
|
609
772
|
}>;
|
|
773
|
+
registerOAuth2Client: _spfn_core_route.RouteDef<{}, {}, Response>;
|
|
774
|
+
getOAuth2Authorize: _spfn_core_route.RouteDef<{
|
|
775
|
+
query: _sinclair_typebox.TObject<{
|
|
776
|
+
client_id: _sinclair_typebox.TString;
|
|
777
|
+
redirect_uri: _sinclair_typebox.TString;
|
|
778
|
+
code_challenge: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
779
|
+
code_challenge_method: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
780
|
+
resource: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
781
|
+
scope: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
782
|
+
state: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
783
|
+
}>;
|
|
784
|
+
}, {}, OAuth2ConsentView>;
|
|
785
|
+
createOAuth2AuthorizationCode: _spfn_core_route.RouteDef<{
|
|
786
|
+
body: _sinclair_typebox.TObject<{
|
|
787
|
+
approve: _sinclair_typebox.TBoolean;
|
|
788
|
+
client_id: _sinclair_typebox.TString;
|
|
789
|
+
redirect_uri: _sinclair_typebox.TString;
|
|
790
|
+
code_challenge: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
791
|
+
code_challenge_method: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
792
|
+
resource: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
793
|
+
scope: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
794
|
+
state: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
795
|
+
}>;
|
|
796
|
+
}, {}, OAuth2AuthorizationCodeIssued>;
|
|
797
|
+
oauth2Token: _spfn_core_route.RouteDef<{}, {}, Response>;
|
|
798
|
+
oauth2Revoke: _spfn_core_route.RouteDef<{}, {}, Response>;
|
|
799
|
+
listOAuth2Grants: _spfn_core_route.RouteDef<{}, {}, {
|
|
800
|
+
grants: OAuth2GrantSummary[];
|
|
801
|
+
}>;
|
|
802
|
+
revokeOAuth2Grant: _spfn_core_route.RouteDef<{
|
|
803
|
+
params: _sinclair_typebox.TObject<{
|
|
804
|
+
id: _sinclair_typebox.TNumber;
|
|
805
|
+
}>;
|
|
806
|
+
}, {}, {
|
|
807
|
+
revoked: boolean;
|
|
808
|
+
}>;
|
|
809
|
+
oauth2AuthorizationServerMetadata: _spfn_core_route.RouteDef<{}, {}, Response>;
|
|
610
810
|
}>>;
|
|
611
811
|
type AuthRouter = typeof mainAuthRouter;
|
|
612
812
|
|
package/dist/index.js
CHANGED
|
@@ -16,7 +16,8 @@ import {
|
|
|
16
16
|
UnauthorizedError,
|
|
17
17
|
ForbiddenError,
|
|
18
18
|
ConflictError,
|
|
19
|
-
NotFoundError
|
|
19
|
+
NotFoundError,
|
|
20
|
+
HttpError
|
|
20
21
|
} from "@spfn/core/errors";
|
|
21
22
|
var InvalidCredentialsError = class extends UnauthorizedError {
|
|
22
23
|
constructor(data = {}) {
|
|
@@ -131,12 +132,63 @@ var InvalidKeyFingerprintError = class extends ValidationError {
|
|
|
131
132
|
this.name = "InvalidKeyFingerprintError";
|
|
132
133
|
}
|
|
133
134
|
};
|
|
135
|
+
var KeyAlgorithmMismatchError = class extends ValidationError {
|
|
136
|
+
constructor(data = {}) {
|
|
137
|
+
super({
|
|
138
|
+
message: data.message || "Public key type does not match the declared algorithm",
|
|
139
|
+
details: data.details
|
|
140
|
+
});
|
|
141
|
+
this.name = "KeyAlgorithmMismatchError";
|
|
142
|
+
}
|
|
143
|
+
};
|
|
134
144
|
var KeyNotFoundError = class extends NotFoundError {
|
|
135
145
|
constructor(data = {}) {
|
|
136
146
|
super({ message: data.message || "Key not found", details: data.details });
|
|
137
147
|
this.name = "KeyNotFoundError";
|
|
138
148
|
}
|
|
139
149
|
};
|
|
150
|
+
var RevokeAllLinkError = class extends NotFoundError {
|
|
151
|
+
constructor(data = {}) {
|
|
152
|
+
super({
|
|
153
|
+
message: data.message || "This sign-out link is no longer valid. Request a new one.",
|
|
154
|
+
details: data.details
|
|
155
|
+
});
|
|
156
|
+
this.name = "RevokeAllLinkError";
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
var DeviceAuthNotFoundError = class extends NotFoundError {
|
|
160
|
+
constructor(data = {}) {
|
|
161
|
+
super({ message: data.message || "Device authorization not found", details: data.details });
|
|
162
|
+
this.name = "DeviceAuthNotFoundError";
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
var DeviceAuthExpiredError = class extends ValidationError {
|
|
166
|
+
constructor(data = {}) {
|
|
167
|
+
super({
|
|
168
|
+
message: data.message || "This device code has expired. Start again on the other device.",
|
|
169
|
+
details: data.details
|
|
170
|
+
});
|
|
171
|
+
this.name = "DeviceAuthExpiredError";
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
var DeviceAuthAlreadyHandledError = class extends ConflictError {
|
|
175
|
+
constructor(data = {}) {
|
|
176
|
+
super({
|
|
177
|
+
message: data.message || "This device request has already been answered",
|
|
178
|
+
details: data.details
|
|
179
|
+
});
|
|
180
|
+
this.name = "DeviceAuthAlreadyHandledError";
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
var DeviceAuthDeniedError = class extends ForbiddenError {
|
|
184
|
+
constructor(data = {}) {
|
|
185
|
+
super({
|
|
186
|
+
message: data.message || "This device request was denied",
|
|
187
|
+
details: data.details
|
|
188
|
+
});
|
|
189
|
+
this.name = "DeviceAuthDeniedError";
|
|
190
|
+
}
|
|
191
|
+
};
|
|
140
192
|
var NonceKeyBindingError = class extends ValidationError {
|
|
141
193
|
constructor(data = {}) {
|
|
142
194
|
super({
|
|
@@ -155,6 +207,42 @@ var NativeSignInUnsupportedError = class extends ValidationError {
|
|
|
155
207
|
this.name = "NativeSignInUnsupportedError";
|
|
156
208
|
}
|
|
157
209
|
};
|
|
210
|
+
var InvalidSignupLinkError = class extends ValidationError {
|
|
211
|
+
constructor(data = {}) {
|
|
212
|
+
super({
|
|
213
|
+
message: data.message || "This signup link is no longer valid. Request a new one.",
|
|
214
|
+
details: data.details
|
|
215
|
+
});
|
|
216
|
+
this.name = "InvalidSignupLinkError";
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
var InvalidSignupSetupSessionError = class extends UnauthorizedError {
|
|
220
|
+
constructor(data = {}) {
|
|
221
|
+
super({
|
|
222
|
+
message: data.message || "Password setup session is invalid or has expired. Start the signup again.",
|
|
223
|
+
details: data.details
|
|
224
|
+
});
|
|
225
|
+
this.name = "InvalidSignupSetupSessionError";
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
var PasswordResetLinkError = class extends UnauthorizedError {
|
|
229
|
+
constructor(data = {}) {
|
|
230
|
+
super({
|
|
231
|
+
message: data.message || "This password reset link is no longer valid. Request a new one.",
|
|
232
|
+
details: data.details
|
|
233
|
+
});
|
|
234
|
+
this.name = "PasswordResetLinkError";
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
var PasswordResetSessionError = class extends UnauthorizedError {
|
|
238
|
+
constructor(data = {}) {
|
|
239
|
+
super({
|
|
240
|
+
message: data.message || "Password reset session is invalid or has expired. Request a new link.",
|
|
241
|
+
details: data.details
|
|
242
|
+
});
|
|
243
|
+
this.name = "PasswordResetSessionError";
|
|
244
|
+
}
|
|
245
|
+
};
|
|
158
246
|
var UnverifiedEmailLinkError = class extends ValidationError {
|
|
159
247
|
constructor(data = {}) {
|
|
160
248
|
super({
|
|
@@ -222,6 +310,110 @@ var InsufficientRoleError = class extends ForbiddenError {
|
|
|
222
310
|
this.name = "InsufficientRoleError";
|
|
223
311
|
}
|
|
224
312
|
};
|
|
313
|
+
var PasskeyChallengeError = class extends UnauthorizedError {
|
|
314
|
+
constructor(data = {}) {
|
|
315
|
+
super({
|
|
316
|
+
message: data.message || "This passkey challenge is no longer valid. Try again.",
|
|
317
|
+
details: data.details
|
|
318
|
+
});
|
|
319
|
+
this.name = "PasskeyChallengeError";
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
var PasskeyVerificationError = class extends UnauthorizedError {
|
|
323
|
+
constructor(data = {}) {
|
|
324
|
+
super({
|
|
325
|
+
message: data.message || "Passkey verification failed.",
|
|
326
|
+
details: data.details
|
|
327
|
+
});
|
|
328
|
+
this.name = "PasskeyVerificationError";
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
var PasskeyNotFoundError = class extends NotFoundError {
|
|
332
|
+
constructor(data = {}) {
|
|
333
|
+
super({
|
|
334
|
+
message: data.message || "Passkey not found",
|
|
335
|
+
details: data.details
|
|
336
|
+
});
|
|
337
|
+
this.name = "PasskeyNotFoundError";
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
var PasskeyAlreadyRegisteredError = class extends ConflictError {
|
|
341
|
+
constructor(data = {}) {
|
|
342
|
+
super({
|
|
343
|
+
message: data.message || "This passkey is already registered",
|
|
344
|
+
details: data.details
|
|
345
|
+
});
|
|
346
|
+
this.name = "PasskeyAlreadyRegisteredError";
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
var RecentAuthenticationRequiredError = class extends ForbiddenError {
|
|
350
|
+
code = "RECENT_AUTH_REQUIRED";
|
|
351
|
+
constructor(data = {}) {
|
|
352
|
+
super({
|
|
353
|
+
message: data.message || "Confirm it is you before changing passkeys. Sign in again or send your current password.",
|
|
354
|
+
details: data.details
|
|
355
|
+
});
|
|
356
|
+
this.name = "RecentAuthenticationRequiredError";
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
var LastRecoveryCredentialError = class extends ConflictError {
|
|
360
|
+
code = "LAST_RECOVERY_CREDENTIAL";
|
|
361
|
+
constructor(data = {}) {
|
|
362
|
+
super({
|
|
363
|
+
message: data.message || "This is the only way you can sign in. Set a password or link a social account before removing it.",
|
|
364
|
+
details: data.details
|
|
365
|
+
});
|
|
366
|
+
this.name = "LastRecoveryCredentialError";
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
var PasskeyConfigError = class extends HttpError {
|
|
370
|
+
constructor(data) {
|
|
371
|
+
super({
|
|
372
|
+
message: data.message,
|
|
373
|
+
statusCode: 500,
|
|
374
|
+
details: data.details
|
|
375
|
+
});
|
|
376
|
+
this.name = "PasskeyConfigError";
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
var OAuth2UnknownClientError = class extends ValidationError {
|
|
380
|
+
constructor(data = {}) {
|
|
381
|
+
super({
|
|
382
|
+
message: data.message || "Unknown OAuth client",
|
|
383
|
+
details: { error: "unknown_client", ...data.details }
|
|
384
|
+
});
|
|
385
|
+
this.name = "OAuth2UnknownClientError";
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
var OAuth2RedirectUriMismatchError = class extends ValidationError {
|
|
389
|
+
constructor(data = {}) {
|
|
390
|
+
super({
|
|
391
|
+
message: data.message || "redirect_uri does not match a registered URI for this client",
|
|
392
|
+
details: { error: "redirect_uri_mismatch", ...data.details }
|
|
393
|
+
});
|
|
394
|
+
this.name = "OAuth2RedirectUriMismatchError";
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
var OAuth2AuthorizeRedirectError = class extends ValidationError {
|
|
398
|
+
constructor(data) {
|
|
399
|
+
super({
|
|
400
|
+
message: data.message || `OAuth authorize request refused: ${data.error}`,
|
|
401
|
+
details: {
|
|
402
|
+
error: data.error,
|
|
403
|
+
redirectUri: data.redirectUri,
|
|
404
|
+
state: data.state,
|
|
405
|
+
...data.details
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
this.name = "OAuth2AuthorizeRedirectError";
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
var OAuth2GrantNotFoundError = class extends NotFoundError {
|
|
412
|
+
constructor(data = {}) {
|
|
413
|
+
super({ message: data.message || "No such connected application", details: data.details });
|
|
414
|
+
this.name = "OAuth2GrantNotFoundError";
|
|
415
|
+
}
|
|
416
|
+
};
|
|
225
417
|
|
|
226
418
|
// src/errors/index.ts
|
|
227
419
|
var authErrorRegistry = new ErrorRegistry();
|
|
@@ -243,15 +435,36 @@ authErrorRegistry.append([
|
|
|
243
435
|
InvalidVerificationCodeError,
|
|
244
436
|
InvalidVerificationTokenError,
|
|
245
437
|
InvalidKeyFingerprintError,
|
|
438
|
+
KeyAlgorithmMismatchError,
|
|
246
439
|
NonceKeyBindingError,
|
|
247
440
|
NativeSignInUnsupportedError,
|
|
248
441
|
UnverifiedEmailLinkError,
|
|
442
|
+
InvalidSignupLinkError,
|
|
443
|
+
InvalidSignupSetupSessionError,
|
|
444
|
+
PasswordResetLinkError,
|
|
445
|
+
PasswordResetSessionError,
|
|
249
446
|
KeyNotFoundError,
|
|
250
447
|
KeyIdAlreadyRegisteredError,
|
|
448
|
+
RevokeAllLinkError,
|
|
449
|
+
DeviceAuthNotFoundError,
|
|
450
|
+
DeviceAuthExpiredError,
|
|
451
|
+
DeviceAuthAlreadyHandledError,
|
|
452
|
+
DeviceAuthDeniedError,
|
|
251
453
|
VerificationTokenPurposeMismatchError,
|
|
252
454
|
VerificationTokenTargetMismatchError,
|
|
253
455
|
InsufficientPermissionsError,
|
|
254
|
-
InsufficientRoleError
|
|
456
|
+
InsufficientRoleError,
|
|
457
|
+
PasskeyChallengeError,
|
|
458
|
+
PasskeyVerificationError,
|
|
459
|
+
PasskeyNotFoundError,
|
|
460
|
+
PasskeyAlreadyRegisteredError,
|
|
461
|
+
RecentAuthenticationRequiredError,
|
|
462
|
+
LastRecoveryCredentialError,
|
|
463
|
+
PasskeyConfigError,
|
|
464
|
+
OAuth2UnknownClientError,
|
|
465
|
+
OAuth2RedirectUriMismatchError,
|
|
466
|
+
OAuth2AuthorizeRedirectError,
|
|
467
|
+
OAuth2GrantNotFoundError
|
|
255
468
|
]);
|
|
256
469
|
|
|
257
470
|
// src/generated/route-map.ts
|
|
@@ -259,7 +472,15 @@ var routeMap = {
|
|
|
259
472
|
sendVerificationCode: { method: "POST", path: "/_auth/codes" },
|
|
260
473
|
verifyCode: { method: "POST", path: "/_auth/codes/verify" },
|
|
261
474
|
register: { method: "POST", path: "/_auth/register" },
|
|
475
|
+
requestSignupLink: { method: "POST", path: "/_auth/signup/email" },
|
|
476
|
+
confirmSignupLink: { method: "POST", path: "/_auth/signup/email/confirm" },
|
|
477
|
+
completeSignup: { method: "POST", path: "/_auth/signup/password" },
|
|
262
478
|
login: { method: "POST", path: "/_auth/login" },
|
|
479
|
+
startDeviceAuth: { method: "POST", path: "/_auth/device/start" },
|
|
480
|
+
pollDeviceAuth: { method: "POST", path: "/_auth/device/poll" },
|
|
481
|
+
getDeviceAuthInfo: { method: "POST", path: "/_auth/device/info" },
|
|
482
|
+
approveDeviceAuth: { method: "POST", path: "/_auth/device/approve" },
|
|
483
|
+
denyDeviceAuth: { method: "POST", path: "/_auth/device/deny" },
|
|
263
484
|
logout: { method: "POST", path: "/_auth/logout" },
|
|
264
485
|
rotateKey: { method: "POST", path: "/_auth/keys/rotate" },
|
|
265
486
|
listKeys: { method: "POST", path: "/_auth/keys/list" },
|
|
@@ -268,6 +489,18 @@ var routeMap = {
|
|
|
268
489
|
changePassword: { method: "PUT", path: "/_auth/password" },
|
|
269
490
|
getAuthSession: { method: "GET", path: "/_auth/session" },
|
|
270
491
|
issueOneTimeToken: { method: "POST", path: "/_auth/tokens" },
|
|
492
|
+
requestPasswordReset: { method: "POST", path: "/_auth/password/reset" },
|
|
493
|
+
confirmPasswordReset: { method: "POST", path: "/_auth/password/reset/confirm" },
|
|
494
|
+
completePasswordReset: { method: "POST", path: "/_auth/password/reset/complete" },
|
|
495
|
+
confirmRevokeAllLink: { method: "POST", path: "/_auth/keys/revoke-all/confirm" },
|
|
496
|
+
consumeRevokeAllLink: { method: "POST", path: "/_auth/keys/revoke-all/consume" },
|
|
497
|
+
passkeyRegisterOptions: { method: "POST", path: "/_auth/passkeys/register/options" },
|
|
498
|
+
passkeyRegisterVerify: { method: "POST", path: "/_auth/passkeys/register/verify" },
|
|
499
|
+
passkeyLoginOptions: { method: "POST", path: "/_auth/passkeys/login/options" },
|
|
500
|
+
passkeyLoginVerify: { method: "POST", path: "/_auth/passkeys/login/verify" },
|
|
501
|
+
listPasskeys: { method: "POST", path: "/_auth/passkeys/list" },
|
|
502
|
+
renamePasskey: { method: "POST", path: "/_auth/passkeys/rename" },
|
|
503
|
+
revokePasskey: { method: "POST", path: "/_auth/passkeys/revoke" },
|
|
271
504
|
getInvitation: { method: "GET", path: "/_auth/invitations/:token" },
|
|
272
505
|
acceptInvitation: { method: "POST", path: "/_auth/invitations/accept" },
|
|
273
506
|
createInvitation: { method: "POST", path: "/_auth/invitations" },
|
|
@@ -301,7 +534,15 @@ var routeMap = {
|
|
|
301
534
|
cancelAccountDeletion: { method: "POST", path: "/_auth/deletion/cancel" },
|
|
302
535
|
issueOpsToken: { method: "POST", path: "/_auth/ops-tokens" },
|
|
303
536
|
listOpsTokens: { method: "GET", path: "/_auth/ops-tokens" },
|
|
304
|
-
revokeOpsToken: { method: "DELETE", path: "/_auth/ops-tokens/:id" }
|
|
537
|
+
revokeOpsToken: { method: "DELETE", path: "/_auth/ops-tokens/:id" },
|
|
538
|
+
registerOAuth2Client: { method: "POST", path: "/_auth/oauth2/register" },
|
|
539
|
+
listOAuth2Grants: { method: "GET", path: "/_auth/oauth2/grants" },
|
|
540
|
+
revokeOAuth2Grant: { method: "DELETE", path: "/_auth/oauth2/grants/:id" },
|
|
541
|
+
oauth2AuthorizationServerMetadata: { method: "GET", path: "/.well-known/oauth-authorization-server" },
|
|
542
|
+
getOAuth2Authorize: { method: "GET", path: "/_auth/oauth2/authorize" },
|
|
543
|
+
createOAuth2AuthorizationCode: { method: "POST", path: "/_auth/oauth2/authorize" },
|
|
544
|
+
oauth2Token: { method: "POST", path: "/_auth/oauth2/token" },
|
|
545
|
+
oauth2Revoke: { method: "POST", path: "/_auth/oauth2/revoke" }
|
|
305
546
|
};
|
|
306
547
|
|
|
307
548
|
// src/lib/types.ts
|
|
@@ -3075,6 +3316,39 @@ var PlatformSchema = Type.Union(
|
|
|
3075
3316
|
KEY_PLATFORM.map((platform) => Type.Literal(platform)),
|
|
3076
3317
|
{ description: "Platform the key lives on" }
|
|
3077
3318
|
);
|
|
3319
|
+
var PublicKeySchema = Type.String({
|
|
3320
|
+
maxLength: 2048,
|
|
3321
|
+
description: "Client public key, SPKI DER in base64"
|
|
3322
|
+
});
|
|
3323
|
+
var KeyIdSchema = Type.String({
|
|
3324
|
+
maxLength: 64,
|
|
3325
|
+
description: "Key identifier"
|
|
3326
|
+
});
|
|
3327
|
+
var FingerprintSchema = Type.String({
|
|
3328
|
+
maxLength: 128,
|
|
3329
|
+
description: "SHA-256 hex fingerprint of the public key"
|
|
3330
|
+
});
|
|
3331
|
+
var UserCodeSchema = Type.String({
|
|
3332
|
+
minLength: 8,
|
|
3333
|
+
maxLength: 16,
|
|
3334
|
+
description: "Device user code as displayed, e.g. WXYZ-2345. Dashes, spaces and case are ignored."
|
|
3335
|
+
});
|
|
3336
|
+
var DeviceAuthPollResponseSchema = Type.Union([
|
|
3337
|
+
Type.Object({
|
|
3338
|
+
status: Type.Literal("pending"),
|
|
3339
|
+
intervalMillis: Type.Integer({ description: "Milliseconds to wait before polling again" })
|
|
3340
|
+
}),
|
|
3341
|
+
Type.Object({
|
|
3342
|
+
status: Type.Literal("approved"),
|
|
3343
|
+
userId: Type.String(),
|
|
3344
|
+
publicId: Type.String(),
|
|
3345
|
+
email: Type.Optional(Type.String()),
|
|
3346
|
+
phone: Type.Optional(Type.String()),
|
|
3347
|
+
passwordChangeRequired: Type.Boolean()
|
|
3348
|
+
})
|
|
3349
|
+
], {
|
|
3350
|
+
description: "Pending, or the login the approval produced"
|
|
3351
|
+
});
|
|
3078
3352
|
var PasswordSchema = Type.String({
|
|
3079
3353
|
minLength: 8,
|
|
3080
3354
|
maxLength: 72,
|