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.js
CHANGED
|
@@ -167,7 +167,8 @@ async function startPasskeyRegistrationAPI(basePath) {
|
|
|
167
167
|
method: "POST",
|
|
168
168
|
headers: {
|
|
169
169
|
"Content-Type": "application/json",
|
|
170
|
-
"X-CSRF-Token": getCsrfToken()
|
|
170
|
+
"X-CSRF-Token": getCsrfToken(),
|
|
171
|
+
"X-Client-Origin": window.location.origin
|
|
171
172
|
},
|
|
172
173
|
credentials: "include"
|
|
173
174
|
});
|
|
@@ -179,7 +180,8 @@ async function finishPasskeyRegistrationAPI(basePath, body) {
|
|
|
179
180
|
method: "POST",
|
|
180
181
|
headers: {
|
|
181
182
|
"Content-Type": "application/json",
|
|
182
|
-
"X-CSRF-Token": getCsrfToken()
|
|
183
|
+
"X-CSRF-Token": getCsrfToken(),
|
|
184
|
+
"X-Client-Origin": window.location.origin
|
|
183
185
|
},
|
|
184
186
|
credentials: "include",
|
|
185
187
|
body: JSON.stringify(body)
|
|
@@ -191,7 +193,8 @@ async function startPasskeyAuthAPI(basePath) {
|
|
|
191
193
|
const response = await fetch(`${basePath}/passkey/auth-start`, {
|
|
192
194
|
method: "POST",
|
|
193
195
|
headers: {
|
|
194
|
-
"Content-Type": "application/json"
|
|
196
|
+
"Content-Type": "application/json",
|
|
197
|
+
"X-Client-Origin": window.location.origin
|
|
195
198
|
},
|
|
196
199
|
credentials: "include"
|
|
197
200
|
});
|
|
@@ -202,7 +205,8 @@ async function finishPasskeyAuthAPI(basePath, body) {
|
|
|
202
205
|
const response = await fetch(`${basePath}/passkey/auth-finish`, {
|
|
203
206
|
method: "POST",
|
|
204
207
|
headers: {
|
|
205
|
-
"Content-Type": "application/json"
|
|
208
|
+
"Content-Type": "application/json",
|
|
209
|
+
"X-Client-Origin": window.location.origin
|
|
206
210
|
},
|
|
207
211
|
credentials: "include",
|
|
208
212
|
body: JSON.stringify(body)
|
|
@@ -258,7 +262,7 @@ function bufferToBase64url(buffer) {
|
|
|
258
262
|
async function createPasskeyCredential(options) {
|
|
259
263
|
const publicKey = {
|
|
260
264
|
...options,
|
|
261
|
-
rp:
|
|
265
|
+
rp: options.rp,
|
|
262
266
|
challenge: base64urlToBuffer(options.challenge),
|
|
263
267
|
user: {
|
|
264
268
|
...options.user,
|
|
@@ -304,7 +308,7 @@ async function getPasskeyCredential(options) {
|
|
|
304
308
|
const publicKey = {
|
|
305
309
|
challenge: base64urlToBuffer(options.challenge),
|
|
306
310
|
timeout: options.timeout,
|
|
307
|
-
rpId:
|
|
311
|
+
rpId: options.rpId,
|
|
308
312
|
userVerification: options.userVerification || "preferred",
|
|
309
313
|
allowCredentials: (options.allowCredentials || []).map(
|
|
310
314
|
(c) => ({
|
|
@@ -2220,10 +2224,7 @@ var DauthProvider = (props) => {
|
|
|
2220
2224
|
}
|
|
2221
2225
|
};
|
|
2222
2226
|
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
2223
|
-
return () => document.removeEventListener(
|
|
2224
|
-
"visibilitychange",
|
|
2225
|
-
handleVisibilityChange
|
|
2226
|
-
);
|
|
2227
|
+
return () => document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
2227
2228
|
}, [ctx, dauthState.isAuthenticated, dauthState.isLoading]);
|
|
2228
2229
|
const loginWithRedirect = (0, import_react2.useCallback)(() => {
|
|
2229
2230
|
const base = `${getClientBasePath()}/${domainName}/${routes.signin}`;
|