@adminforth/two-factors-auth 2.1.4 → 2.2.0
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/build.log +3 -2
- package/custom/TwoFactorsConfirmation.vue +14 -16
- package/custom/TwoFactorsPasskeysSettings.vue +9 -15
- package/custom/aaguid.json +170 -0
- package/custom/utils.js +11 -1
- package/dist/custom/TwoFactorsConfirmation.vue +14 -16
- package/dist/custom/TwoFactorsPasskeysSettings.vue +9 -15
- package/dist/custom/aaguid.json +170 -0
- package/dist/custom/utils.js +11 -1
- package/dist/index.js +8 -4
- package/index.ts +5 -2
- package/package.json +1 -1
- package/tsconfig.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { AdminForthPlugin, Filters, suggestIfTypo } from "adminforth";
|
|
|
11
11
|
import twofactor from 'node-2fa';
|
|
12
12
|
import { generateRegistrationOptions, verifyRegistrationResponse, generateAuthenticationOptions, verifyAuthenticationResponse } from '@simplewebauthn/server';
|
|
13
13
|
import { isoUint8Array, isoBase64URL } from '@simplewebauthn/server/helpers';
|
|
14
|
+
import aaguids from './custom/aaguid.json';
|
|
14
15
|
export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
15
16
|
constructor(options) {
|
|
16
17
|
super(options, import.meta.url);
|
|
@@ -483,7 +484,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
483
484
|
path: `/plugin/passkeys/finishRegisteringPasskey`,
|
|
484
485
|
noAuth: false,
|
|
485
486
|
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser, cookies }) {
|
|
486
|
-
var _b, _c, _d, _e, _f;
|
|
487
|
+
var _b, _c, _d, _e, _f, _g;
|
|
487
488
|
const passkeysCookies = this.adminforth.auth.getCustomCookie({ cookies: cookies, name: "registerPasskeyTemporaryJWT" });
|
|
488
489
|
if (!passkeysCookies) {
|
|
489
490
|
return { error: 'Passkey token is required' };
|
|
@@ -515,6 +516,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
515
516
|
throw new Error('Verification failed.');
|
|
516
517
|
}
|
|
517
518
|
const { aaguid, credential, credentialBackedUp } = registrationInfo;
|
|
519
|
+
const provider_name = ((_g = aaguids[aaguid]) === null || _g === void 0 ? void 0 : _g.name) || 'Unknown';
|
|
518
520
|
const credentialPublicKey = credential.publicKey;
|
|
519
521
|
const credentialID = credential.id;
|
|
520
522
|
const base64CredentialID = credentialID;
|
|
@@ -536,7 +538,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
536
538
|
created_at: new Date().toISOString(),
|
|
537
539
|
last_used_at: new Date().toISOString(),
|
|
538
540
|
aaguid: aaguid,
|
|
539
|
-
name:
|
|
541
|
+
name: provider_name,
|
|
540
542
|
}),
|
|
541
543
|
},
|
|
542
544
|
adminUser: adminUser
|
|
@@ -574,7 +576,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
574
576
|
path: `/plugin/passkeys/getPasskeys`,
|
|
575
577
|
noAuth: false,
|
|
576
578
|
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ adminUser }) {
|
|
577
|
-
var _b;
|
|
579
|
+
var _b, _c, _d;
|
|
578
580
|
let passkeys;
|
|
579
581
|
try {
|
|
580
582
|
passkeys = yield this.adminforth.resource(this.options.passkeys.credentialResourceID).list([Filters.EQ(this.options.passkeys.credentialUserIdFieldName, adminUser.pk)]);
|
|
@@ -587,12 +589,14 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
587
589
|
const parsedKey = JSON.parse(pk[this.options.passkeys.credentialMetaFieldName]);
|
|
588
590
|
dataToReturn.push({
|
|
589
591
|
name: parsedKey.name,
|
|
592
|
+
light_icon: ((_b = aaguids[parsedKey.aaguid]) === null || _b === void 0 ? void 0 : _b.icon_light) || null,
|
|
593
|
+
dark_icon: ((_c = aaguids[parsedKey.aaguid]) === null || _c === void 0 ? void 0 : _c.icon_dark) || null,
|
|
590
594
|
created_at: parsedKey.created_at,
|
|
591
595
|
last_used_at: parsedKey.last_used_at,
|
|
592
596
|
id: pk[this.options.passkeys.credentialIdFieldName],
|
|
593
597
|
});
|
|
594
598
|
}
|
|
595
|
-
return { ok: true, data: dataToReturn, authenticatorAttachment: ((
|
|
599
|
+
return { ok: true, data: dataToReturn, authenticatorAttachment: ((_d = this.options.passkeys) === null || _d === void 0 ? void 0 : _d.settings.authenticatorSelection.authenticatorAttachment) || 'both' };
|
|
596
600
|
})
|
|
597
601
|
});
|
|
598
602
|
server.endpoint({
|
package/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
verifyAuthenticationResponse
|
|
10
10
|
} from '@simplewebauthn/server';
|
|
11
11
|
import { isoUint8Array, isoBase64URL } from '@simplewebauthn/server/helpers';
|
|
12
|
+
import aaguids from './custom/aaguid.json';
|
|
12
13
|
|
|
13
14
|
export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
14
15
|
options: PluginOptions;
|
|
@@ -561,7 +562,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
561
562
|
credential,
|
|
562
563
|
credentialBackedUp
|
|
563
564
|
} = registrationInfo;
|
|
564
|
-
|
|
565
|
+
const provider_name = aaguids[aaguid]?.name || 'Unknown';
|
|
565
566
|
const credentialPublicKey = credential.publicKey;
|
|
566
567
|
const credentialID = credential.id;
|
|
567
568
|
|
|
@@ -585,7 +586,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
585
586
|
created_at : new Date().toISOString(),
|
|
586
587
|
last_used_at : new Date().toISOString(),
|
|
587
588
|
aaguid : aaguid,
|
|
588
|
-
name :
|
|
589
|
+
name : provider_name,
|
|
589
590
|
}),
|
|
590
591
|
},
|
|
591
592
|
adminUser: adminUser
|
|
@@ -631,6 +632,8 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
631
632
|
const parsedKey = JSON.parse(pk[this.options.passkeys.credentialMetaFieldName]);
|
|
632
633
|
dataToReturn.push({
|
|
633
634
|
name: parsedKey.name,
|
|
635
|
+
light_icon: aaguids[parsedKey.aaguid]?.icon_light || null,
|
|
636
|
+
dark_icon: aaguids[parsedKey.aaguid]?.icon_dark || null,
|
|
634
637
|
created_at: parsedKey.created_at,
|
|
635
638
|
last_used_at: parsedKey.last_used_at,
|
|
636
639
|
id: pk[this.options.passkeys.credentialIdFieldName],
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
-
|
|
5
4
|
/* Projects */
|
|
6
5
|
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
6
|
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
@@ -107,6 +106,7 @@
|
|
|
107
106
|
/* Completeness */
|
|
108
107
|
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
109
108
|
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
|
|
109
|
+
"resolveJsonModule": true,
|
|
110
110
|
},
|
|
111
111
|
"exclude": ["node_modules", "dist", "custom"], /* Exclude files from compilation. */
|
|
112
112
|
}
|