@volr/react 0.1.130 → 0.1.131

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 CHANGED
@@ -9774,10 +9774,41 @@ function useSessionSync({
9774
9774
  }
9775
9775
 
9776
9776
  // src/config/webauthn.ts
9777
+ function isWindows() {
9778
+ if (typeof navigator === "undefined") return false;
9779
+ const platform = navigator.platform || "";
9780
+ return /Win/.test(platform);
9781
+ }
9782
+ function isLinux() {
9783
+ if (typeof navigator === "undefined") return false;
9784
+ const platform = navigator.platform || "";
9785
+ const ua = navigator.userAgent;
9786
+ return /Linux/.test(platform) && !/CrOS/.test(ua) && !/Android/.test(ua);
9787
+ }
9788
+ function shouldForceCrossDevice() {
9789
+ return isWindows() || isLinux();
9790
+ }
9777
9791
  var AUTHENTICATOR_SELECTION = {
9778
9792
  userVerification: "required",
9779
9793
  residentKey: "required"
9780
9794
  };
9795
+ var AUTHENTICATOR_SELECTION_CROSS_DEVICE = {
9796
+ userVerification: "required",
9797
+ residentKey: "required",
9798
+ authenticatorAttachment: "cross-platform"
9799
+ };
9800
+ function getAuthenticatorSelection() {
9801
+ if (shouldForceCrossDevice()) {
9802
+ return AUTHENTICATOR_SELECTION_CROSS_DEVICE;
9803
+ }
9804
+ return AUTHENTICATOR_SELECTION;
9805
+ }
9806
+ function getWebAuthnHints() {
9807
+ if (shouldForceCrossDevice()) {
9808
+ return ["hybrid"];
9809
+ }
9810
+ return void 0;
9811
+ }
9781
9812
  var CREDENTIAL_MEDIATION = "required";
9782
9813
  var USER_VERIFICATION = "required";
9783
9814
  var WEBAUTHN_TIMEOUT = 6e4;
@@ -9982,10 +10013,11 @@ function createPasskeyAdapter(options = {}) {
9982
10013
  type: "public-key"
9983
10014
  }
9984
10015
  ];
10016
+ const hints = getWebAuthnHints();
9985
10017
  return withWebAuthnLock(async () => {
9986
10018
  let credential = null;
9987
10019
  try {
9988
- credential = await navigator.credentials.get({
10020
+ const requestOptions = {
9989
10021
  publicKey: {
9990
10022
  challenge: crypto.getRandomValues(new Uint8Array(32)),
9991
10023
  rpId,
@@ -9998,11 +10030,15 @@ function createPasskeyAdapter(options = {}) {
9998
10030
  first: prfInput.salt.buffer
9999
10031
  }
10000
10032
  }
10001
- }
10033
+ },
10034
+ // Chrome 128+ supports hints to prioritize certain authenticator types
10035
+ // On Windows/Linux, this prioritizes QR code over USB security key prompt
10036
+ ...hints && { hints }
10002
10037
  },
10003
10038
  mediation: CREDENTIAL_MEDIATION
10004
10039
  // Use shared constant
10005
- });
10040
+ };
10041
+ credential = await navigator.credentials.get(requestOptions);
10006
10042
  } catch (error) {
10007
10043
  console.error("[PasskeyAdapter] WebAuthn get() failed:", error);
10008
10044
  console.error("[PasskeyAdapter] Error name:", error?.name);
@@ -19676,6 +19712,8 @@ async function enrollPasskey(params) {
19676
19712
  };
19677
19713
  const prfSalt = sdkCore.deriveWrapKey(tempPrfInput);
19678
19714
  const displayName = buildDisplayName(userEmail, userEvmAddress, userId);
19715
+ const authenticatorSelection = getAuthenticatorSelection();
19716
+ const hints = getWebAuthnHints();
19679
19717
  const publicKeyCredentialCreationOptions = {
19680
19718
  challenge: challenge2,
19681
19719
  rp: {
@@ -19688,7 +19726,7 @@ async function enrollPasskey(params) {
19688
19726
  displayName
19689
19727
  },
19690
19728
  pubKeyCredParams: PUBKEY_CRED_PARAMS,
19691
- authenticatorSelection: AUTHENTICATOR_SELECTION,
19729
+ authenticatorSelection,
19692
19730
  timeout: WEBAUTHN_TIMEOUT,
19693
19731
  attestation: ATTESTATION,
19694
19732
  extensions: {
@@ -19697,7 +19735,10 @@ async function enrollPasskey(params) {
19697
19735
  first: prfSalt.buffer
19698
19736
  }
19699
19737
  }
19700
- }
19738
+ },
19739
+ // Chrome 128+ supports hints to prioritize certain authenticator types
19740
+ // On Windows/Linux, this prioritizes QR code over USB security key prompt
19741
+ ...hints && { hints }
19701
19742
  };
19702
19743
  const credential = await navigator.credentials.create({
19703
19744
  publicKey: publicKeyCredentialCreationOptions
@@ -20891,7 +20932,12 @@ function getPlatformHint(platform) {
20891
20932
  case "Windows":
20892
20933
  return {
20893
20934
  hintKey: "passkey.hint.windows",
20894
- noteKey: "passkey.hint.note"
20935
+ noteKey: "passkey.hint.windowsNote"
20936
+ };
20937
+ case "Linux":
20938
+ return {
20939
+ hintKey: "passkey.hint.linux",
20940
+ noteKey: "passkey.hint.windowsNote"
20895
20941
  };
20896
20942
  default:
20897
20943
  return {
@@ -21085,6 +21131,8 @@ async function completeMigration(params) {
21085
21131
  credentialId: tempCredentialId
21086
21132
  };
21087
21133
  const prfSalt = sdkCore.deriveWrapKey(tempPrfInput);
21134
+ const authenticatorSelection = getAuthenticatorSelection();
21135
+ const hints = getWebAuthnHints();
21088
21136
  const publicKeyCredentialCreationOptions = {
21089
21137
  challenge: challenge2,
21090
21138
  rp: {
@@ -21097,7 +21145,7 @@ async function completeMigration(params) {
21097
21145
  displayName
21098
21146
  },
21099
21147
  pubKeyCredParams: PUBKEY_CRED_PARAMS,
21100
- authenticatorSelection: AUTHENTICATOR_SELECTION,
21148
+ authenticatorSelection,
21101
21149
  timeout: WEBAUTHN_TIMEOUT,
21102
21150
  attestation: ATTESTATION,
21103
21151
  extensions: {
@@ -21106,7 +21154,10 @@ async function completeMigration(params) {
21106
21154
  first: prfSalt.buffer
21107
21155
  }
21108
21156
  }
21109
- }
21157
+ },
21158
+ // Chrome 128+ supports hints to prioritize certain authenticator types
21159
+ // On Windows/Linux, this prioritizes QR code over USB security key prompt
21160
+ ...hints && { hints }
21110
21161
  };
21111
21162
  const credential = await navigator.credentials.create({
21112
21163
  publicKey: publicKeyCredentialCreationOptions