@adminforth/two-factors-auth 7.0.2 → 7.1.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/dist/index.js
CHANGED
|
@@ -167,7 +167,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
167
167
|
this.adminforth.config.auth.userMenuSettingsPages = [];
|
|
168
168
|
}
|
|
169
169
|
this.adminforth.config.auth.userMenuSettingsPages.push({
|
|
170
|
-
icon: '
|
|
170
|
+
icon: 'lucide:key-round',
|
|
171
171
|
pageLabel: 'Passkeys',
|
|
172
172
|
slug: 'passkeys',
|
|
173
173
|
component: this.componentPath('TwoFactorsPasskeysSettings.vue'),
|
|
@@ -15,4 +15,9 @@ export declare class PasskeyRepository {
|
|
|
15
15
|
updateMeta(passkeyRecord: AnyRecord, meta: AnyRecord): Promise<void>;
|
|
16
16
|
update(passkeyRecord: AnyRecord, newRecord: AnyRecord, adminUser: AdminUser): Promise<void>;
|
|
17
17
|
delete(passkeyRecord: AnyRecord, adminUser: AdminUser): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Users manage their own passkeys and the plugin checks the ownership itself, so these are system
|
|
20
|
+
* writes on the user's behalf, which run the resource hooks (e.g. the audit log).
|
|
21
|
+
*/
|
|
22
|
+
private ownerWriter;
|
|
18
23
|
}
|
|
@@ -49,11 +49,10 @@ export class PasskeyRepository {
|
|
|
49
49
|
}
|
|
50
50
|
create(record, adminUser) {
|
|
51
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
yield this.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
});
|
|
52
|
+
const { error } = yield this.ownerWriter(adminUser).create(record);
|
|
53
|
+
if (error) {
|
|
54
|
+
throw new Error(error);
|
|
55
|
+
}
|
|
57
56
|
});
|
|
58
57
|
}
|
|
59
58
|
updateMeta(passkeyRecord, meta) {
|
|
@@ -67,23 +66,24 @@ export class PasskeyRepository {
|
|
|
67
66
|
}
|
|
68
67
|
update(passkeyRecord, newRecord, adminUser) {
|
|
69
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
yield this.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
adminUser,
|
|
76
|
-
});
|
|
69
|
+
const { error } = yield this.ownerWriter(adminUser, { oldRecord: passkeyRecord })
|
|
70
|
+
.update(passkeyRecord[this.getCredentialResourcePkField()], newRecord);
|
|
71
|
+
if (error) {
|
|
72
|
+
throw new Error(error);
|
|
73
|
+
}
|
|
77
74
|
});
|
|
78
75
|
}
|
|
79
76
|
delete(passkeyRecord, adminUser) {
|
|
80
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
yield this.
|
|
82
|
-
|
|
83
|
-
recordId: passkeyRecord[this.getCredentialResourcePkField()],
|
|
84
|
-
record: passkeyRecord,
|
|
85
|
-
adminUser,
|
|
86
|
-
});
|
|
78
|
+
yield this.ownerWriter(adminUser, { record: passkeyRecord })
|
|
79
|
+
.delete(passkeyRecord[this.getCredentialResourcePkField()]);
|
|
87
80
|
});
|
|
88
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Users manage their own passkeys and the plugin checks the ownership itself, so these are system
|
|
84
|
+
* writes on the user's behalf, which run the resource hooks (e.g. the audit log).
|
|
85
|
+
*/
|
|
86
|
+
ownerWriter(adminUser, snapshot = {}) {
|
|
87
|
+
return this.adminforth.resource(this.options.passkeys.credentialResourceID).asSystem(Object.assign({ adminUser }, snapshot));
|
|
88
|
+
}
|
|
89
89
|
}
|
package/index.ts
CHANGED
|
@@ -190,7 +190,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
190
190
|
this.adminforth.config.auth.userMenuSettingsPages = [];
|
|
191
191
|
}
|
|
192
192
|
this.adminforth.config.auth.userMenuSettingsPages.push({
|
|
193
|
-
icon: '
|
|
193
|
+
icon: 'lucide:key-round',
|
|
194
194
|
pageLabel: 'Passkeys',
|
|
195
195
|
slug: 'passkeys',
|
|
196
196
|
component: this.componentPath('TwoFactorsPasskeysSettings.vue'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminforth/two-factors-auth",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.1",
|
|
4
4
|
"description": "AdminForth plugin for two factors authentication",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"zod": "^4.3.6"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"adminforth": "^4.
|
|
32
|
+
"adminforth": "^4.22.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "^22.10.7",
|
|
36
|
-
"adminforth": "^4.
|
|
36
|
+
"adminforth": "^4.22.0",
|
|
37
37
|
"semantic-release": "^24.2.1",
|
|
38
38
|
"semantic-release-slack-bot": "^4.0.2",
|
|
39
39
|
"typescript": "^5.7.3"
|
|
@@ -42,11 +42,10 @@ export class PasskeyRepository {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
public async create(record: AnyRecord, adminUser: AdminUser): Promise<void> {
|
|
45
|
-
await this.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
45
|
+
const { error } = await this.ownerWriter(adminUser).create(record);
|
|
46
|
+
if (error) {
|
|
47
|
+
throw new Error(error);
|
|
48
|
+
}
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
public async updateMeta(passkeyRecord: AnyRecord, meta: AnyRecord): Promise<void> {
|
|
@@ -58,21 +57,23 @@ export class PasskeyRepository {
|
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
public async update(passkeyRecord: AnyRecord, newRecord: AnyRecord, adminUser: AdminUser): Promise<void> {
|
|
61
|
-
await this.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
adminUser,
|
|
67
|
-
});
|
|
60
|
+
const { error } = await this.ownerWriter(adminUser, { oldRecord: passkeyRecord })
|
|
61
|
+
.update(passkeyRecord[this.getCredentialResourcePkField()], newRecord);
|
|
62
|
+
if (error) {
|
|
63
|
+
throw new Error(error);
|
|
64
|
+
}
|
|
68
65
|
}
|
|
69
66
|
|
|
70
67
|
public async delete(passkeyRecord: AnyRecord, adminUser: AdminUser): Promise<void> {
|
|
71
|
-
await this.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
await this.ownerWriter(adminUser, { record: passkeyRecord })
|
|
69
|
+
.delete(passkeyRecord[this.getCredentialResourcePkField()]);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Users manage their own passkeys and the plugin checks the ownership itself, so these are system
|
|
74
|
+
* writes on the user's behalf, which run the resource hooks (e.g. the audit log).
|
|
75
|
+
*/
|
|
76
|
+
private ownerWriter(adminUser: AdminUser, snapshot: { record?: AnyRecord; oldRecord?: AnyRecord } = {}) {
|
|
77
|
+
return this.adminforth.resource(this.options.passkeys.credentialResourceID).asSystem({ adminUser, ...snapshot });
|
|
77
78
|
}
|
|
78
79
|
}
|