@adminforth/two-factors-auth 3.3.9 → 4.0.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.
Files changed (54) hide show
  1. package/build.log +2 -2
  2. package/custom/TwoFAModal.vue +4 -4
  3. package/custom/TwoFactorsConfirmation.vue +9 -10
  4. package/custom/TwoFactorsPasskeysSettings.vue +10 -10
  5. package/custom/utils.js +7 -8
  6. package/dist/custom/TwoFAModal.vue +4 -4
  7. package/dist/custom/TwoFactorsConfirmation.vue +9 -10
  8. package/dist/custom/TwoFactorsPasskeysSettings.vue +10 -10
  9. package/dist/custom/utils.js +7 -8
  10. package/dist/endpoints/registerPasskeyEndpoints.d.ts +2 -0
  11. package/dist/endpoints/registerPasskeyEndpoints.js +59 -0
  12. package/dist/endpoints/registerTwoFaEndpoints.d.ts +2 -0
  13. package/dist/endpoints/registerTwoFaEndpoints.js +46 -0
  14. package/dist/handlers/createPasskeyHandlers.d.ts +48 -0
  15. package/dist/handlers/createPasskeyHandlers.js +99 -0
  16. package/dist/handlers/createTwoFaHandlers.d.ts +56 -0
  17. package/dist/handlers/createTwoFaHandlers.js +167 -0
  18. package/dist/index.d.ts +37 -0
  19. package/dist/index.js +51 -858
  20. package/dist/repositories/passkeyRepository.d.ts +18 -0
  21. package/dist/repositories/passkeyRepository.js +89 -0
  22. package/dist/repositories/userRepository.d.ts +14 -0
  23. package/dist/repositories/userRepository.js +45 -0
  24. package/dist/services/cookieService.d.ts +52 -0
  25. package/dist/services/cookieService.js +144 -0
  26. package/dist/services/passkeyService.d.ts +84 -0
  27. package/dist/services/passkeyService.js +369 -0
  28. package/dist/services/totpService.d.ts +21 -0
  29. package/dist/services/totpService.js +43 -0
  30. package/dist/services/verifyMfaConfirmation.d.ts +30 -0
  31. package/dist/services/verifyMfaConfirmation.js +67 -0
  32. package/dist/types.d.ts +116 -0
  33. package/dist/utils/errors.d.ts +4 -0
  34. package/dist/utils/errors.js +9 -0
  35. package/dist/utils/parsePeriod.d.ts +1 -0
  36. package/dist/utils/parsePeriod.js +17 -0
  37. package/dist/utils/types.d.ts +13 -0
  38. package/dist/utils/types.js +1 -0
  39. package/endpoints/registerPasskeyEndpoints.ts +61 -0
  40. package/endpoints/registerTwoFaEndpoints.ts +45 -0
  41. package/handlers/createPasskeyHandlers.ts +103 -0
  42. package/handlers/createTwoFaHandlers.ts +172 -0
  43. package/index.ts +57 -886
  44. package/package.json +1 -1
  45. package/repositories/passkeyRepository.ts +78 -0
  46. package/repositories/userRepository.ts +42 -0
  47. package/services/cookieService.ts +165 -0
  48. package/services/passkeyService.ts +375 -0
  49. package/services/totpService.ts +37 -0
  50. package/services/verifyMfaConfirmation.ts +92 -0
  51. package/tsconfig.json +1 -1
  52. package/utils/errors.ts +13 -0
  53. package/utils/parsePeriod.ts +19 -0
  54. package/utils/types.ts +17 -0
@@ -0,0 +1,18 @@
1
+ import type { AdminForthResource, AdminUser, IAdminForth } from "adminforth";
2
+ import type { PluginOptions } from "../types.js";
3
+ import type { AnyRecord } from "../utils/types.js";
4
+ export declare class PasskeyRepository {
5
+ private readonly adminforth;
6
+ private readonly options;
7
+ constructor(adminforth: IAdminForth, options: PluginOptions);
8
+ getCredentialResource(): AdminForthResource;
9
+ getCredentialResourcePkField(): string;
10
+ getByCredentialId(credentialId: string): Promise<AnyRecord>;
11
+ getByCredentialIdAndUserId(credentialId: string, userId: string): Promise<AnyRecord>;
12
+ listByUserId(userId: string): Promise<AnyRecord[]>;
13
+ hasByUserId(userId: string): Promise<boolean>;
14
+ create(record: AnyRecord, adminUser: AdminUser): Promise<void>;
15
+ updateMeta(passkeyRecord: AnyRecord, meta: AnyRecord): Promise<void>;
16
+ update(passkeyRecord: AnyRecord, newRecord: AnyRecord, adminUser: AdminUser): Promise<void>;
17
+ delete(passkeyRecord: AnyRecord, adminUser: AdminUser): Promise<void>;
18
+ }
@@ -0,0 +1,89 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { Filters } from "adminforth";
11
+ export class PasskeyRepository {
12
+ constructor(adminforth, options) {
13
+ this.adminforth = adminforth;
14
+ this.options = options;
15
+ }
16
+ getCredentialResource() {
17
+ return this.adminforth.config.resources.find(r => r.resourceId === this.options.passkeys.credentialResourceID);
18
+ }
19
+ getCredentialResourcePkField() {
20
+ return this.getCredentialResource().columns.find(c => c.primaryKey).name;
21
+ }
22
+ getByCredentialId(credentialId) {
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ return this.adminforth.resource(this.options.passkeys.credentialResourceID).get([
25
+ Filters.EQ(this.options.passkeys.credentialIdFieldName, credentialId),
26
+ ]);
27
+ });
28
+ }
29
+ getByCredentialIdAndUserId(credentialId, userId) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ return this.adminforth.resource(this.options.passkeys.credentialResourceID).get([
32
+ Filters.EQ(this.options.passkeys.credentialIdFieldName, credentialId),
33
+ Filters.EQ(this.options.passkeys.credentialUserIdFieldName, userId),
34
+ ]);
35
+ });
36
+ }
37
+ listByUserId(userId) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ return this.adminforth.resource(this.options.passkeys.credentialResourceID).list([
40
+ Filters.EQ(this.options.passkeys.credentialUserIdFieldName, userId),
41
+ ]);
42
+ });
43
+ }
44
+ hasByUserId(userId) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ const passkeys = yield this.listByUserId(userId);
47
+ return passkeys && passkeys.length > 0;
48
+ });
49
+ }
50
+ create(record, adminUser) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ yield this.adminforth.createResourceRecord({
53
+ resource: this.getCredentialResource(),
54
+ record,
55
+ adminUser,
56
+ });
57
+ });
58
+ }
59
+ updateMeta(passkeyRecord, meta) {
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ yield this.adminforth
62
+ .resource(this.options.passkeys.credentialResourceID)
63
+ .update(passkeyRecord[this.getCredentialResourcePkField()], {
64
+ [this.options.passkeys.credentialMetaFieldName]: meta,
65
+ });
66
+ });
67
+ }
68
+ update(passkeyRecord, newRecord, adminUser) {
69
+ return __awaiter(this, void 0, void 0, function* () {
70
+ yield this.adminforth.updateResourceRecord({
71
+ resource: this.getCredentialResource(),
72
+ recordId: passkeyRecord[this.getCredentialResourcePkField()],
73
+ oldRecord: passkeyRecord,
74
+ record: newRecord,
75
+ adminUser,
76
+ });
77
+ });
78
+ }
79
+ delete(passkeyRecord, adminUser) {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ yield this.adminforth.deleteResourceRecord({
82
+ resource: this.getCredentialResource(),
83
+ recordId: passkeyRecord[this.getCredentialResourcePkField()],
84
+ record: passkeyRecord,
85
+ adminUser,
86
+ });
87
+ });
88
+ }
89
+ }
@@ -0,0 +1,14 @@
1
+ import type { AdminForthResource, AdminUser, IAdminForth } from "adminforth";
2
+ import type { PluginOptions } from "../types.js";
3
+ import type { AnyRecord } from "../utils/types.js";
4
+ export declare class UserRepository {
5
+ private readonly adminforth;
6
+ private readonly options;
7
+ constructor(adminforth: IAdminForth, options: PluginOptions);
8
+ getAuthResource(): AdminForthResource;
9
+ getUserPkField(): string;
10
+ getUserPk(adminUser: AdminUser): string;
11
+ getAuthUser(pk: string): Promise<AnyRecord>;
12
+ getSecret(user: AnyRecord): string;
13
+ updateSecret(pk: string, secret: string): Promise<void>;
14
+ }
@@ -0,0 +1,45 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ export class UserRepository {
11
+ constructor(adminforth, options) {
12
+ this.adminforth = adminforth;
13
+ this.options = options;
14
+ }
15
+ getAuthResource() {
16
+ return this.adminforth.config.resources.find(r => r.resourceId === this.adminforth.config.auth.usersResourceId);
17
+ }
18
+ getUserPkField() {
19
+ return this.getAuthResource().columns.find(c => c.primaryKey).name;
20
+ }
21
+ getUserPk(adminUser) {
22
+ return adminUser.dbUser[this.getUserPkField()];
23
+ }
24
+ getAuthUser(pk) {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ const authResource = this.getAuthResource();
27
+ const connector = this.adminforth.connectors[authResource.dataSource];
28
+ return connector.getRecordByPrimaryKey(authResource, pk);
29
+ });
30
+ }
31
+ getSecret(user) {
32
+ return user[this.options.twoFaSecretFieldName];
33
+ }
34
+ updateSecret(pk, secret) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ const authResource = this.getAuthResource();
37
+ const connector = this.adminforth.connectors[authResource.dataSource];
38
+ yield connector.updateRecord({
39
+ resource: authResource,
40
+ recordId: pk,
41
+ newValues: { [this.options.twoFaSecretFieldName]: secret },
42
+ });
43
+ });
44
+ }
45
+ }
@@ -0,0 +1,52 @@
1
+ import type { IAdminForth, IAdminForthHttpResponse } from "adminforth";
2
+ import type { PluginOptions } from "../types.js";
3
+ import type { CookieList, HttpHeaders } from "../utils/types.js";
4
+ export type TotpTemporaryPayload = {
5
+ userName: string;
6
+ issuer?: string;
7
+ pk: string;
8
+ newSecret?: string;
9
+ userCanSkipSetup?: boolean;
10
+ sessionDuration?: string;
11
+ };
12
+ export type PasskeyLoginTemporaryPayload = {
13
+ challenge: string;
14
+ };
15
+ export type RegisterPasskeyTemporaryPayload = {
16
+ challenge: string;
17
+ user_id: string;
18
+ };
19
+ export type MfaGracePayload = {
20
+ hash: string;
21
+ exp?: number;
22
+ };
23
+ export declare class CookieService {
24
+ private readonly adminforth;
25
+ private readonly options;
26
+ constructor(adminforth: IAdminForth, options: PluginOptions);
27
+ getAuthSessionCookie(cookies: CookieList): string | null;
28
+ setAuthCookie(opts: {
29
+ response: IAdminForthHttpResponse;
30
+ username: string;
31
+ pk: string;
32
+ expireInDuration: string;
33
+ }): void;
34
+ getTotpTemporary(cookies: CookieList): string | null;
35
+ verifyTotpTemporary(cookies: CookieList): Promise<TotpTemporaryPayload | null>;
36
+ setTotpTemporary(response: IAdminForthHttpResponse, payload: TotpTemporaryPayload): void;
37
+ removeTotpTemporary(response: IAdminForthHttpResponse): void;
38
+ getPasskeyLoginTemporary(cookies: CookieList): string | null;
39
+ verifyPasskeyLoginTemporary(cookies: CookieList): Promise<PasskeyLoginTemporaryPayload | null>;
40
+ setPasskeyLoginTemporary(response: IAdminForthHttpResponse, challenge: string): void;
41
+ getRegisterPasskeyTemporary(cookies: CookieList): string | null;
42
+ verifyRegisterPasskeyTemporary(cookies: CookieList): Promise<RegisterPasskeyTemporaryPayload | null>;
43
+ setRegisterPasskeyTemporary(response: IAdminForthHttpResponse, payload: RegisterPasskeyTemporaryPayload): void;
44
+ setMfaGrace(response: IAdminForthHttpResponse, hash: string): void;
45
+ verifyMfaGrace(cookies: CookieList): Promise<MfaGracePayload | null>;
46
+ private generateMfaGraceHash;
47
+ issueMfaGrace(opts: {
48
+ headers?: HttpHeaders;
49
+ response?: IAdminForthHttpResponse;
50
+ }, cookies: CookieList): void;
51
+ isMfaGraceValid(headers: HttpHeaders, cookies: CookieList, checkIfJWTAboutToExpire?: boolean): Promise<boolean>;
52
+ }
@@ -0,0 +1,144 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import crypto from 'crypto';
11
+ const TOTP_TEMP_COOKIE = "2FaTemporaryJWT";
12
+ const PASSKEY_LOGIN_TEMP_COOKIE = "passkeyLoginTemporaryJWT";
13
+ const REGISTER_PASSKEY_TEMP_COOKIE = "registerPasskeyTemporaryJWT";
14
+ const MFA_GRACE_COOKIE = "TempSkip2FA_Modal_JWT";
15
+ const AUTH_COOKIE = "jwt";
16
+ export class CookieService {
17
+ constructor(adminforth, options) {
18
+ this.adminforth = adminforth;
19
+ this.options = options;
20
+ }
21
+ getAuthSessionCookie(cookies) {
22
+ return this.adminforth.auth.getCustomCookie({ cookies, name: AUTH_COOKIE });
23
+ }
24
+ setAuthCookie(opts) {
25
+ this.adminforth.auth.setAuthCookie(opts);
26
+ }
27
+ getTotpTemporary(cookies) {
28
+ return this.adminforth.auth.getCustomCookie({ cookies, name: TOTP_TEMP_COOKIE });
29
+ }
30
+ verifyTotpTemporary(cookies) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ const jwt = this.getTotpTemporary(cookies);
33
+ if (!jwt)
34
+ return null;
35
+ return this.adminforth.auth.verify(jwt, 'temp2FA');
36
+ });
37
+ }
38
+ setTotpTemporary(response, payload) {
39
+ var _a;
40
+ const value = this.adminforth.auth.issueJWT(payload, 'temp2FA', ((_a = this.options.passkeys) === null || _a === void 0 ? void 0 : _a.challengeValidityPeriod) || '1m');
41
+ this.adminforth.auth.setCustomCookie({
42
+ response,
43
+ payload: { name: TOTP_TEMP_COOKIE, value, expiry: undefined, expirySeconds: 10 * 60, httpOnly: true },
44
+ });
45
+ }
46
+ removeTotpTemporary(response) {
47
+ this.adminforth.auth.removeCustomCookie({ response, name: TOTP_TEMP_COOKIE });
48
+ }
49
+ getPasskeyLoginTemporary(cookies) {
50
+ return this.adminforth.auth.getCustomCookie({ cookies, name: PASSKEY_LOGIN_TEMP_COOKIE });
51
+ }
52
+ verifyPasskeyLoginTemporary(cookies) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ const jwt = this.getPasskeyLoginTemporary(cookies);
55
+ if (!jwt)
56
+ return null;
57
+ return this.adminforth.auth.verify(jwt, 'tempLoginPasskeyChallenge', false);
58
+ });
59
+ }
60
+ setPasskeyLoginTemporary(response, challenge) {
61
+ var _a;
62
+ const value = this.adminforth.auth.issueJWT({ challenge }, 'tempLoginPasskeyChallenge', ((_a = this.options.passkeys) === null || _a === void 0 ? void 0 : _a.challengeValidityPeriod) || '1m');
63
+ this.adminforth.auth.setCustomCookie({
64
+ response,
65
+ payload: { name: PASSKEY_LOGIN_TEMP_COOKIE, value, expiry: undefined, expirySeconds: 10 * 60, httpOnly: true },
66
+ });
67
+ }
68
+ getRegisterPasskeyTemporary(cookies) {
69
+ return this.adminforth.auth.getCustomCookie({ cookies, name: REGISTER_PASSKEY_TEMP_COOKIE });
70
+ }
71
+ verifyRegisterPasskeyTemporary(cookies) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ const jwt = this.getRegisterPasskeyTemporary(cookies);
74
+ if (!jwt)
75
+ return null;
76
+ return this.adminforth.auth.verify(jwt, 'registerTempPasskeyChallenge', false);
77
+ });
78
+ }
79
+ setRegisterPasskeyTemporary(response, payload) {
80
+ var _a;
81
+ const value = this.adminforth.auth.issueJWT(payload, 'registerTempPasskeyChallenge', ((_a = this.options.passkeys) === null || _a === void 0 ? void 0 : _a.challengeValidityPeriod) || '1m');
82
+ this.adminforth.auth.setCustomCookie({
83
+ response,
84
+ payload: { name: REGISTER_PASSKEY_TEMP_COOKIE, value, expiry: undefined, expirySeconds: 10 * 60, httpOnly: true },
85
+ });
86
+ }
87
+ setMfaGrace(response, hash) {
88
+ const value = this.adminforth.auth.issueJWT({ hash }, 'MfaGrace', `${this.options.stepUpMfaGracePeriodSeconds}s`);
89
+ //TODO: fix ts-ignore after releasing new version of adminforth with updated types
90
+ //@ts-ignore
91
+ this.adminforth.auth.setCustomCookie({ response, payload: { name: MFA_GRACE_COOKIE, sessionBased: true, value, httpOnly: true } });
92
+ }
93
+ verifyMfaGrace(cookies) {
94
+ return __awaiter(this, void 0, void 0, function* () {
95
+ const jwt = this.adminforth.auth.getCustomCookie({ cookies, name: MFA_GRACE_COOKIE });
96
+ if (!jwt)
97
+ return null;
98
+ return this.adminforth.auth.verify(jwt, 'MfaGrace', false);
99
+ });
100
+ }
101
+ generateMfaGraceHash(headers, cookies) {
102
+ const ip = this.adminforth.auth.getClientIp(headers);
103
+ const userAgent = headers['user-agent'] || '';
104
+ const acceptLanguage = headers['accept-language'] || '';
105
+ const sessionCookie = this.getAuthSessionCookie(cookies);
106
+ if (!process.env.ADMINFORTH_SECRET || !ip || !userAgent || !acceptLanguage || !sessionCookie) {
107
+ console.error("❗️❗️❗️ Cannot set step-up MFA grace cookie: missing required request headers to identify client ❗️❗️❗️");
108
+ return null;
109
+ }
110
+ return crypto.createHmac('sha256', process.env.ADMINFORTH_SECRET)
111
+ .update(`${acceptLanguage}_${userAgent}_${ip}_${sessionCookie}`)
112
+ .digest('hex');
113
+ }
114
+ issueMfaGrace(opts, cookies) {
115
+ if (!opts.response) {
116
+ console.error("❗️❗️❗️ Cannot set step-up MFA grace cookie: response object is missing. You probably called verify() method without response parameter ❗️❗️❗️");
117
+ return;
118
+ }
119
+ if (!opts.headers) {
120
+ return;
121
+ }
122
+ const hash = this.generateMfaGraceHash(opts.headers, cookies);
123
+ if (hash) {
124
+ this.setMfaGrace(opts.response, hash);
125
+ }
126
+ }
127
+ isMfaGraceValid(headers_1, cookies_1) {
128
+ return __awaiter(this, arguments, void 0, function* (headers, cookies, checkIfJWTAboutToExpire = false) {
129
+ const hash = this.generateMfaGraceHash(headers, cookies);
130
+ if (!hash) {
131
+ return false;
132
+ }
133
+ const jwtVerificationResult = yield this.verifyMfaGrace(cookies);
134
+ if (!jwtVerificationResult) {
135
+ return false;
136
+ }
137
+ if (checkIfJWTAboutToExpire && jwtVerificationResult.exp && (jwtVerificationResult.exp - (Date.now() / 1000)) < 30) {
138
+ console.error("❗️❗️❗️ Cannot validate step-up MFA grace cookie: token is expired or about to expire ❗️❗️❗️");
139
+ return false;
140
+ }
141
+ return hash === jwtVerificationResult['hash'];
142
+ });
143
+ }
144
+ }
@@ -0,0 +1,84 @@
1
+ import type { AdminUser, IAdminForth, IAdminForthHttpResponse } from "adminforth";
2
+ import type { PluginOptions } from "../types.js";
3
+ import { PasskeyRepository } from "../repositories/passkeyRepository.js";
4
+ import { UserRepository } from "../repositories/userRepository.js";
5
+ import { CookieService } from "./cookieService.js";
6
+ import type { CookieList } from "../utils/types.js";
7
+ type PasskeyAuthenticationPayload = {
8
+ response: string;
9
+ origin: string;
10
+ };
11
+ type PasskeyRegistrationPayload = {
12
+ credential: string;
13
+ origin: string;
14
+ };
15
+ type PluginAuthenticatorAttachment = NonNullable<NonNullable<NonNullable<PluginOptions["passkeys"]>["settings"]["authenticatorSelection"]>["authenticatorAttachment"]>;
16
+ export declare class PasskeyService {
17
+ private readonly options;
18
+ private readonly adminforth;
19
+ private readonly userRepository;
20
+ private readonly passkeyRepository;
21
+ private readonly cookieService;
22
+ constructor(options: PluginOptions, adminforth: IAdminForth, userRepository?: UserRepository, passkeyRepository?: PasskeyRepository, cookieService?: CookieService);
23
+ private markChallengeAsUsed;
24
+ private isChallengeUnused;
25
+ validateLoginChallengeCookie(cookies: CookieList): Promise<{
26
+ ok: boolean;
27
+ decodedPasskeysCookies?: {
28
+ challenge: string;
29
+ };
30
+ error?: string;
31
+ }>;
32
+ verifyPasskeyResponse(body: PasskeyAuthenticationPayload, user_id: string, cookies: {
33
+ challenge: string;
34
+ }): Promise<import("../utils/types.js").ErrorResponse | {
35
+ ok: boolean;
36
+ passkeyConfirmed: boolean;
37
+ }>;
38
+ createRegistrationOptions(mode: PluginAuthenticatorAttachment, adminUser: AdminUser, response: IAdminForthHttpResponse): Promise<import("../utils/types.js").ErrorResponse | {
39
+ ok: boolean;
40
+ data: import("@simplewebauthn/server").PublicKeyCredentialCreationOptionsJSON;
41
+ }>;
42
+ finishRegistration(body: PasskeyRegistrationPayload, adminUser: AdminUser, cookies: CookieList): Promise<{
43
+ error: string;
44
+ ok?: undefined;
45
+ } | {
46
+ ok: boolean;
47
+ error?: undefined;
48
+ }>;
49
+ createLoginOptions(response: IAdminForthHttpResponse): Promise<{
50
+ ok: boolean;
51
+ data: import("@simplewebauthn/server").PublicKeyCredentialRequestOptionsJSON;
52
+ error?: undefined;
53
+ } | {
54
+ ok: boolean;
55
+ error: string;
56
+ data?: undefined;
57
+ }>;
58
+ getPasskeys(adminUser: AdminUser): Promise<import("../utils/types.js").ErrorResponse | {
59
+ ok: boolean;
60
+ data: any[];
61
+ authenticatorAttachment: "platform" | "cross-platform" | "both";
62
+ }>;
63
+ deletePasskey(credentialID: string, adminUser: AdminUser): Promise<import("../utils/types.js").ErrorResponse | {
64
+ ok: boolean;
65
+ }>;
66
+ renamePasskey(credentialID: string, newName: string, adminUser: AdminUser): Promise<import("../utils/types.js").ErrorResponse | {
67
+ ok: boolean;
68
+ }>;
69
+ checkIfUserHasPasskeys(cookies: CookieList): Promise<import("../utils/types.js").ErrorResponse | {
70
+ ok: boolean;
71
+ hasPasskeys: boolean;
72
+ }>;
73
+ hasPasskeysForUser(userId: string): Promise<boolean>;
74
+ getLoginUserByPasskeyResponse(passkeyResponse: PasskeyAuthenticationPayload, cookies: CookieList): Promise<{
75
+ error: string;
76
+ ok?: undefined;
77
+ user?: undefined;
78
+ } | {
79
+ ok: boolean;
80
+ user: import("../utils/types.js").AnyRecord;
81
+ error?: undefined;
82
+ }>;
83
+ }
84
+ export {};