@stackframe/stack-shared 2.7.29 → 2.7.30
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/CHANGELOG.md +6 -0
- package/dist/interface/clientInterface.d.ts +4 -0
- package/dist/interface/clientInterface.js +13 -0
- package/dist/interface/crud/current-user.d.ts +7 -0
- package/dist/interface/crud/current-user.js +1 -0
- package/dist/interface/crud/team-invitation.d.ts +10 -0
- package/dist/interface/crud/team-invitation.js +10 -0
- package/dist/interface/crud/team-member-profiles.d.ts +4 -0
- package/dist/interface/crud/users.d.ts +18 -0
- package/dist/interface/crud/users.js +3 -0
- package/dist/interface/webhooks.d.ts +4 -0
- package/dist/known-errors.d.ts +3 -0
- package/dist/known-errors.js +5 -0
- package/dist/sessions.d.ts +2 -0
- package/dist/sessions.js +4 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -117,6 +117,10 @@ export declare class StackClientInterface {
|
|
|
117
117
|
accessToken: string;
|
|
118
118
|
refreshToken: string;
|
|
119
119
|
}, KnownErrors["UserWithEmailAlreadyExists"] | KnownErrors["PasswordRequirementsNotMet"]>>;
|
|
120
|
+
signUpAnonymously(session: InternalSession): Promise<Result<{
|
|
121
|
+
accessToken: string;
|
|
122
|
+
refreshToken: string;
|
|
123
|
+
}, never>>;
|
|
120
124
|
signInWithMagicLink(code: string): Promise<Result<{
|
|
121
125
|
newUser: boolean;
|
|
122
126
|
accessToken: string;
|
|
@@ -576,6 +576,19 @@ export class StackClientInterface {
|
|
|
576
576
|
refreshToken: result.refresh_token,
|
|
577
577
|
});
|
|
578
578
|
}
|
|
579
|
+
async signUpAnonymously(session) {
|
|
580
|
+
const res = await this.sendClientRequestAndCatchKnownError("/auth/anonymous/sign-up", {
|
|
581
|
+
method: "POST",
|
|
582
|
+
}, session, []);
|
|
583
|
+
if (res.status === "error") {
|
|
584
|
+
return Result.error(res.error);
|
|
585
|
+
}
|
|
586
|
+
const result = await res.data.json();
|
|
587
|
+
return Result.ok({
|
|
588
|
+
accessToken: result.access_token,
|
|
589
|
+
refreshToken: result.refresh_token,
|
|
590
|
+
});
|
|
591
|
+
}
|
|
579
592
|
async signInWithMagicLink(code) {
|
|
580
593
|
const res = await this.sendClientRequestAndCatchKnownError("/auth/otp/sign-in", {
|
|
581
594
|
method: "POST",
|
|
@@ -16,6 +16,7 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
|
|
|
16
16
|
passkey_auth_enabled: boolean;
|
|
17
17
|
otp_auth_enabled: boolean;
|
|
18
18
|
selected_team_id: string | null;
|
|
19
|
+
is_anonymous: boolean;
|
|
19
20
|
signed_up_at_millis: number;
|
|
20
21
|
has_password: boolean;
|
|
21
22
|
auth_with_email: boolean;
|
|
@@ -51,6 +52,7 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
|
|
|
51
52
|
client_read_only_metadata: undefined;
|
|
52
53
|
server_metadata: undefined;
|
|
53
54
|
last_active_at_millis: undefined;
|
|
55
|
+
is_anonymous: undefined;
|
|
54
56
|
oauth_providers: undefined;
|
|
55
57
|
auth_with_email: undefined;
|
|
56
58
|
requires_totp_mfa: undefined;
|
|
@@ -80,6 +82,7 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
|
|
|
80
82
|
client_read_only_metadata: {} | null;
|
|
81
83
|
server_metadata: {} | null;
|
|
82
84
|
last_active_at_millis: number;
|
|
85
|
+
is_anonymous: boolean;
|
|
83
86
|
oauth_providers: {
|
|
84
87
|
email?: string | null | undefined;
|
|
85
88
|
id: string;
|
|
@@ -112,6 +115,7 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
|
|
|
112
115
|
client_read_only_metadata: undefined;
|
|
113
116
|
server_metadata: undefined;
|
|
114
117
|
last_active_at_millis: undefined;
|
|
118
|
+
is_anonymous: undefined;
|
|
115
119
|
oauth_providers: undefined;
|
|
116
120
|
auth_with_email: undefined;
|
|
117
121
|
requires_totp_mfa: undefined;
|
|
@@ -139,6 +143,7 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
|
|
|
139
143
|
otp_auth_enabled: undefined;
|
|
140
144
|
totp_secret_base64: undefined;
|
|
141
145
|
selected_team_id: undefined;
|
|
146
|
+
is_anonymous: undefined;
|
|
142
147
|
}, "">;
|
|
143
148
|
serverUpdateSchema: import("yup").ObjectSchema<{
|
|
144
149
|
display_name: string | null | undefined;
|
|
@@ -155,6 +160,7 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
|
|
|
155
160
|
otp_auth_enabled: boolean | undefined;
|
|
156
161
|
totp_secret_base64: string | null | undefined;
|
|
157
162
|
selected_team_id: string | null | undefined;
|
|
163
|
+
is_anonymous: boolean | undefined;
|
|
158
164
|
}, import("yup").AnyObject, {
|
|
159
165
|
display_name: undefined;
|
|
160
166
|
profile_image_url: undefined;
|
|
@@ -170,6 +176,7 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
|
|
|
170
176
|
otp_auth_enabled: undefined;
|
|
171
177
|
totp_secret_base64: undefined;
|
|
172
178
|
selected_team_id: undefined;
|
|
179
|
+
is_anonymous: undefined;
|
|
173
180
|
}, "">;
|
|
174
181
|
clientDeleteSchema: import("yup").MixedSchema<{} | undefined, import("yup").AnyObject, undefined, "">;
|
|
175
182
|
docs: {
|
|
@@ -29,6 +29,16 @@ export declare const teamInvitationCrud: import("../../crud").CrudSchemaFromOpti
|
|
|
29
29
|
description: string;
|
|
30
30
|
tags: string[];
|
|
31
31
|
};
|
|
32
|
+
clientList: {
|
|
33
|
+
summary: string;
|
|
34
|
+
description: string;
|
|
35
|
+
tags: string[];
|
|
36
|
+
};
|
|
37
|
+
clientDelete: {
|
|
38
|
+
summary: string;
|
|
39
|
+
description: string;
|
|
40
|
+
tags: string[];
|
|
41
|
+
};
|
|
32
42
|
};
|
|
33
43
|
}>;
|
|
34
44
|
export type TeamInvitationCrud = CrudTypeOf<typeof teamInvitationCrud>;
|
|
@@ -16,5 +16,15 @@ export const teamInvitationCrud = createCrud({
|
|
|
16
16
|
description: "",
|
|
17
17
|
tags: ["Teams"],
|
|
18
18
|
},
|
|
19
|
+
clientList: {
|
|
20
|
+
summary: "List team invitations",
|
|
21
|
+
description: "",
|
|
22
|
+
tags: ["Teams"],
|
|
23
|
+
},
|
|
24
|
+
clientDelete: {
|
|
25
|
+
summary: "Delete a team invitation",
|
|
26
|
+
description: "",
|
|
27
|
+
tags: ["Teams"],
|
|
28
|
+
},
|
|
19
29
|
},
|
|
20
30
|
});
|
|
@@ -34,6 +34,7 @@ export declare const teamMemberProfilesCrudServerReadSchema: import("yup").Objec
|
|
|
34
34
|
passkey_auth_enabled: boolean;
|
|
35
35
|
otp_auth_enabled: boolean;
|
|
36
36
|
selected_team_id: string | null;
|
|
37
|
+
is_anonymous: boolean;
|
|
37
38
|
selected_team: {
|
|
38
39
|
client_metadata?: {} | null | undefined;
|
|
39
40
|
client_read_only_metadata?: {} | null | undefined;
|
|
@@ -79,6 +80,7 @@ export declare const teamMemberProfilesCrudServerReadSchema: import("yup").Objec
|
|
|
79
80
|
client_read_only_metadata: undefined;
|
|
80
81
|
server_metadata: undefined;
|
|
81
82
|
last_active_at_millis: undefined;
|
|
83
|
+
is_anonymous: undefined;
|
|
82
84
|
oauth_providers: undefined;
|
|
83
85
|
auth_with_email: undefined;
|
|
84
86
|
requires_totp_mfa: undefined;
|
|
@@ -127,6 +129,7 @@ export declare const teamMemberProfilesCrud: import("../../crud").CrudSchemaFrom
|
|
|
127
129
|
passkey_auth_enabled: boolean;
|
|
128
130
|
otp_auth_enabled: boolean;
|
|
129
131
|
selected_team_id: string | null;
|
|
132
|
+
is_anonymous: boolean;
|
|
130
133
|
selected_team: {
|
|
131
134
|
client_metadata?: {} | null | undefined;
|
|
132
135
|
client_read_only_metadata?: {} | null | undefined;
|
|
@@ -172,6 +175,7 @@ export declare const teamMemberProfilesCrud: import("../../crud").CrudSchemaFrom
|
|
|
172
175
|
client_read_only_metadata: undefined;
|
|
173
176
|
server_metadata: undefined;
|
|
174
177
|
last_active_at_millis: undefined;
|
|
178
|
+
is_anonymous: undefined;
|
|
175
179
|
oauth_providers: undefined;
|
|
176
180
|
auth_with_email: undefined;
|
|
177
181
|
requires_totp_mfa: undefined;
|
|
@@ -14,6 +14,7 @@ export declare const usersCrudServerUpdateSchema: import("yup").ObjectSchema<{
|
|
|
14
14
|
otp_auth_enabled: boolean | undefined;
|
|
15
15
|
totp_secret_base64: string | null | undefined;
|
|
16
16
|
selected_team_id: string | null | undefined;
|
|
17
|
+
is_anonymous: boolean | undefined;
|
|
17
18
|
}, import("yup").AnyObject, {
|
|
18
19
|
display_name: undefined;
|
|
19
20
|
profile_image_url: undefined;
|
|
@@ -29,6 +30,7 @@ export declare const usersCrudServerUpdateSchema: import("yup").ObjectSchema<{
|
|
|
29
30
|
otp_auth_enabled: undefined;
|
|
30
31
|
totp_secret_base64: undefined;
|
|
31
32
|
selected_team_id: undefined;
|
|
33
|
+
is_anonymous: undefined;
|
|
32
34
|
}, "">;
|
|
33
35
|
export declare const usersCrudServerReadSchema: import("yup").ObjectSchema<{
|
|
34
36
|
id: string;
|
|
@@ -55,6 +57,7 @@ export declare const usersCrudServerReadSchema: import("yup").ObjectSchema<{
|
|
|
55
57
|
client_read_only_metadata: {} | null;
|
|
56
58
|
server_metadata: {} | null;
|
|
57
59
|
last_active_at_millis: number;
|
|
60
|
+
is_anonymous: boolean;
|
|
58
61
|
oauth_providers: {
|
|
59
62
|
email?: string | null | undefined;
|
|
60
63
|
id: string;
|
|
@@ -87,6 +90,7 @@ export declare const usersCrudServerReadSchema: import("yup").ObjectSchema<{
|
|
|
87
90
|
client_read_only_metadata: undefined;
|
|
88
91
|
server_metadata: undefined;
|
|
89
92
|
last_active_at_millis: undefined;
|
|
93
|
+
is_anonymous: undefined;
|
|
90
94
|
oauth_providers: undefined;
|
|
91
95
|
auth_with_email: undefined;
|
|
92
96
|
requires_totp_mfa: undefined;
|
|
@@ -105,12 +109,14 @@ export declare const usersCrudServerCreateSchema: import("yup").ObjectSchema<{
|
|
|
105
109
|
password_hash: string | undefined;
|
|
106
110
|
otp_auth_enabled: boolean | undefined;
|
|
107
111
|
totp_secret_base64: string | null | undefined;
|
|
112
|
+
is_anonymous: boolean | undefined;
|
|
108
113
|
} & {
|
|
109
114
|
oauth_providers: {
|
|
110
115
|
email: string | null;
|
|
111
116
|
id: string;
|
|
112
117
|
account_id: string;
|
|
113
118
|
}[] | undefined;
|
|
119
|
+
is_anonymous: boolean | undefined;
|
|
114
120
|
}, import("yup").AnyObject, {
|
|
115
121
|
display_name: undefined;
|
|
116
122
|
profile_image_url: undefined;
|
|
@@ -126,6 +132,7 @@ export declare const usersCrudServerCreateSchema: import("yup").ObjectSchema<{
|
|
|
126
132
|
otp_auth_enabled: undefined;
|
|
127
133
|
totp_secret_base64: undefined;
|
|
128
134
|
selected_team_id: undefined;
|
|
135
|
+
is_anonymous: undefined;
|
|
129
136
|
oauth_providers: undefined;
|
|
130
137
|
}, "">;
|
|
131
138
|
export declare const usersCrudServerDeleteSchema: import("yup").MixedSchema<{} | undefined, import("yup").AnyObject, undefined, "">;
|
|
@@ -155,6 +162,7 @@ export declare const usersCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
155
162
|
client_read_only_metadata: {} | null;
|
|
156
163
|
server_metadata: {} | null;
|
|
157
164
|
last_active_at_millis: number;
|
|
165
|
+
is_anonymous: boolean;
|
|
158
166
|
oauth_providers: {
|
|
159
167
|
email?: string | null | undefined;
|
|
160
168
|
id: string;
|
|
@@ -187,6 +195,7 @@ export declare const usersCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
187
195
|
client_read_only_metadata: undefined;
|
|
188
196
|
server_metadata: undefined;
|
|
189
197
|
last_active_at_millis: undefined;
|
|
198
|
+
is_anonymous: undefined;
|
|
190
199
|
oauth_providers: undefined;
|
|
191
200
|
auth_with_email: undefined;
|
|
192
201
|
requires_totp_mfa: undefined;
|
|
@@ -206,6 +215,7 @@ export declare const usersCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
206
215
|
otp_auth_enabled: boolean | undefined;
|
|
207
216
|
totp_secret_base64: string | null | undefined;
|
|
208
217
|
selected_team_id: string | null | undefined;
|
|
218
|
+
is_anonymous: boolean | undefined;
|
|
209
219
|
}, import("yup").AnyObject, {
|
|
210
220
|
display_name: undefined;
|
|
211
221
|
profile_image_url: undefined;
|
|
@@ -221,6 +231,7 @@ export declare const usersCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
221
231
|
otp_auth_enabled: undefined;
|
|
222
232
|
totp_secret_base64: undefined;
|
|
223
233
|
selected_team_id: undefined;
|
|
234
|
+
is_anonymous: undefined;
|
|
224
235
|
}, "">;
|
|
225
236
|
serverCreateSchema: import("yup").ObjectSchema<{
|
|
226
237
|
primary_email: string | null | undefined;
|
|
@@ -236,12 +247,14 @@ export declare const usersCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
236
247
|
password_hash: string | undefined;
|
|
237
248
|
otp_auth_enabled: boolean | undefined;
|
|
238
249
|
totp_secret_base64: string | null | undefined;
|
|
250
|
+
is_anonymous: boolean | undefined;
|
|
239
251
|
} & {
|
|
240
252
|
oauth_providers: {
|
|
241
253
|
email: string | null;
|
|
242
254
|
id: string;
|
|
243
255
|
account_id: string;
|
|
244
256
|
}[] | undefined;
|
|
257
|
+
is_anonymous: boolean | undefined;
|
|
245
258
|
}, import("yup").AnyObject, {
|
|
246
259
|
display_name: undefined;
|
|
247
260
|
profile_image_url: undefined;
|
|
@@ -257,6 +270,7 @@ export declare const usersCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
257
270
|
otp_auth_enabled: undefined;
|
|
258
271
|
totp_secret_base64: undefined;
|
|
259
272
|
selected_team_id: undefined;
|
|
273
|
+
is_anonymous: undefined;
|
|
260
274
|
oauth_providers: undefined;
|
|
261
275
|
}, "">;
|
|
262
276
|
serverDeleteSchema: import("yup").MixedSchema<{} | undefined, import("yup").AnyObject, undefined, "">;
|
|
@@ -316,6 +330,7 @@ export declare const userCreatedWebhookEvent: {
|
|
|
316
330
|
client_read_only_metadata: {} | null;
|
|
317
331
|
server_metadata: {} | null;
|
|
318
332
|
last_active_at_millis: number;
|
|
333
|
+
is_anonymous: boolean;
|
|
319
334
|
oauth_providers: {
|
|
320
335
|
email?: string | null | undefined;
|
|
321
336
|
id: string;
|
|
@@ -348,6 +363,7 @@ export declare const userCreatedWebhookEvent: {
|
|
|
348
363
|
client_read_only_metadata: undefined;
|
|
349
364
|
server_metadata: undefined;
|
|
350
365
|
last_active_at_millis: undefined;
|
|
366
|
+
is_anonymous: undefined;
|
|
351
367
|
oauth_providers: undefined;
|
|
352
368
|
auth_with_email: undefined;
|
|
353
369
|
requires_totp_mfa: undefined;
|
|
@@ -385,6 +401,7 @@ export declare const userUpdatedWebhookEvent: {
|
|
|
385
401
|
client_read_only_metadata: {} | null;
|
|
386
402
|
server_metadata: {} | null;
|
|
387
403
|
last_active_at_millis: number;
|
|
404
|
+
is_anonymous: boolean;
|
|
388
405
|
oauth_providers: {
|
|
389
406
|
email?: string | null | undefined;
|
|
390
407
|
id: string;
|
|
@@ -417,6 +434,7 @@ export declare const userUpdatedWebhookEvent: {
|
|
|
417
434
|
client_read_only_metadata: undefined;
|
|
418
435
|
server_metadata: undefined;
|
|
419
436
|
last_active_at_millis: undefined;
|
|
437
|
+
is_anonymous: undefined;
|
|
420
438
|
oauth_providers: undefined;
|
|
421
439
|
auth_with_email: undefined;
|
|
422
440
|
requires_totp_mfa: undefined;
|
|
@@ -16,6 +16,7 @@ export const usersCrudServerUpdateSchema = fieldSchema.yupObject({
|
|
|
16
16
|
otp_auth_enabled: fieldSchema.userOtpAuthEnabledMutationSchema.optional(),
|
|
17
17
|
totp_secret_base64: fieldSchema.userTotpSecretMutationSchema.optional(),
|
|
18
18
|
selected_team_id: fieldSchema.selectedTeamIdSchema.nullable().optional(),
|
|
19
|
+
is_anonymous: fieldSchema.yupBoolean().oneOf([false]).optional(),
|
|
19
20
|
}).defined();
|
|
20
21
|
export const usersCrudServerReadSchema = fieldSchema.yupObject({
|
|
21
22
|
id: fieldSchema.userIdSchema.defined(),
|
|
@@ -34,6 +35,7 @@ export const usersCrudServerReadSchema = fieldSchema.yupObject({
|
|
|
34
35
|
client_read_only_metadata: fieldSchema.userClientReadOnlyMetadataSchema,
|
|
35
36
|
server_metadata: fieldSchema.userServerMetadataSchema,
|
|
36
37
|
last_active_at_millis: fieldSchema.userLastActiveAtMillisSchema.nonNullable().defined(),
|
|
38
|
+
is_anonymous: fieldSchema.yupBoolean().defined(),
|
|
37
39
|
oauth_providers: fieldSchema.yupArray(fieldSchema.yupObject({
|
|
38
40
|
id: fieldSchema.yupString().defined(),
|
|
39
41
|
account_id: fieldSchema.yupString().defined(),
|
|
@@ -54,6 +56,7 @@ export const usersCrudServerCreateSchema = usersCrudServerUpdateSchema.omit(['se
|
|
|
54
56
|
account_id: fieldSchema.yupString().defined(),
|
|
55
57
|
email: fieldSchema.yupString().nullable().defined().default(null),
|
|
56
58
|
}).defined()).optional().meta({ openapiField: { hidden: true } }),
|
|
59
|
+
is_anonymous: fieldSchema.yupBoolean().optional(),
|
|
57
60
|
}).defined());
|
|
58
61
|
export const usersCrudServerDeleteSchema = fieldSchema.yupMixed();
|
|
59
62
|
export const usersCrud = createCrud({
|
|
@@ -35,6 +35,7 @@ export declare const webhookEvents: readonly [{
|
|
|
35
35
|
client_read_only_metadata: {} | null;
|
|
36
36
|
server_metadata: {} | null;
|
|
37
37
|
last_active_at_millis: number;
|
|
38
|
+
is_anonymous: boolean;
|
|
38
39
|
oauth_providers: {
|
|
39
40
|
email?: string | null | undefined;
|
|
40
41
|
id: string;
|
|
@@ -67,6 +68,7 @@ export declare const webhookEvents: readonly [{
|
|
|
67
68
|
client_read_only_metadata: undefined;
|
|
68
69
|
server_metadata: undefined;
|
|
69
70
|
last_active_at_millis: undefined;
|
|
71
|
+
is_anonymous: undefined;
|
|
70
72
|
oauth_providers: undefined;
|
|
71
73
|
auth_with_email: undefined;
|
|
72
74
|
requires_totp_mfa: undefined;
|
|
@@ -103,6 +105,7 @@ export declare const webhookEvents: readonly [{
|
|
|
103
105
|
client_read_only_metadata: {} | null;
|
|
104
106
|
server_metadata: {} | null;
|
|
105
107
|
last_active_at_millis: number;
|
|
108
|
+
is_anonymous: boolean;
|
|
106
109
|
oauth_providers: {
|
|
107
110
|
email?: string | null | undefined;
|
|
108
111
|
id: string;
|
|
@@ -135,6 +138,7 @@ export declare const webhookEvents: readonly [{
|
|
|
135
138
|
client_read_only_metadata: undefined;
|
|
136
139
|
server_metadata: undefined;
|
|
137
140
|
last_active_at_millis: undefined;
|
|
141
|
+
is_anonymous: undefined;
|
|
138
142
|
oauth_providers: undefined;
|
|
139
143
|
auth_with_email: undefined;
|
|
140
144
|
requires_totp_mfa: undefined;
|
package/dist/known-errors.d.ts
CHANGED
|
@@ -247,6 +247,9 @@ export declare const KnownErrors: {
|
|
|
247
247
|
PasskeyAuthenticationNotEnabled: KnownErrorConstructor<KnownError & KnownErrorBrand<"PASSKEY_AUTHENTICATION_NOT_ENABLED">, []> & {
|
|
248
248
|
errorCode: "PASSKEY_AUTHENTICATION_NOT_ENABLED";
|
|
249
249
|
};
|
|
250
|
+
AnonymousAccountsNotEnabled: KnownErrorConstructor<KnownError & KnownErrorBrand<"ANONYMOUS_ACCOUNTS_NOT_ENABLED">, []> & {
|
|
251
|
+
errorCode: "ANONYMOUS_ACCOUNTS_NOT_ENABLED";
|
|
252
|
+
};
|
|
250
253
|
EmailPasswordMismatch: KnownErrorConstructor<KnownError & KnownErrorBrand<"EMAIL_PASSWORD_MISMATCH">, []> & {
|
|
251
254
|
errorCode: "EMAIL_PASSWORD_MISMATCH";
|
|
252
255
|
};
|
package/dist/known-errors.js
CHANGED
|
@@ -320,6 +320,10 @@ const PasskeyAuthenticationNotEnabled = createKnownErrorConstructor(KnownError,
|
|
|
320
320
|
400,
|
|
321
321
|
"Passkey authentication is not enabled for this project.",
|
|
322
322
|
], () => []);
|
|
323
|
+
const AnonymousAccountsNotEnabled = createKnownErrorConstructor(KnownError, "ANONYMOUS_ACCOUNTS_NOT_ENABLED", () => [
|
|
324
|
+
400,
|
|
325
|
+
"Anonymous accounts are not enabled for this project.",
|
|
326
|
+
], () => []);
|
|
323
327
|
const EmailPasswordMismatch = createKnownErrorConstructor(KnownError, "EMAIL_PASSWORD_MISMATCH", () => [
|
|
324
328
|
400,
|
|
325
329
|
"Wrong e-mail or password.",
|
|
@@ -606,6 +610,7 @@ export const KnownErrors = {
|
|
|
606
610
|
SignUpNotEnabled,
|
|
607
611
|
PasswordAuthenticationNotEnabled,
|
|
608
612
|
PasskeyAuthenticationNotEnabled,
|
|
613
|
+
AnonymousAccountsNotEnabled,
|
|
609
614
|
EmailPasswordMismatch,
|
|
610
615
|
RedirectUrlNotWhitelisted,
|
|
611
616
|
PasswordRequirementsNotMet,
|
package/dist/sessions.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import * as jose from 'jose';
|
|
1
2
|
export declare class AccessToken {
|
|
2
3
|
readonly token: string;
|
|
3
4
|
constructor(token: string);
|
|
5
|
+
get decoded(): jose.JWTPayload;
|
|
4
6
|
get expiresAt(): Date;
|
|
5
7
|
/**
|
|
6
8
|
* @returns The number of milliseconds until the access token expires, or 0 if it has already expired.
|
package/dist/sessions.js
CHANGED
|
@@ -8,8 +8,11 @@ export class AccessToken {
|
|
|
8
8
|
throw new StackAssertionError("Access token is the string 'undefined'; it's unlikely this is the correct value. They're supposed to be unguessable!");
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
+
get decoded() {
|
|
12
|
+
return jose.decodeJwt(this.token);
|
|
13
|
+
}
|
|
11
14
|
get expiresAt() {
|
|
12
|
-
const { exp } =
|
|
15
|
+
const { exp } = this.decoded;
|
|
13
16
|
if (exp === undefined)
|
|
14
17
|
return new Date(8640000000000000); // max date value
|
|
15
18
|
return new Date(exp * 1000);
|