@camstack/addon-auth 1.2.156 → 1.2.157
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/dist/webauthn/{_virtual_mf-localSharedImportMap___mfe_internal__addon_auth_webauthn_widgets-CUaB93Rh.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_auth_webauthn_widgets-BIwATeJB.mjs} +3 -3
- package/dist/webauthn/auth-webauthn.addon.js +30 -179
- package/dist/webauthn/auth-webauthn.addon.mjs +30 -179
- package/dist/webauthn/{hostInit-Dfl1FBoz.mjs → hostInit-V-UlvjJp.mjs} +3 -3
- package/dist/webauthn/remoteEntry.js +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import "./dist-CYZr2fwk.mjs";
|
|
|
3
3
|
var e = {
|
|
4
4
|
"@camstack/sdk": {
|
|
5
5
|
name: "@camstack/sdk",
|
|
6
|
-
version: "1.2.
|
|
6
|
+
version: "1.2.142",
|
|
7
7
|
scope: ["default"],
|
|
8
8
|
loaded: !1,
|
|
9
9
|
from: "addon_auth_webauthn_widgets",
|
|
@@ -18,7 +18,7 @@ var e = {
|
|
|
18
18
|
},
|
|
19
19
|
"@camstack/types": {
|
|
20
20
|
name: "@camstack/types",
|
|
21
|
-
version: "1.2.
|
|
21
|
+
version: "1.2.392",
|
|
22
22
|
scope: ["default"],
|
|
23
23
|
loaded: !1,
|
|
24
24
|
from: "addon_auth_webauthn_widgets",
|
|
@@ -33,7 +33,7 @@ var e = {
|
|
|
33
33
|
},
|
|
34
34
|
"@camstack/ui-library": {
|
|
35
35
|
name: "@camstack/ui-library",
|
|
36
|
-
version: "1.2.
|
|
36
|
+
version: "1.2.309",
|
|
37
37
|
scope: ["default"],
|
|
38
38
|
loaded: !1,
|
|
39
39
|
from: "addon_auth_webauthn_widgets",
|
|
@@ -12118,12 +12118,9 @@ async function hubBrowserOrigin(localNetwork, logger) {
|
|
|
12118
12118
|
//#endregion
|
|
12119
12119
|
//#region src/webauthn/record-kinds.ts
|
|
12120
12120
|
/**
|
|
12121
|
-
* Record kinds owned by `auth-webauthn` (records plan phase 6 / §2.8).
|
|
12122
|
-
*
|
|
12123
|
-
* Legacy tables are OPERATOR-ONLY drop after verify — never the orphan job.
|
|
12121
|
+
* Record kinds owned by `auth-webauthn` (records plan phase 6 / §2.8). The
|
|
12122
|
+
* legacy `auth-webauthn:*` collections they replaced are gone (D900).
|
|
12124
12123
|
*/
|
|
12125
|
-
var USER_PASSKEYS_LEGACY = "auth-webauthn:user_passkeys";
|
|
12126
|
-
var USER_PASSKEY_PREFS_LEGACY = "auth-webauthn:user_passkey_prefs";
|
|
12127
12124
|
var PasskeyBodySchema = require_dist.object({
|
|
12128
12125
|
credentialId: require_dist.string(),
|
|
12129
12126
|
userId: require_dist.string(),
|
|
@@ -12166,86 +12163,10 @@ var authWebauthnRecordKinds = require_dist.defineRecordKinds({
|
|
|
12166
12163
|
});
|
|
12167
12164
|
//#endregion
|
|
12168
12165
|
//#region src/webauthn/passkey-store.ts
|
|
12169
|
-
var COLLECTION = "auth-webauthn:user_passkeys";
|
|
12170
|
-
var PREF_COLLECTION = "auth-webauthn:user_passkey_prefs";
|
|
12171
|
-
var PREF_COLUMNS = [
|
|
12172
|
-
{
|
|
12173
|
-
name: "userId",
|
|
12174
|
-
type: "TEXT",
|
|
12175
|
-
primaryKey: true,
|
|
12176
|
-
notNull: true
|
|
12177
|
-
},
|
|
12178
|
-
{
|
|
12179
|
-
name: "secondFactorEnabled",
|
|
12180
|
-
type: "BOOLEAN",
|
|
12181
|
-
notNull: true
|
|
12182
|
-
},
|
|
12183
|
-
{
|
|
12184
|
-
name: "updatedAt",
|
|
12185
|
-
type: "INTEGER",
|
|
12186
|
-
notNull: true
|
|
12187
|
-
}
|
|
12188
|
-
];
|
|
12189
12166
|
var StoredPreferenceSchema = require_dist.object({
|
|
12190
12167
|
secondFactorEnabled: require_dist.boolean(),
|
|
12191
12168
|
updatedAt: require_dist.number()
|
|
12192
12169
|
});
|
|
12193
|
-
var COLUMNS = [
|
|
12194
|
-
{
|
|
12195
|
-
name: "credentialId",
|
|
12196
|
-
type: "TEXT",
|
|
12197
|
-
primaryKey: true,
|
|
12198
|
-
notNull: true
|
|
12199
|
-
},
|
|
12200
|
-
{
|
|
12201
|
-
name: "userId",
|
|
12202
|
-
type: "TEXT",
|
|
12203
|
-
notNull: true
|
|
12204
|
-
},
|
|
12205
|
-
{
|
|
12206
|
-
name: "publicKey",
|
|
12207
|
-
type: "TEXT",
|
|
12208
|
-
notNull: true
|
|
12209
|
-
},
|
|
12210
|
-
{
|
|
12211
|
-
name: "counter",
|
|
12212
|
-
type: "INTEGER",
|
|
12213
|
-
notNull: true
|
|
12214
|
-
},
|
|
12215
|
-
{
|
|
12216
|
-
name: "transports",
|
|
12217
|
-
type: "JSON"
|
|
12218
|
-
},
|
|
12219
|
-
{
|
|
12220
|
-
name: "label",
|
|
12221
|
-
type: "TEXT",
|
|
12222
|
-
notNull: true
|
|
12223
|
-
},
|
|
12224
|
-
{
|
|
12225
|
-
name: "createdAt",
|
|
12226
|
-
type: "INTEGER",
|
|
12227
|
-
notNull: true
|
|
12228
|
-
},
|
|
12229
|
-
{
|
|
12230
|
-
name: "lastUsedAt",
|
|
12231
|
-
type: "INTEGER"
|
|
12232
|
-
}
|
|
12233
|
-
];
|
|
12234
|
-
async function declarePasskeySchema(store, options) {
|
|
12235
|
-
const skip = new Set(options?.skipCollections ?? []);
|
|
12236
|
-
if (!skip.has(COLLECTION)) await store.declareCollection.mutate({
|
|
12237
|
-
collection: COLLECTION,
|
|
12238
|
-
columns: COLUMNS,
|
|
12239
|
-
indexes: [{
|
|
12240
|
-
name: "idx_user_passkeys_user_id",
|
|
12241
|
-
columns: ["userId"]
|
|
12242
|
-
}]
|
|
12243
|
-
});
|
|
12244
|
-
if (!skip.has(PREF_COLLECTION)) await store.declareCollection.mutate({
|
|
12245
|
-
collection: PREF_COLLECTION,
|
|
12246
|
-
columns: PREF_COLUMNS
|
|
12247
|
-
});
|
|
12248
|
-
}
|
|
12249
12170
|
function parseRow(data) {
|
|
12250
12171
|
const credentialId = data["credentialId"];
|
|
12251
12172
|
const userId = data["userId"];
|
|
@@ -12291,66 +12212,34 @@ function rowToPasskey(id, body) {
|
|
|
12291
12212
|
...rest
|
|
12292
12213
|
});
|
|
12293
12214
|
}
|
|
12215
|
+
/** The passkeys of every user, on `ctx.records` (D900: the legacy collections are gone). */
|
|
12294
12216
|
var PasskeyStore = class {
|
|
12295
12217
|
passkeysKind;
|
|
12296
12218
|
prefsKind;
|
|
12297
|
-
store;
|
|
12298
12219
|
constructor(deps) {
|
|
12299
|
-
|
|
12300
|
-
|
|
12301
|
-
this.prefsKind = deps.prefsKind;
|
|
12302
|
-
this.store = deps.legacyStore ?? null;
|
|
12303
|
-
} else {
|
|
12304
|
-
this.passkeysKind = null;
|
|
12305
|
-
this.prefsKind = null;
|
|
12306
|
-
this.store = deps;
|
|
12307
|
-
}
|
|
12220
|
+
this.passkeysKind = deps.passkeysKind;
|
|
12221
|
+
this.prefsKind = deps.prefsKind;
|
|
12308
12222
|
}
|
|
12309
12223
|
async insert(pk) {
|
|
12310
|
-
const
|
|
12311
|
-
if (
|
|
12312
|
-
|
|
12313
|
-
|
|
12314
|
-
|
|
12315
|
-
id: pk.credentialId,
|
|
12316
|
-
data: parsed.data
|
|
12317
|
-
});
|
|
12318
|
-
return;
|
|
12319
|
-
}
|
|
12320
|
-
await this.store.insert.mutate({
|
|
12321
|
-
collection: COLLECTION,
|
|
12322
|
-
record: {
|
|
12323
|
-
id: pk.credentialId,
|
|
12324
|
-
data: { ...pk }
|
|
12325
|
-
}
|
|
12224
|
+
const parsed = authWebauthnRecordKinds.passkeys.schema.safeParse(pkToBody(pk));
|
|
12225
|
+
if (!parsed.success) throw new Error(parsed.error.message);
|
|
12226
|
+
await this.passkeysKind.put({
|
|
12227
|
+
id: pk.credentialId,
|
|
12228
|
+
data: parsed.data
|
|
12326
12229
|
});
|
|
12327
12230
|
}
|
|
12328
12231
|
async findByCredentialId(credentialId) {
|
|
12329
|
-
const
|
|
12330
|
-
|
|
12331
|
-
|
|
12332
|
-
|
|
12333
|
-
|
|
12334
|
-
})).records[0];
|
|
12335
|
-
return row === void 0 ? null : rowToPasskey(row.id, row.data);
|
|
12336
|
-
}
|
|
12337
|
-
const results = await this.store.query.query({
|
|
12338
|
-
collection: COLLECTION,
|
|
12339
|
-
filter: { where: { credentialId } }
|
|
12340
|
-
});
|
|
12341
|
-
if (results.length === 0) return null;
|
|
12342
|
-
return parseRow(results[0].data);
|
|
12232
|
+
const row = (await this.passkeysKind.query({
|
|
12233
|
+
where: { credentialId },
|
|
12234
|
+
limit: 1
|
|
12235
|
+
})).records[0];
|
|
12236
|
+
return row === void 0 ? null : rowToPasskey(row.id, row.data);
|
|
12343
12237
|
}
|
|
12344
12238
|
async findByUserId(userId) {
|
|
12345
|
-
|
|
12346
|
-
if (kind !== null) return (await kind.query({
|
|
12239
|
+
return (await this.passkeysKind.query({
|
|
12347
12240
|
where: { userId },
|
|
12348
12241
|
limit: 500
|
|
12349
12242
|
})).records.map((row) => rowToPasskey(row.id, row.data));
|
|
12350
|
-
return (await this.store.query.query({
|
|
12351
|
-
collection: COLLECTION,
|
|
12352
|
-
filter: { where: { userId } }
|
|
12353
|
-
})).map((r) => parseRow(r.data));
|
|
12354
12243
|
}
|
|
12355
12244
|
async updateCounter(credentialId, counter) {
|
|
12356
12245
|
const existing = await this.findByCredentialId(credentialId);
|
|
@@ -12360,45 +12249,19 @@ var PasskeyStore = class {
|
|
|
12360
12249
|
counter,
|
|
12361
12250
|
lastUsedAt: Date.now()
|
|
12362
12251
|
};
|
|
12363
|
-
const
|
|
12364
|
-
if (
|
|
12365
|
-
|
|
12366
|
-
if (!parsed.success) return;
|
|
12367
|
-
await kind.put({
|
|
12368
|
-
id: credentialId,
|
|
12369
|
-
data: parsed.data
|
|
12370
|
-
});
|
|
12371
|
-
return;
|
|
12372
|
-
}
|
|
12373
|
-
await this.store.update.mutate({
|
|
12374
|
-
collection: COLLECTION,
|
|
12252
|
+
const parsed = authWebauthnRecordKinds.passkeys.schema.safeParse(pkToBody(next));
|
|
12253
|
+
if (!parsed.success) return;
|
|
12254
|
+
await this.passkeysKind.put({
|
|
12375
12255
|
id: credentialId,
|
|
12376
|
-
data:
|
|
12256
|
+
data: parsed.data
|
|
12377
12257
|
});
|
|
12378
12258
|
}
|
|
12379
12259
|
async delete(credentialId) {
|
|
12380
|
-
|
|
12381
|
-
if (kind !== null) {
|
|
12382
|
-
await kind.delete(credentialId);
|
|
12383
|
-
return;
|
|
12384
|
-
}
|
|
12385
|
-
await this.store.delete.mutate({
|
|
12386
|
-
collection: COLLECTION,
|
|
12387
|
-
key: credentialId
|
|
12388
|
-
});
|
|
12260
|
+
await this.passkeysKind.delete(credentialId);
|
|
12389
12261
|
}
|
|
12390
12262
|
async getSecondFactorPreference(userId) {
|
|
12391
|
-
const
|
|
12392
|
-
|
|
12393
|
-
const row = await prefsKind.get(userId);
|
|
12394
|
-
const parsed = StoredPreferenceSchema.safeParse(row?.data);
|
|
12395
|
-
return parsed.success ? parsed.data.secondFactorEnabled : false;
|
|
12396
|
-
}
|
|
12397
|
-
const raw = await this.store.get.query({
|
|
12398
|
-
collection: PREF_COLLECTION,
|
|
12399
|
-
key: userId
|
|
12400
|
-
});
|
|
12401
|
-
const parsed = StoredPreferenceSchema.safeParse(raw);
|
|
12263
|
+
const row = await this.prefsKind.get(userId);
|
|
12264
|
+
const parsed = StoredPreferenceSchema.safeParse(row?.data);
|
|
12402
12265
|
return parsed.success ? parsed.data.secondFactorEnabled : false;
|
|
12403
12266
|
}
|
|
12404
12267
|
async setSecondFactorPreference(userId, enabled) {
|
|
@@ -12406,20 +12269,11 @@ var PasskeyStore = class {
|
|
|
12406
12269
|
secondFactorEnabled: enabled,
|
|
12407
12270
|
updatedAt: Date.now()
|
|
12408
12271
|
};
|
|
12409
|
-
const
|
|
12410
|
-
if (
|
|
12411
|
-
|
|
12412
|
-
|
|
12413
|
-
|
|
12414
|
-
id: userId,
|
|
12415
|
-
data: parsed.data
|
|
12416
|
-
});
|
|
12417
|
-
return;
|
|
12418
|
-
}
|
|
12419
|
-
await this.store.set.mutate({
|
|
12420
|
-
collection: PREF_COLLECTION,
|
|
12421
|
-
key: userId,
|
|
12422
|
-
value
|
|
12272
|
+
const parsed = authWebauthnRecordKinds["passkey-prefs"].schema.safeParse(value);
|
|
12273
|
+
if (!parsed.success) throw new Error(parsed.error.message);
|
|
12274
|
+
await this.prefsKind.put({
|
|
12275
|
+
id: userId,
|
|
12276
|
+
data: parsed.data
|
|
12423
12277
|
});
|
|
12424
12278
|
}
|
|
12425
12279
|
};
|
|
@@ -12601,15 +12455,12 @@ var AuthWebauthnAddon = class extends require_dist.BaseAddon {
|
|
|
12601
12455
|
super({ ...DEFAULT_CONFIG });
|
|
12602
12456
|
}
|
|
12603
12457
|
async onInitialize() {
|
|
12604
|
-
const settingsStore = this.ctx.api?.settingsStore;
|
|
12605
12458
|
const records = this.ctx.records;
|
|
12606
|
-
if (!
|
|
12459
|
+
if (!records) throw new Error("addon-auth-webauthn: ctx.records required");
|
|
12607
12460
|
await records.declare(authWebauthnRecordKinds);
|
|
12608
|
-
await declarePasskeySchema(settingsStore, { skipCollections: [USER_PASSKEYS_LEGACY, USER_PASSKEY_PREFS_LEGACY] });
|
|
12609
12461
|
this.store = new PasskeyStore({
|
|
12610
12462
|
passkeysKind: records.kind(authWebauthnRecordKinds.passkeys),
|
|
12611
|
-
prefsKind: records.kind(authWebauthnRecordKinds["passkey-prefs"])
|
|
12612
|
-
legacyStore: settingsStore
|
|
12463
|
+
prefsKind: records.kind(authWebauthnRecordKinds["passkey-prefs"])
|
|
12613
12464
|
});
|
|
12614
12465
|
const provider = {
|
|
12615
12466
|
beginRegistration: async ({ userId, username }) => this.beginRegistration(userId, username),
|
|
@@ -12145,12 +12145,9 @@ async function hubBrowserOrigin(localNetwork, logger) {
|
|
|
12145
12145
|
//#endregion
|
|
12146
12146
|
//#region src/webauthn/record-kinds.ts
|
|
12147
12147
|
/**
|
|
12148
|
-
* Record kinds owned by `auth-webauthn` (records plan phase 6 / §2.8).
|
|
12149
|
-
*
|
|
12150
|
-
* Legacy tables are OPERATOR-ONLY drop after verify — never the orphan job.
|
|
12148
|
+
* Record kinds owned by `auth-webauthn` (records plan phase 6 / §2.8). The
|
|
12149
|
+
* legacy `auth-webauthn:*` collections they replaced are gone (D900).
|
|
12151
12150
|
*/
|
|
12152
|
-
var USER_PASSKEYS_LEGACY = "auth-webauthn:user_passkeys";
|
|
12153
|
-
var USER_PASSKEY_PREFS_LEGACY = "auth-webauthn:user_passkey_prefs";
|
|
12154
12151
|
var PasskeyBodySchema = object({
|
|
12155
12152
|
credentialId: string(),
|
|
12156
12153
|
userId: string(),
|
|
@@ -12193,86 +12190,10 @@ var authWebauthnRecordKinds = defineRecordKinds({
|
|
|
12193
12190
|
});
|
|
12194
12191
|
//#endregion
|
|
12195
12192
|
//#region src/webauthn/passkey-store.ts
|
|
12196
|
-
var COLLECTION = "auth-webauthn:user_passkeys";
|
|
12197
|
-
var PREF_COLLECTION = "auth-webauthn:user_passkey_prefs";
|
|
12198
|
-
var PREF_COLUMNS = [
|
|
12199
|
-
{
|
|
12200
|
-
name: "userId",
|
|
12201
|
-
type: "TEXT",
|
|
12202
|
-
primaryKey: true,
|
|
12203
|
-
notNull: true
|
|
12204
|
-
},
|
|
12205
|
-
{
|
|
12206
|
-
name: "secondFactorEnabled",
|
|
12207
|
-
type: "BOOLEAN",
|
|
12208
|
-
notNull: true
|
|
12209
|
-
},
|
|
12210
|
-
{
|
|
12211
|
-
name: "updatedAt",
|
|
12212
|
-
type: "INTEGER",
|
|
12213
|
-
notNull: true
|
|
12214
|
-
}
|
|
12215
|
-
];
|
|
12216
12193
|
var StoredPreferenceSchema = object({
|
|
12217
12194
|
secondFactorEnabled: boolean(),
|
|
12218
12195
|
updatedAt: number()
|
|
12219
12196
|
});
|
|
12220
|
-
var COLUMNS = [
|
|
12221
|
-
{
|
|
12222
|
-
name: "credentialId",
|
|
12223
|
-
type: "TEXT",
|
|
12224
|
-
primaryKey: true,
|
|
12225
|
-
notNull: true
|
|
12226
|
-
},
|
|
12227
|
-
{
|
|
12228
|
-
name: "userId",
|
|
12229
|
-
type: "TEXT",
|
|
12230
|
-
notNull: true
|
|
12231
|
-
},
|
|
12232
|
-
{
|
|
12233
|
-
name: "publicKey",
|
|
12234
|
-
type: "TEXT",
|
|
12235
|
-
notNull: true
|
|
12236
|
-
},
|
|
12237
|
-
{
|
|
12238
|
-
name: "counter",
|
|
12239
|
-
type: "INTEGER",
|
|
12240
|
-
notNull: true
|
|
12241
|
-
},
|
|
12242
|
-
{
|
|
12243
|
-
name: "transports",
|
|
12244
|
-
type: "JSON"
|
|
12245
|
-
},
|
|
12246
|
-
{
|
|
12247
|
-
name: "label",
|
|
12248
|
-
type: "TEXT",
|
|
12249
|
-
notNull: true
|
|
12250
|
-
},
|
|
12251
|
-
{
|
|
12252
|
-
name: "createdAt",
|
|
12253
|
-
type: "INTEGER",
|
|
12254
|
-
notNull: true
|
|
12255
|
-
},
|
|
12256
|
-
{
|
|
12257
|
-
name: "lastUsedAt",
|
|
12258
|
-
type: "INTEGER"
|
|
12259
|
-
}
|
|
12260
|
-
];
|
|
12261
|
-
async function declarePasskeySchema(store, options) {
|
|
12262
|
-
const skip = new Set(options?.skipCollections ?? []);
|
|
12263
|
-
if (!skip.has(COLLECTION)) await store.declareCollection.mutate({
|
|
12264
|
-
collection: COLLECTION,
|
|
12265
|
-
columns: COLUMNS,
|
|
12266
|
-
indexes: [{
|
|
12267
|
-
name: "idx_user_passkeys_user_id",
|
|
12268
|
-
columns: ["userId"]
|
|
12269
|
-
}]
|
|
12270
|
-
});
|
|
12271
|
-
if (!skip.has(PREF_COLLECTION)) await store.declareCollection.mutate({
|
|
12272
|
-
collection: PREF_COLLECTION,
|
|
12273
|
-
columns: PREF_COLUMNS
|
|
12274
|
-
});
|
|
12275
|
-
}
|
|
12276
12197
|
function parseRow(data) {
|
|
12277
12198
|
const credentialId = data["credentialId"];
|
|
12278
12199
|
const userId = data["userId"];
|
|
@@ -12318,66 +12239,34 @@ function rowToPasskey(id, body) {
|
|
|
12318
12239
|
...rest
|
|
12319
12240
|
});
|
|
12320
12241
|
}
|
|
12242
|
+
/** The passkeys of every user, on `ctx.records` (D900: the legacy collections are gone). */
|
|
12321
12243
|
var PasskeyStore = class {
|
|
12322
12244
|
passkeysKind;
|
|
12323
12245
|
prefsKind;
|
|
12324
|
-
store;
|
|
12325
12246
|
constructor(deps) {
|
|
12326
|
-
|
|
12327
|
-
|
|
12328
|
-
this.prefsKind = deps.prefsKind;
|
|
12329
|
-
this.store = deps.legacyStore ?? null;
|
|
12330
|
-
} else {
|
|
12331
|
-
this.passkeysKind = null;
|
|
12332
|
-
this.prefsKind = null;
|
|
12333
|
-
this.store = deps;
|
|
12334
|
-
}
|
|
12247
|
+
this.passkeysKind = deps.passkeysKind;
|
|
12248
|
+
this.prefsKind = deps.prefsKind;
|
|
12335
12249
|
}
|
|
12336
12250
|
async insert(pk) {
|
|
12337
|
-
const
|
|
12338
|
-
if (
|
|
12339
|
-
|
|
12340
|
-
|
|
12341
|
-
|
|
12342
|
-
id: pk.credentialId,
|
|
12343
|
-
data: parsed.data
|
|
12344
|
-
});
|
|
12345
|
-
return;
|
|
12346
|
-
}
|
|
12347
|
-
await this.store.insert.mutate({
|
|
12348
|
-
collection: COLLECTION,
|
|
12349
|
-
record: {
|
|
12350
|
-
id: pk.credentialId,
|
|
12351
|
-
data: { ...pk }
|
|
12352
|
-
}
|
|
12251
|
+
const parsed = authWebauthnRecordKinds.passkeys.schema.safeParse(pkToBody(pk));
|
|
12252
|
+
if (!parsed.success) throw new Error(parsed.error.message);
|
|
12253
|
+
await this.passkeysKind.put({
|
|
12254
|
+
id: pk.credentialId,
|
|
12255
|
+
data: parsed.data
|
|
12353
12256
|
});
|
|
12354
12257
|
}
|
|
12355
12258
|
async findByCredentialId(credentialId) {
|
|
12356
|
-
const
|
|
12357
|
-
|
|
12358
|
-
|
|
12359
|
-
|
|
12360
|
-
|
|
12361
|
-
})).records[0];
|
|
12362
|
-
return row === void 0 ? null : rowToPasskey(row.id, row.data);
|
|
12363
|
-
}
|
|
12364
|
-
const results = await this.store.query.query({
|
|
12365
|
-
collection: COLLECTION,
|
|
12366
|
-
filter: { where: { credentialId } }
|
|
12367
|
-
});
|
|
12368
|
-
if (results.length === 0) return null;
|
|
12369
|
-
return parseRow(results[0].data);
|
|
12259
|
+
const row = (await this.passkeysKind.query({
|
|
12260
|
+
where: { credentialId },
|
|
12261
|
+
limit: 1
|
|
12262
|
+
})).records[0];
|
|
12263
|
+
return row === void 0 ? null : rowToPasskey(row.id, row.data);
|
|
12370
12264
|
}
|
|
12371
12265
|
async findByUserId(userId) {
|
|
12372
|
-
|
|
12373
|
-
if (kind !== null) return (await kind.query({
|
|
12266
|
+
return (await this.passkeysKind.query({
|
|
12374
12267
|
where: { userId },
|
|
12375
12268
|
limit: 500
|
|
12376
12269
|
})).records.map((row) => rowToPasskey(row.id, row.data));
|
|
12377
|
-
return (await this.store.query.query({
|
|
12378
|
-
collection: COLLECTION,
|
|
12379
|
-
filter: { where: { userId } }
|
|
12380
|
-
})).map((r) => parseRow(r.data));
|
|
12381
12270
|
}
|
|
12382
12271
|
async updateCounter(credentialId, counter) {
|
|
12383
12272
|
const existing = await this.findByCredentialId(credentialId);
|
|
@@ -12387,45 +12276,19 @@ var PasskeyStore = class {
|
|
|
12387
12276
|
counter,
|
|
12388
12277
|
lastUsedAt: Date.now()
|
|
12389
12278
|
};
|
|
12390
|
-
const
|
|
12391
|
-
if (
|
|
12392
|
-
|
|
12393
|
-
if (!parsed.success) return;
|
|
12394
|
-
await kind.put({
|
|
12395
|
-
id: credentialId,
|
|
12396
|
-
data: parsed.data
|
|
12397
|
-
});
|
|
12398
|
-
return;
|
|
12399
|
-
}
|
|
12400
|
-
await this.store.update.mutate({
|
|
12401
|
-
collection: COLLECTION,
|
|
12279
|
+
const parsed = authWebauthnRecordKinds.passkeys.schema.safeParse(pkToBody(next));
|
|
12280
|
+
if (!parsed.success) return;
|
|
12281
|
+
await this.passkeysKind.put({
|
|
12402
12282
|
id: credentialId,
|
|
12403
|
-
data:
|
|
12283
|
+
data: parsed.data
|
|
12404
12284
|
});
|
|
12405
12285
|
}
|
|
12406
12286
|
async delete(credentialId) {
|
|
12407
|
-
|
|
12408
|
-
if (kind !== null) {
|
|
12409
|
-
await kind.delete(credentialId);
|
|
12410
|
-
return;
|
|
12411
|
-
}
|
|
12412
|
-
await this.store.delete.mutate({
|
|
12413
|
-
collection: COLLECTION,
|
|
12414
|
-
key: credentialId
|
|
12415
|
-
});
|
|
12287
|
+
await this.passkeysKind.delete(credentialId);
|
|
12416
12288
|
}
|
|
12417
12289
|
async getSecondFactorPreference(userId) {
|
|
12418
|
-
const
|
|
12419
|
-
|
|
12420
|
-
const row = await prefsKind.get(userId);
|
|
12421
|
-
const parsed = StoredPreferenceSchema.safeParse(row?.data);
|
|
12422
|
-
return parsed.success ? parsed.data.secondFactorEnabled : false;
|
|
12423
|
-
}
|
|
12424
|
-
const raw = await this.store.get.query({
|
|
12425
|
-
collection: PREF_COLLECTION,
|
|
12426
|
-
key: userId
|
|
12427
|
-
});
|
|
12428
|
-
const parsed = StoredPreferenceSchema.safeParse(raw);
|
|
12290
|
+
const row = await this.prefsKind.get(userId);
|
|
12291
|
+
const parsed = StoredPreferenceSchema.safeParse(row?.data);
|
|
12429
12292
|
return parsed.success ? parsed.data.secondFactorEnabled : false;
|
|
12430
12293
|
}
|
|
12431
12294
|
async setSecondFactorPreference(userId, enabled) {
|
|
@@ -12433,20 +12296,11 @@ var PasskeyStore = class {
|
|
|
12433
12296
|
secondFactorEnabled: enabled,
|
|
12434
12297
|
updatedAt: Date.now()
|
|
12435
12298
|
};
|
|
12436
|
-
const
|
|
12437
|
-
if (
|
|
12438
|
-
|
|
12439
|
-
|
|
12440
|
-
|
|
12441
|
-
id: userId,
|
|
12442
|
-
data: parsed.data
|
|
12443
|
-
});
|
|
12444
|
-
return;
|
|
12445
|
-
}
|
|
12446
|
-
await this.store.set.mutate({
|
|
12447
|
-
collection: PREF_COLLECTION,
|
|
12448
|
-
key: userId,
|
|
12449
|
-
value
|
|
12299
|
+
const parsed = authWebauthnRecordKinds["passkey-prefs"].schema.safeParse(value);
|
|
12300
|
+
if (!parsed.success) throw new Error(parsed.error.message);
|
|
12301
|
+
await this.prefsKind.put({
|
|
12302
|
+
id: userId,
|
|
12303
|
+
data: parsed.data
|
|
12450
12304
|
});
|
|
12451
12305
|
}
|
|
12452
12306
|
};
|
|
@@ -12591,15 +12445,12 @@ var AuthWebauthnAddon = class extends BaseAddon {
|
|
|
12591
12445
|
super({ ...DEFAULT_CONFIG });
|
|
12592
12446
|
}
|
|
12593
12447
|
async onInitialize() {
|
|
12594
|
-
const settingsStore = this.ctx.api?.settingsStore;
|
|
12595
12448
|
const records = this.ctx.records;
|
|
12596
|
-
if (!
|
|
12449
|
+
if (!records) throw new Error("addon-auth-webauthn: ctx.records required");
|
|
12597
12450
|
await records.declare(authWebauthnRecordKinds);
|
|
12598
|
-
await declarePasskeySchema(settingsStore, { skipCollections: [USER_PASSKEYS_LEGACY, USER_PASSKEY_PREFS_LEGACY] });
|
|
12599
12451
|
this.store = new PasskeyStore({
|
|
12600
12452
|
passkeysKind: records.kind(authWebauthnRecordKinds.passkeys),
|
|
12601
|
-
prefsKind: records.kind(authWebauthnRecordKinds["passkey-prefs"])
|
|
12602
|
-
legacyStore: settingsStore
|
|
12453
|
+
prefsKind: records.kind(authWebauthnRecordKinds["passkey-prefs"])
|
|
12603
12454
|
});
|
|
12604
12455
|
const provider = {
|
|
12605
12456
|
beginRegistration: async ({ userId, username }) => this.beginRegistration(userId, username),
|
|
@@ -36,7 +36,7 @@ async function r() {
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"@camstack/types": {
|
|
39
|
-
version: "1.2.
|
|
39
|
+
version: "1.2.392",
|
|
40
40
|
scope: "default",
|
|
41
41
|
shareConfig: {
|
|
42
42
|
singleton: !0,
|
|
@@ -45,7 +45,7 @@ async function r() {
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"@camstack/sdk": {
|
|
48
|
-
version: "1.2.
|
|
48
|
+
version: "1.2.142",
|
|
49
49
|
scope: "default",
|
|
50
50
|
shareConfig: {
|
|
51
51
|
singleton: !0,
|
|
@@ -81,7 +81,7 @@ async function r() {
|
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
"@camstack/ui-library": {
|
|
84
|
-
version: "1.2.
|
|
84
|
+
version: "1.2.309",
|
|
85
85
|
scope: "default",
|
|
86
86
|
shareConfig: {
|
|
87
87
|
singleton: !0,
|
|
@@ -30,7 +30,7 @@ async function d(e) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
async function f() {
|
|
33
|
-
return l ||= d(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_auth_webauthn_widgets-
|
|
33
|
+
return l ||= d(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_auth_webauthn_widgets-BIwATeJB.mjs")).catch((e) => {
|
|
34
34
|
throw l = void 0, e;
|
|
35
35
|
}), l;
|
|
36
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-auth",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.157",
|
|
4
4
|
"description": "Authentication bundle — OIDC and WebAuthn/passkey. Multi-entry npm package shipping 2 addons under a single bundle; each addon keeps its own id, capabilities, and runner.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|