dauth-context-react 6.6.3 → 6.8.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/package.json CHANGED
@@ -1,21 +1,13 @@
1
1
  {
2
2
  "name": "dauth-context-react",
3
- "version": "6.6.3",
3
+ "version": "6.8.0",
4
4
  "description": "React provider and hook for passwordless authentication via the Dauth service (BFF pattern with httpOnly cookies)",
5
5
  "license": "MIT",
6
6
  "author": "David T. Pizarro Frick",
7
7
  "keywords": [
8
8
  "react",
9
- "authentication",
10
- "passwordless",
11
- "magic-link",
12
- "passkey",
13
- "webauthn",
14
- "multi-tenant",
15
9
  "context",
16
- "provider",
17
- "hook",
18
- "dauth"
10
+ "authentication"
19
11
  ],
20
12
  "main": "dist/index.js",
21
13
  "module": "dist/index.mjs",
@@ -66,25 +58,20 @@
66
58
  }
67
59
  ],
68
60
  "devDependencies": {
69
- "@size-limit/preset-small-lib": "^12.0.0",
70
- "@testing-library/jest-dom": "~6.9.0",
71
- "@testing-library/react": "~16.3.0",
72
- "@types/react": "^19.0.0",
73
- "@types/react-dom": "^19.0.0",
74
- "@vitest/coverage-v8": "^4.0.18",
75
- "husky": "^9.0.10",
76
- "jsdom": "~28.1.0",
61
+ "@size-limit/preset-small-lib": "^12.0.1",
62
+ "@testing-library/jest-dom": "~6.9.1",
63
+ "@testing-library/react": "~16.3.2",
64
+ "@types/react": "^19.2.14",
65
+ "@types/react-dom": "^19.2.3",
66
+ "@vitest/coverage-v8": "^4.1.0",
67
+ "husky": "^9.1.7",
68
+ "jsdom": "~29.0.0",
77
69
  "prettier": "^3.8.1",
78
- "react": "^19.0.0",
79
- "react-dom": "^19.0.0",
80
- "size-limit": "^12.0.0",
81
- "tsup": "~8.5.0",
70
+ "react": "^19.2.4",
71
+ "react-dom": "^19.2.4",
72
+ "size-limit": "^12.0.1",
73
+ "tsup": "~8.5.1",
82
74
  "typescript": "~5.9.3",
83
- "vitest": "~4.0.0"
84
- },
85
- "keywords": [
86
- "react",
87
- "context",
88
- "authentication"
89
- ]
75
+ "vitest": "~4.1.0"
76
+ }
90
77
  }
@@ -113,6 +113,7 @@ export async function startPasskeyRegistrationAPI(
113
113
  headers: {
114
114
  'Content-Type': 'application/json',
115
115
  'X-CSRF-Token': getCsrfToken(),
116
+ 'X-Client-Origin': window.location.origin,
116
117
  },
117
118
  credentials: 'include',
118
119
  });
@@ -129,6 +130,7 @@ export async function finishPasskeyRegistrationAPI(
129
130
  headers: {
130
131
  'Content-Type': 'application/json',
131
132
  'X-CSRF-Token': getCsrfToken(),
133
+ 'X-Client-Origin': window.location.origin,
132
134
  },
133
135
  credentials: 'include',
134
136
  body: JSON.stringify(body),
@@ -144,6 +146,7 @@ export async function startPasskeyAuthAPI(
144
146
  method: 'POST',
145
147
  headers: {
146
148
  'Content-Type': 'application/json',
149
+ 'X-Client-Origin': window.location.origin,
147
150
  },
148
151
  credentials: 'include',
149
152
  });
@@ -159,6 +162,7 @@ export async function finishPasskeyAuthAPI(
159
162
  method: 'POST',
160
163
  headers: {
161
164
  'Content-Type': 'application/json',
165
+ 'X-Client-Origin': window.location.origin,
162
166
  },
163
167
  credentials: 'include',
164
168
  body: JSON.stringify(body),
package/src/index.tsx CHANGED
@@ -92,10 +92,7 @@ export const DauthProvider: React.FC<IDauthProviderProps> = (
92
92
  };
93
93
  document.addEventListener('visibilitychange', handleVisibilityChange);
94
94
  return () =>
95
- document.removeEventListener(
96
- 'visibilitychange',
97
- handleVisibilityChange
98
- );
95
+ document.removeEventListener('visibilitychange', handleVisibilityChange);
99
96
  }, [ctx, dauthState.isAuthenticated, dauthState.isLoading]);
100
97
 
101
98
  const loginWithRedirect = useCallback(() => {
package/src/webauthn.ts CHANGED
@@ -38,7 +38,7 @@ export async function createPasskeyCredential(
38
38
  ): Promise<Record<string, any>> {
39
39
  const publicKey = {
40
40
  ...options,
41
- rp: { ...options.rp, id: window.location.hostname },
41
+ rp: options.rp,
42
42
  challenge: base64urlToBuffer(options.challenge),
43
43
  user: {
44
44
  ...options.user,
@@ -105,7 +105,7 @@ export async function getPasskeyCredential(
105
105
  const publicKey: PublicKeyCredentialRequestOptions = {
106
106
  challenge: base64urlToBuffer(options.challenge),
107
107
  timeout: options.timeout,
108
- rpId: window.location.hostname,
108
+ rpId: options.rpId,
109
109
  userVerification: options.userVerification || 'preferred',
110
110
  allowCredentials: (options.allowCredentials || []).map(
111
111
  (c: { id: string; type: string; transports?: string[] }) => ({