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/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -29
- package/src/api/dauth.api.ts +4 -0
- package/src/index.tsx +1 -4
- package/src/webauthn.ts +2 -2
package/dist/index.mjs
CHANGED
|
@@ -148,7 +148,8 @@ async function startPasskeyRegistrationAPI(basePath) {
|
|
|
148
148
|
method: "POST",
|
|
149
149
|
headers: {
|
|
150
150
|
"Content-Type": "application/json",
|
|
151
|
-
"X-CSRF-Token": getCsrfToken()
|
|
151
|
+
"X-CSRF-Token": getCsrfToken(),
|
|
152
|
+
"X-Client-Origin": window.location.origin
|
|
152
153
|
},
|
|
153
154
|
credentials: "include"
|
|
154
155
|
});
|
|
@@ -160,7 +161,8 @@ async function finishPasskeyRegistrationAPI(basePath, body) {
|
|
|
160
161
|
method: "POST",
|
|
161
162
|
headers: {
|
|
162
163
|
"Content-Type": "application/json",
|
|
163
|
-
"X-CSRF-Token": getCsrfToken()
|
|
164
|
+
"X-CSRF-Token": getCsrfToken(),
|
|
165
|
+
"X-Client-Origin": window.location.origin
|
|
164
166
|
},
|
|
165
167
|
credentials: "include",
|
|
166
168
|
body: JSON.stringify(body)
|
|
@@ -172,7 +174,8 @@ async function startPasskeyAuthAPI(basePath) {
|
|
|
172
174
|
const response = await fetch(`${basePath}/passkey/auth-start`, {
|
|
173
175
|
method: "POST",
|
|
174
176
|
headers: {
|
|
175
|
-
"Content-Type": "application/json"
|
|
177
|
+
"Content-Type": "application/json",
|
|
178
|
+
"X-Client-Origin": window.location.origin
|
|
176
179
|
},
|
|
177
180
|
credentials: "include"
|
|
178
181
|
});
|
|
@@ -183,7 +186,8 @@ async function finishPasskeyAuthAPI(basePath, body) {
|
|
|
183
186
|
const response = await fetch(`${basePath}/passkey/auth-finish`, {
|
|
184
187
|
method: "POST",
|
|
185
188
|
headers: {
|
|
186
|
-
"Content-Type": "application/json"
|
|
189
|
+
"Content-Type": "application/json",
|
|
190
|
+
"X-Client-Origin": window.location.origin
|
|
187
191
|
},
|
|
188
192
|
credentials: "include",
|
|
189
193
|
body: JSON.stringify(body)
|
|
@@ -239,7 +243,7 @@ function bufferToBase64url(buffer) {
|
|
|
239
243
|
async function createPasskeyCredential(options) {
|
|
240
244
|
const publicKey = {
|
|
241
245
|
...options,
|
|
242
|
-
rp:
|
|
246
|
+
rp: options.rp,
|
|
243
247
|
challenge: base64urlToBuffer(options.challenge),
|
|
244
248
|
user: {
|
|
245
249
|
...options.user,
|
|
@@ -285,7 +289,7 @@ async function getPasskeyCredential(options) {
|
|
|
285
289
|
const publicKey = {
|
|
286
290
|
challenge: base64urlToBuffer(options.challenge),
|
|
287
291
|
timeout: options.timeout,
|
|
288
|
-
rpId:
|
|
292
|
+
rpId: options.rpId,
|
|
289
293
|
userVerification: options.userVerification || "preferred",
|
|
290
294
|
allowCredentials: (options.allowCredentials || []).map(
|
|
291
295
|
(c) => ({
|
|
@@ -2207,10 +2211,7 @@ var DauthProvider = (props) => {
|
|
|
2207
2211
|
}
|
|
2208
2212
|
};
|
|
2209
2213
|
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
2210
|
-
return () => document.removeEventListener(
|
|
2211
|
-
"visibilitychange",
|
|
2212
|
-
handleVisibilityChange
|
|
2213
|
-
);
|
|
2214
|
+
return () => document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
2214
2215
|
}, [ctx, dauthState.isAuthenticated, dauthState.isLoading]);
|
|
2215
2216
|
const loginWithRedirect = useCallback2(() => {
|
|
2216
2217
|
const base = `${getClientBasePath()}/${domainName}/${routes.signin}`;
|