@volr/react 0.1.64 → 0.1.66
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.cjs +34 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +34 -11
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -9487,7 +9487,6 @@ function useSessionSync({
|
|
|
9487
9487
|
|
|
9488
9488
|
// src/config/webauthn.ts
|
|
9489
9489
|
var AUTHENTICATOR_SELECTION = {
|
|
9490
|
-
authenticatorAttachment: "platform",
|
|
9491
9490
|
userVerification: "required",
|
|
9492
9491
|
residentKey: "required"
|
|
9493
9492
|
};
|
|
@@ -18894,6 +18893,30 @@ function useDepositListener(input) {
|
|
|
18894
18893
|
}, [getRpcUrl, input.chainId, input.address, JSON.stringify(input.asset)]);
|
|
18895
18894
|
return status;
|
|
18896
18895
|
}
|
|
18896
|
+
function detectPlatform() {
|
|
18897
|
+
if (typeof navigator === "undefined") return "Unknown";
|
|
18898
|
+
const ua = navigator.userAgent;
|
|
18899
|
+
const platform = navigator.platform || "";
|
|
18900
|
+
if (/iPhone|iPad|iPod/.test(ua) || platform === "MacIntel" && navigator.maxTouchPoints > 1) {
|
|
18901
|
+
return "iOS";
|
|
18902
|
+
}
|
|
18903
|
+
if (/Android/.test(ua)) {
|
|
18904
|
+
return "Android";
|
|
18905
|
+
}
|
|
18906
|
+
if (/Mac/.test(platform)) {
|
|
18907
|
+
return "macOS";
|
|
18908
|
+
}
|
|
18909
|
+
if (/Win/.test(platform)) {
|
|
18910
|
+
return "Windows";
|
|
18911
|
+
}
|
|
18912
|
+
if (/CrOS/.test(ua)) {
|
|
18913
|
+
return "ChromeOS";
|
|
18914
|
+
}
|
|
18915
|
+
if (/Linux/.test(platform)) {
|
|
18916
|
+
return "Linux";
|
|
18917
|
+
}
|
|
18918
|
+
return "Unknown";
|
|
18919
|
+
}
|
|
18897
18920
|
async function enrollPasskey(params) {
|
|
18898
18921
|
const {
|
|
18899
18922
|
client,
|
|
@@ -18901,6 +18924,7 @@ async function enrollPasskey(params) {
|
|
|
18901
18924
|
apiKey,
|
|
18902
18925
|
userId,
|
|
18903
18926
|
userEmail,
|
|
18927
|
+
userEvmAddress,
|
|
18904
18928
|
projectId,
|
|
18905
18929
|
rpId = typeof window !== "undefined" ? window.location.hostname : "localhost",
|
|
18906
18930
|
rpName = "Volr"
|
|
@@ -18908,9 +18932,6 @@ async function enrollPasskey(params) {
|
|
|
18908
18932
|
if (!userId) {
|
|
18909
18933
|
throw new Error("userId is required");
|
|
18910
18934
|
}
|
|
18911
|
-
if (!userEmail) {
|
|
18912
|
-
throw new Error("userEmail is required");
|
|
18913
|
-
}
|
|
18914
18935
|
if (!projectId) {
|
|
18915
18936
|
throw new Error("projectId is required");
|
|
18916
18937
|
}
|
|
@@ -18934,6 +18955,7 @@ async function enrollPasskey(params) {
|
|
|
18934
18955
|
credentialId: tempCredentialId
|
|
18935
18956
|
};
|
|
18936
18957
|
const prfSalt = sdkCore.deriveWrapKey(tempPrfInput);
|
|
18958
|
+
const displayName = userEmail || userEvmAddress || userId;
|
|
18937
18959
|
const publicKeyCredentialCreationOptions = {
|
|
18938
18960
|
challenge: challenge2,
|
|
18939
18961
|
rp: {
|
|
@@ -18942,8 +18964,8 @@ async function enrollPasskey(params) {
|
|
|
18942
18964
|
},
|
|
18943
18965
|
user: {
|
|
18944
18966
|
id: userHandle,
|
|
18945
|
-
name:
|
|
18946
|
-
displayName
|
|
18967
|
+
name: displayName,
|
|
18968
|
+
displayName
|
|
18947
18969
|
},
|
|
18948
18970
|
pubKeyCredParams: PUBKEY_CRED_PARAMS,
|
|
18949
18971
|
authenticatorSelection: AUTHENTICATOR_SELECTION,
|
|
@@ -19014,6 +19036,7 @@ async function enrollPasskey(params) {
|
|
|
19014
19036
|
}
|
|
19015
19037
|
const keypair = sdkCore.deriveEvmKey({ masterSeed: masterSeedHandle.bytes });
|
|
19016
19038
|
const address = keypair.address;
|
|
19039
|
+
const platform = detectPlatform();
|
|
19017
19040
|
const registerResponse = await client.post("/wallet/provider/register", {
|
|
19018
19041
|
keyStorageType: "passkey",
|
|
19019
19042
|
credentialId,
|
|
@@ -19023,7 +19046,9 @@ async function enrollPasskey(params) {
|
|
|
19023
19046
|
projectId,
|
|
19024
19047
|
credentialId
|
|
19025
19048
|
},
|
|
19026
|
-
address
|
|
19049
|
+
address,
|
|
19050
|
+
platform
|
|
19051
|
+
// For UX hints when authenticating on different devices
|
|
19027
19052
|
});
|
|
19028
19053
|
return {
|
|
19029
19054
|
credentialId,
|
|
@@ -19059,9 +19084,6 @@ function usePasskeyEnrollment() {
|
|
|
19059
19084
|
if (!user?.id) {
|
|
19060
19085
|
throw new Error("User ID is required for passkey enrollment");
|
|
19061
19086
|
}
|
|
19062
|
-
if (!user?.email) {
|
|
19063
|
-
throw new Error("User email is required for passkey enrollment");
|
|
19064
|
-
}
|
|
19065
19087
|
const accessToken = client.getAccessToken();
|
|
19066
19088
|
if (!accessToken) {
|
|
19067
19089
|
throw new Error(
|
|
@@ -19075,7 +19097,8 @@ function usePasskeyEnrollment() {
|
|
|
19075
19097
|
baseUrl: apiBaseUrl,
|
|
19076
19098
|
apiKey: config.projectApiKey,
|
|
19077
19099
|
userId: user.id,
|
|
19078
|
-
userEmail: user.email,
|
|
19100
|
+
userEmail: user.email ?? null,
|
|
19101
|
+
userEvmAddress: user.evmAddress ?? null,
|
|
19079
19102
|
projectId
|
|
19080
19103
|
});
|
|
19081
19104
|
setStep("registering");
|