@adminforth/two-factors-auth 4.4.3 → 4.4.4

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.
@@ -10,11 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { convertPeriodToSeconds } from "adminforth";
11
11
  import { generateRegistrationOptions, verifyRegistrationResponse, generateAuthenticationOptions, verifyAuthenticationResponse } from '@simplewebauthn/server';
12
12
  import { isoUint8Array, isoBase64URL } from '@simplewebauthn/server/helpers';
13
- import aaguids from '../custom/aaguid.json';
13
+ import { readFileSync } from 'node:fs';
14
+ import path from 'node:path';
15
+ import { fileURLToPath } from 'node:url';
14
16
  import { PasskeyRepository } from "../repositories/passkeyRepository.js";
15
17
  import { UserRepository } from "../repositories/userRepository.js";
16
18
  import { CookieService } from "./cookieService.js";
17
19
  import { errorMessage, errorResult, prefixedErrorResult } from "../utils/errors.js";
20
+ const aaguids = JSON.parse(readFileSync(path.join(path.dirname(fileURLToPath(import.meta.url)), '../custom/aaguid.json'), 'utf-8'));
18
21
  export class PasskeyService {
19
22
  constructor(options, adminforth, userRepository = new UserRepository(adminforth, options), passkeyRepository = new PasskeyRepository(adminforth, options), cookieService = new CookieService(adminforth, options)) {
20
23
  this.options = options;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/two-factors-auth",
3
- "version": "4.4.3",
3
+ "version": "4.4.4",
4
4
  "description": "AdminForth plugin for two factors authentication",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -7,7 +7,9 @@ import {
7
7
  verifyAuthenticationResponse
8
8
  } from '@simplewebauthn/server';
9
9
  import { isoUint8Array, isoBase64URL } from '@simplewebauthn/server/helpers';
10
- import aaguids from '../custom/aaguid.json';
10
+ import { readFileSync } from 'node:fs';
11
+ import path from 'node:path';
12
+ import { fileURLToPath } from 'node:url';
11
13
  import type { PluginOptions } from "../types.js";
12
14
  import { PasskeyRepository } from "../repositories/passkeyRepository.js";
13
15
  import { UserRepository } from "../repositories/userRepository.js";
@@ -15,6 +17,19 @@ import { CookieService } from "./cookieService.js";
15
17
  import { errorMessage, errorResult, prefixedErrorResult } from "../utils/errors.js";
16
18
  import type { CookieList } from "../utils/types.js";
17
19
 
20
+ type AaguidEntry = {
21
+ name: string;
22
+ icon_light?: string;
23
+ icon_dark?: string;
24
+ };
25
+
26
+ const aaguids: Record<string, AaguidEntry> = JSON.parse(
27
+ readFileSync(
28
+ path.join(path.dirname(fileURLToPath(import.meta.url)), '../custom/aaguid.json'),
29
+ 'utf-8'
30
+ )
31
+ );
32
+
18
33
  type PasskeyAuthenticationPayload = {
19
34
  response: string;
20
35
  origin: string;