@adminforth/two-factors-auth 7.4.1 → 7.4.2

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.
@@ -29,5 +29,5 @@ export declare const renamePasskeyBodySchema: z.ZodObject<{
29
29
  }, z.core.$strict>;
30
30
  export declare const resolveVerifyAutoBodySchema: z.ZodObject<{
31
31
  sessionsIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
32
- confirmationResult: z.ZodRecord<z.ZodString, z.ZodAny>;
32
+ confirmationResult: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
33
33
  }, z.core.$strict>;
@@ -31,5 +31,6 @@ export const renamePasskeyBodySchema = z.object({
31
31
  }).strict();
32
32
  export const resolveVerifyAutoBodySchema = z.object({
33
33
  sessionsIds: z.array(z.string()).nullish(),
34
- confirmationResult: z.record(z.string(), z.any()),
34
+ // missing on Cancel in TwoFAModal; the handler then resolves the waiting sessions as cancelled
35
+ confirmationResult: z.record(z.string(), z.any()).nullish(),
35
36
  }).strict();
@@ -39,5 +39,6 @@ export const renamePasskeyBodySchema = z.object({
39
39
 
40
40
  export const resolveVerifyAutoBodySchema = z.object({
41
41
  sessionsIds: z.array(z.string()).nullish(),
42
- confirmationResult: z.record(z.string(), z.any()),
42
+ // missing on Cancel in TwoFAModal; the handler then resolves the waiting sessions as cancelled
43
+ confirmationResult: z.record(z.string(), z.any()).nullish(),
43
44
  }).strict();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/two-factors-auth",
3
- "version": "7.4.1",
3
+ "version": "7.4.2",
4
4
  "description": "AdminForth plugin for two factors authentication",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,9 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { resolveVerifyAutoBodySchema } from '../dist/endpoints/validation.js';
4
+
5
+ test('resolveVerifyAuto accepts a cancelled confirmation, so the handler can release the waiting request', () => {
6
+ // TwoFAModal sends confirmationResult: undefined on Cancel, JSON drops it
7
+ const cancelBody = JSON.parse(JSON.stringify({ confirmationResult: undefined, sessionsIds: ['session'] }));
8
+ assert.equal(resolveVerifyAutoBodySchema.safeParse(cancelBody).success, true);
9
+ });