@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.
- package/README.md +333 -18
- package/dist/{authenticate-C7w-pLOR.d.ts → authenticate-ZssfqJ7d.d.ts} +150 -9
- package/dist/client-proof.d.ts +1 -1
- package/dist/client-proof.js +30 -0
- package/dist/client-proof.js.map +1 -1
- package/dist/config.d.ts +36 -0
- package/dist/config.js +18 -0
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +93 -2
- package/dist/errors.js +57 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +36 -7
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -1
- package/dist/nextjs/server.d.ts +2 -2
- package/dist/server.d.ts +195 -80
- package/dist/server.js +515 -106
- package/dist/server.js.map +1 -1
- package/dist/{session-CGxgH3C9.d.ts → session-CFK4BT25.d.ts} +1 -1
- package/dist/{types-1BMx0OX1.d.ts → types-CD95yudz.d.ts} +15 -1
- 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/snapshot.json +2786 -0
- package/migrations/20260709073531_easy_hardball/snapshot.json +3119 -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/package.json +3 -6
- 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/0005_snapshot.json +0 -1721
- package/migrations/meta/0006_snapshot.json +0 -1921
- package/migrations/meta/0007_snapshot.json +0 -1916
- package/migrations/meta/_journal.json +0 -62
- /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/migrations/{0005_lethal_lifeguard.sql → 20260629103209_lethal_lifeguard/migration.sql} +0 -0
- /package/migrations/{0006_easy_hardball.sql → 20260709073531_easy_hardball/migration.sql} +0 -0
- /package/migrations/{0007_glossy_major_mapleleaf.sql → 20260714081434_glossy_major_mapleleaf/migration.sql} +0 -0
package/dist/index.js
CHANGED
|
@@ -116,12 +116,54 @@ var InvalidVerificationTokenError = class extends ValidationError {
|
|
|
116
116
|
this.name = "InvalidVerificationTokenError";
|
|
117
117
|
}
|
|
118
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
|
+
};
|
|
119
128
|
var InvalidKeyFingerprintError = class extends ValidationError {
|
|
120
129
|
constructor(data = {}) {
|
|
121
130
|
super({ message: data.message || "Invalid key fingerprint", details: data.details });
|
|
122
131
|
this.name = "InvalidKeyFingerprintError";
|
|
123
132
|
}
|
|
124
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
|
+
};
|
|
125
167
|
var VerificationTokenPurposeMismatchError = class extends ValidationError {
|
|
126
168
|
constructor(data = {}) {
|
|
127
169
|
const expected = data.expected || "unknown";
|
|
@@ -201,6 +243,11 @@ authErrorRegistry.append([
|
|
|
201
243
|
InvalidVerificationCodeError,
|
|
202
244
|
InvalidVerificationTokenError,
|
|
203
245
|
InvalidKeyFingerprintError,
|
|
246
|
+
NonceKeyBindingError,
|
|
247
|
+
NativeSignInUnsupportedError,
|
|
248
|
+
UnverifiedEmailLinkError,
|
|
249
|
+
KeyNotFoundError,
|
|
250
|
+
KeyIdAlreadyRegisteredError,
|
|
204
251
|
VerificationTokenPurposeMismatchError,
|
|
205
252
|
VerificationTokenTargetMismatchError,
|
|
206
253
|
InsufficientPermissionsError,
|
|
@@ -215,6 +262,9 @@ var routeMap = {
|
|
|
215
262
|
login: { method: "POST", path: "/_auth/login" },
|
|
216
263
|
logout: { method: "POST", path: "/_auth/logout" },
|
|
217
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" },
|
|
218
268
|
changePassword: { method: "PUT", path: "/_auth/password" },
|
|
219
269
|
getAuthSession: { method: "GET", path: "/_auth/session" },
|
|
220
270
|
issueOneTimeToken: { method: "POST", path: "/_auth/tokens" },
|
|
@@ -384,6 +434,8 @@ var BUILTIN_ROLE_PERMISSIONS = {
|
|
|
384
434
|
|
|
385
435
|
// src/server/types.ts
|
|
386
436
|
var KEY_ALGORITHM = ["ES256", "RS256"];
|
|
437
|
+
var KEY_PLATFORM = ["ios", "android", "web", "desktop"];
|
|
438
|
+
var KEY_DEVICE_NAME_MAX_LENGTH = 64;
|
|
387
439
|
var INVITATION_STATUSES = ["pending", "accepted", "expired", "cancelled"];
|
|
388
440
|
var USER_STATUSES = ["active", "inactive", "suspended", "pending_deletion", "deleted"];
|
|
389
441
|
var SOCIAL_PROVIDERS = ["google", "apple", "github", "kakao", "naver", "superself"];
|
|
@@ -3012,6 +3064,14 @@ var PhoneSchema = Type.String({
|
|
|
3012
3064
|
pattern: PHONE_PATTERN2,
|
|
3013
3065
|
description: "Phone number in E.164 format (e.g., +821012345678)"
|
|
3014
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
|
+
);
|
|
3015
3075
|
var PasswordSchema = Type.String({
|
|
3016
3076
|
minLength: 8,
|
|
3017
3077
|
maxLength: 72,
|