@pubflow/react 0.4.7 → 0.4.9

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.
@@ -5,24 +5,27 @@
5
5
  * For the LOGIN-TIME 2FA flow use useAuth() which surfaces
6
6
  * twoFactorPending / verifyTwoFactor / startTwoFactor.
7
7
  */
8
- import type { TwoFactorMethod, TwoFactorSetupResult, TwoFactorToggleResult } from '@pubflow/core';
8
+ import type { TwoFactorMethod, TwoFactorSetupResult, TwoFactorToggleResult, TwoFactorVerifyResult } from '@pubflow/core';
9
9
  export interface UseTwoFactorResult {
10
10
  /** Whether the 2FA system is globally enabled on this server */
11
11
  systemEnabled: boolean;
12
12
  /** Available methods on the server (e.g. ['email']) */
13
13
  availableMethods: string[];
14
- /** User's configured 2FA methods */
14
+ /** User's configured 2FA methods (status = active only) */
15
15
  methods: TwoFactorMethod[];
16
16
  isLoading: boolean;
17
17
  error: string | null;
18
18
  /** Load system info and user methods */
19
19
  refresh: () => Promise<void>;
20
20
  /**
21
- * Set up a new 2FA method.
22
- * @param method e.g. 'email'
23
- * @param identifier email address or phone number
21
+ * Step 1 of setup: register method + send verification code.
22
+ * Returns { success, method_id, status: 'pending_setup', ... }
24
23
  */
25
24
  setup: (method: string, identifier: string) => Promise<TwoFactorSetupResult>;
25
+ /**
26
+ * Step 2 of setup: confirm the code received → activates the method.
27
+ */
28
+ confirmSetup: (methodId: string, method: string, code: string) => Promise<TwoFactorVerifyResult>;
26
29
  /**
27
30
  * Enable or disable 2FA for the user.
28
31
  * When disabling with existing methods a verification code is required.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pubflow/react",
3
- "version": "0.4.7",
3
+ "version": "0.4.9",
4
4
  "description": "React adapter for Pubflow framework with support for TanStack Router and SWR - Now with snake_case support",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.esm.js",
@@ -33,7 +33,7 @@
33
33
  "author": "Pubflow, Inc.",
34
34
  "license": "AGPL-3.0-or-later",
35
35
  "dependencies": {
36
- "@pubflow/core": "^0.4.2",
36
+ "@pubflow/core": "^0.4.3",
37
37
  "@hookform/resolvers": "^3.3.2",
38
38
  "react-hook-form": "^7.48.2",
39
39
  "swr": "^2.2.4"