@strands.gg/accui 1.2.1 → 1.2.2

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.
@@ -7427,15 +7427,38 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
7427
7427
  challenge: safeBufferConvert(challenge.challenge),
7428
7428
  pubKeyCredParams: challenge.pubKeyCredParams || [
7429
7429
  { type: "public-key", alg: -7 },
7430
- // ES256
7431
- { type: "public-key", alg: -257 }
7432
- // RS256
7430
+ // ES256 (ECDSA w/ SHA-256)
7431
+ { type: "public-key", alg: -35 },
7432
+ // ES384 (ECDSA w/ SHA-384)
7433
+ { type: "public-key", alg: -36 },
7434
+ // ES512 (ECDSA w/ SHA-512)
7435
+ { type: "public-key", alg: -257 },
7436
+ // RS256 (RSASSA-PKCS1-v1_5 w/ SHA-256)
7437
+ { type: "public-key", alg: -258 },
7438
+ // RS384 (RSASSA-PKCS1-v1_5 w/ SHA-384)
7439
+ { type: "public-key", alg: -259 },
7440
+ // RS512 (RSASSA-PKCS1-v1_5 w/ SHA-512)
7441
+ { type: "public-key", alg: -37 },
7442
+ // PS256 (RSASSA-PSS w/ SHA-256)
7443
+ { type: "public-key", alg: -38 },
7444
+ // PS384 (RSASSA-PSS w/ SHA-384)
7445
+ { type: "public-key", alg: -39 },
7446
+ // PS512 (RSASSA-PSS w/ SHA-512)
7447
+ { type: "public-key", alg: -8 }
7448
+ // EdDSA (Ed25519)
7433
7449
  ],
7434
- timeout: challenge.timeout || 6e4,
7450
+ timeout: challenge.timeout || 12e4,
7451
+ // Longer timeout for hardware keys
7435
7452
  authenticatorSelection: challenge.authenticatorSelection || {
7436
- userVerification: "preferred"
7453
+ authenticatorAttachment: "cross-platform",
7454
+ // Prefer external authenticators like YubiKey
7455
+ requireResidentKey: false,
7456
+ residentKey: "discouraged",
7457
+ userVerification: "discouraged"
7458
+ // YubiKeys work better with discouraged
7437
7459
  },
7438
- attestation: challenge.attestation || "none"
7460
+ attestation: challenge.attestation || "direct"
7461
+ // Better compatibility with hardware keys
7439
7462
  };
7440
7463
  if (challenge.excludeCredentials && Array.isArray(challenge.excludeCredentials) && challenge.excludeCredentials.length > 0) {
7441
7464
  cleanChallenge.excludeCredentials = challenge.excludeCredentials.map((cred) => ({
@@ -7465,6 +7488,16 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
7465
7488
  if (!window.navigator.credentials || !window.PublicKeyCredential) {
7466
7489
  throw new Error("WebAuthn is not supported in this browser");
7467
7490
  }
7491
+ try {
7492
+ const available = await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?.();
7493
+ console.log("Platform authenticator available:", available);
7494
+ if (PublicKeyCredential.isConditionalMediationAvailable) {
7495
+ const conditionalMediationAvailable = await PublicKeyCredential.isConditionalMediationAvailable();
7496
+ console.log("Conditional mediation available:", conditionalMediationAvailable);
7497
+ }
7498
+ } catch (checkError) {
7499
+ console.warn("Could not check authenticator availability:", checkError);
7500
+ }
7468
7501
  if (!currentSession.value?.accessToken) {
7469
7502
  throw new Error("Not authenticated. Please sign in again.");
7470
7503
  }
@@ -7531,7 +7564,26 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
7531
7564
  }
7532
7565
  } catch (error) {
7533
7566
  console.error("Hardware key registration error:", error);
7534
- errorMessage.value = error instanceof Error ? error.message : "Hardware key registration failed";
7567
+ let userErrorMessage = "Hardware key registration failed";
7568
+ if (error instanceof Error) {
7569
+ const errorMsg = error.message.toLowerCase();
7570
+ if (errorMsg.includes("not supported") || errorMsg.includes("webauthn")) {
7571
+ userErrorMessage = "WebAuthn is not supported in this browser. Please use Chrome, Firefox, Safari, or Edge.";
7572
+ } else if (errorMsg.includes("cancelled") || errorMsg.includes("aborted")) {
7573
+ userErrorMessage = "Hardware key registration was cancelled. Please try again and touch your key when prompted.";
7574
+ } else if (errorMsg.includes("timeout")) {
7575
+ userErrorMessage = "Hardware key registration timed out. Please ensure your key is connected and try again.";
7576
+ } else if (errorMsg.includes("not allowed") || errorMsg.includes("invalid state")) {
7577
+ userErrorMessage = "This hardware key may already be registered or cannot be used. Try a different key or contact support.";
7578
+ } else if (errorMsg.includes("can't be used") || errorMsg.includes("newer or different")) {
7579
+ userErrorMessage = "Your hardware key is not compatible. Please ensure you have a FIDO2/WebAuthn compatible key like YubiKey 5 Series, and that it's properly connected.";
7580
+ } else if (errorMsg.includes("user verification") || errorMsg.includes("pin")) {
7581
+ userErrorMessage = "Hardware key verification failed. If your key has a PIN, please enter it when prompted.";
7582
+ } else {
7583
+ userErrorMessage = error.message;
7584
+ }
7585
+ }
7586
+ errorMessage.value = userErrorMessage;
7535
7587
  step.value = 5;
7536
7588
  } finally {
7537
7589
  internalLoading.value = false;