@strands.gg/accui 1.3.1 → 1.3.3

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.
Files changed (37) hide show
  1. package/dist/nuxt/runtime/composables/useStrandsAuth.cjs.js +1 -1
  2. package/dist/nuxt/runtime/composables/useStrandsAuth.d.ts +1 -0
  3. package/dist/nuxt/runtime/composables/useStrandsAuth.d.ts.map +1 -1
  4. package/dist/nuxt/runtime/composables/useStrandsAuth.es.js +1 -1
  5. package/dist/nuxt/runtime/plugin.client.cjs.js +1 -1
  6. package/dist/nuxt/runtime/plugin.client.es.js +1 -1
  7. package/dist/nuxt/runtime/plugin.server.cjs.js +1 -1
  8. package/dist/nuxt/runtime/plugin.server.es.js +1 -1
  9. package/dist/nuxt-v4/runtime/composables/useStrandsAuth.cjs.js +1 -1
  10. package/dist/nuxt-v4/runtime/composables/useStrandsAuth.es.js +1 -1
  11. package/dist/nuxt-v4/runtime/plugin.client.cjs.js +1 -1
  12. package/dist/nuxt-v4/runtime/plugin.client.es.js +1 -1
  13. package/dist/nuxt-v4/runtime/plugin.server.cjs.js +1 -1
  14. package/dist/nuxt-v4/runtime/plugin.server.es.js +1 -1
  15. package/dist/strands-auth-ui.cjs.js +31 -13
  16. package/dist/strands-auth-ui.cjs.js.map +1 -1
  17. package/dist/strands-auth-ui.es.js +32 -14
  18. package/dist/strands-auth-ui.es.js.map +1 -1
  19. package/dist/types/index.d.ts +1 -0
  20. package/dist/types/index.d.ts.map +1 -1
  21. package/dist/{useStrandsAuth-BCY250zc.cjs → useStrandsAuth-Bw5wrBA2.cjs} +28 -2
  22. package/dist/useStrandsAuth-Bw5wrBA2.cjs.map +1 -0
  23. package/dist/{useStrandsAuth-DCKbUhTa.js → useStrandsAuth-DQbwHB-6.js} +28 -2
  24. package/dist/useStrandsAuth-DQbwHB-6.js.map +1 -0
  25. package/dist/{useStrandsConfig-nSwWMPqi.cjs → useStrandsConfig-B9UkrP-c.cjs} +5 -3
  26. package/dist/{useStrandsConfig-nSwWMPqi.cjs.map → useStrandsConfig-B9UkrP-c.cjs.map} +1 -1
  27. package/dist/{useStrandsConfig-gjVpu8j8.js → useStrandsConfig-V7XSMyQ5.js} +5 -3
  28. package/dist/{useStrandsConfig-gjVpu8j8.js.map → useStrandsConfig-V7XSMyQ5.js.map} +1 -1
  29. package/dist/vue/components/StrandsMfaVerification.vue.d.ts.map +1 -1
  30. package/dist/vue/composables/useStrandsAuth.d.ts +1 -0
  31. package/dist/vue/composables/useStrandsAuth.d.ts.map +1 -1
  32. package/dist/vue/composables/useStrandsConfig.d.ts.map +1 -1
  33. package/dist/vue/ui/UiInput.vue.d.ts +3 -1
  34. package/dist/vue/ui/UiInput.vue.d.ts.map +1 -1
  35. package/package.json +1 -1
  36. package/dist/useStrandsAuth-BCY250zc.cjs.map +0 -1
  37. package/dist/useStrandsAuth-DCKbUhTa.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const app = require("nuxt/app");
4
- const useStrandsAuth$1 = require("../../../useStrandsAuth-BCY250zc.cjs");
4
+ const useStrandsAuth$1 = require("../../../useStrandsAuth-Bw5wrBA2.cjs");
5
5
  const useStrandsAuth = () => {
6
6
  const config = app.useRuntimeConfig().public["strandsAuth"];
7
7
  const vueAuth = useStrandsAuth$1.useStrandsAuth();
@@ -81,6 +81,7 @@ export declare const useStrandsAuth: () => {
81
81
  setAuthData: (authResponse: import('../../..').AuthResponse) => void;
82
82
  verifyMfa: (deviceId: string, code: string, isBackupCode?: boolean) => Promise<import('../../..').AuthResponse>;
83
83
  sendMfaEmailCode: (deviceId: string) => Promise<any>;
84
+ getMfaWebAuthnChallenge: (deviceId: string) => Promise<any>;
84
85
  registerHardwareKey: (deviceName: string, accessToken: string, deviceType?: "hardware" | "passkey") => Promise<any>;
85
86
  completeHardwareKeyRegistration: (deviceId: string, credential: any, accessToken: string) => Promise<any>;
86
87
  startTokenRefreshTimer: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"useStrandsAuth.d.ts","sourceRoot":"","sources":["../../../../../../apps/accounts-ui/src/nuxt/runtime/composables/useStrandsAuth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,KAAK,CAAA;AAK3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAE1C,eAAO,MAAM,cAAc;;0BAYU;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;uBAYtC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqClD,CAAA;AAGD,eAAO,MAAM,WAAW,QAAO;IAAE,IAAI,EAAE,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC,CAAA;CAG9D,CAAA;AAED,eAAO,MAAM,YAAY,QAAO;IAAE,eAAe,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAAC,SAAS,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;CAGvG,CAAA"}
1
+ {"version":3,"file":"useStrandsAuth.d.ts","sourceRoot":"","sources":["../../../../../../apps/accounts-ui/src/nuxt/runtime/composables/useStrandsAuth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,KAAK,CAAA;AAK3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAE1C,eAAO,MAAM,cAAc;;0BAYU;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;uBAYtC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqClD,CAAA;AAGD,eAAO,MAAM,WAAW,QAAO;IAAE,IAAI,EAAE,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC,CAAA;CAG9D,CAAA;AAED,eAAO,MAAM,YAAY,QAAO;IAAE,eAAe,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAAC,SAAS,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;CAGvG,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { useRuntimeConfig, navigateTo } from "nuxt/app";
2
- import { u as useStrandsAuth$1 } from "../../../useStrandsAuth-DCKbUhTa.js";
2
+ import { u as useStrandsAuth$1 } from "../../../useStrandsAuth-DQbwHB-6.js";
3
3
  const useStrandsAuth = () => {
4
4
  const config = useRuntimeConfig().public["strandsAuth"];
5
5
  const vueAuth = useStrandsAuth$1();
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const app = require("nuxt/app");
3
- const useStrandsConfig = require("../../useStrandsConfig-nSwWMPqi.cjs");
3
+ const useStrandsConfig = require("../../useStrandsConfig-B9UkrP-c.cjs");
4
4
  const plugin_client = app.defineNuxtPlugin({
5
5
  name: "strands-auth-client",
6
6
  async setup() {
@@ -1,5 +1,5 @@
1
1
  import { defineNuxtPlugin, useRuntimeConfig } from "nuxt/app";
2
- import { p as provideStrandsConfig, S as STRANDS_AUTH_DEFAULTS } from "../../useStrandsConfig-gjVpu8j8.js";
2
+ import { p as provideStrandsConfig, S as STRANDS_AUTH_DEFAULTS } from "../../useStrandsConfig-V7XSMyQ5.js";
3
3
  const plugin_client = defineNuxtPlugin({
4
4
  name: "strands-auth-client",
5
5
  async setup() {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const app = require("nuxt/app");
3
- const useStrandsConfig = require("../../useStrandsConfig-nSwWMPqi.cjs");
3
+ const useStrandsConfig = require("../../useStrandsConfig-B9UkrP-c.cjs");
4
4
  const plugin_server = app.defineNuxtPlugin({
5
5
  name: "strands-auth-server",
6
6
  setup() {
@@ -1,5 +1,5 @@
1
1
  import { defineNuxtPlugin, useRuntimeConfig } from "nuxt/app";
2
- import { p as provideStrandsConfig, S as STRANDS_AUTH_DEFAULTS } from "../../useStrandsConfig-gjVpu8j8.js";
2
+ import { p as provideStrandsConfig, S as STRANDS_AUTH_DEFAULTS } from "../../useStrandsConfig-V7XSMyQ5.js";
3
3
  const plugin_server = defineNuxtPlugin({
4
4
  name: "strands-auth-server",
5
5
  setup() {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const app = require("nuxt/app");
4
- const useStrandsAuth$1 = require("../../../useStrandsAuth-BCY250zc.cjs");
4
+ const useStrandsAuth$1 = require("../../../useStrandsAuth-Bw5wrBA2.cjs");
5
5
  const useStrandsAuth = () => {
6
6
  const config = app.useRuntimeConfig().public["strandsAuth"];
7
7
  const vueAuth = useStrandsAuth$1.useStrandsAuth();
@@ -1,5 +1,5 @@
1
1
  import { useRuntimeConfig, navigateTo } from "nuxt/app";
2
- import { u as useStrandsAuth$1 } from "../../../useStrandsAuth-DCKbUhTa.js";
2
+ import { u as useStrandsAuth$1 } from "../../../useStrandsAuth-DQbwHB-6.js";
3
3
  const useStrandsAuth = () => {
4
4
  const config = useRuntimeConfig().public["strandsAuth"];
5
5
  const vueAuth = useStrandsAuth$1();
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const app = require("nuxt/app");
3
- const useStrandsConfig = require("../../useStrandsConfig-nSwWMPqi.cjs");
3
+ const useStrandsConfig = require("../../useStrandsConfig-B9UkrP-c.cjs");
4
4
  const plugin_client = app.defineNuxtPlugin({
5
5
  name: "strands-auth-client-v4",
6
6
  async setup() {
@@ -1,5 +1,5 @@
1
1
  import { defineNuxtPlugin, useRuntimeConfig } from "nuxt/app";
2
- import { p as provideStrandsConfig, S as STRANDS_AUTH_DEFAULTS } from "../../useStrandsConfig-gjVpu8j8.js";
2
+ import { p as provideStrandsConfig, S as STRANDS_AUTH_DEFAULTS } from "../../useStrandsConfig-V7XSMyQ5.js";
3
3
  const plugin_client = defineNuxtPlugin({
4
4
  name: "strands-auth-client-v4",
5
5
  async setup() {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const app = require("nuxt/app");
3
- const useStrandsConfig = require("../../useStrandsConfig-nSwWMPqi.cjs");
3
+ const useStrandsConfig = require("../../useStrandsConfig-B9UkrP-c.cjs");
4
4
  const plugin_server = app.defineNuxtPlugin({
5
5
  name: "strands-auth-server-v4",
6
6
  setup() {
@@ -1,5 +1,5 @@
1
1
  import { defineNuxtPlugin, useRuntimeConfig } from "nuxt/app";
2
- import { S as STRANDS_AUTH_DEFAULTS, p as provideStrandsConfig } from "../../useStrandsConfig-gjVpu8j8.js";
2
+ import { S as STRANDS_AUTH_DEFAULTS, p as provideStrandsConfig } from "../../useStrandsConfig-V7XSMyQ5.js";
3
3
  const plugin_server = defineNuxtPlugin({
4
4
  name: "strands-auth-server-v4",
5
5
  setup() {
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("vue");
4
- const useStrandsConfig = require("./useStrandsConfig-nSwWMPqi.cjs");
5
- const useStrandsAuth = require("./useStrandsAuth-BCY250zc.cjs");
4
+ const useStrandsConfig = require("./useStrandsConfig-B9UkrP-c.cjs");
5
+ const useStrandsAuth = require("./useStrandsAuth-Bw5wrBA2.cjs");
6
6
  const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
7
7
  __name: "UiAlert",
8
8
  props: {
@@ -370,7 +370,7 @@ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
370
370
  placeholder: { type: String, required: false },
371
371
  disabled: { type: Boolean, required: false },
372
372
  required: { type: Boolean, required: false },
373
- error: { type: String, required: false },
373
+ error: { type: Object, required: false },
374
374
  helpText: { type: String, required: false },
375
375
  autocomplete: { type: String, required: false },
376
376
  size: { type: String, required: false, default: "md" }
@@ -539,7 +539,7 @@ function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
539
539
  $props.error ? (vue.openBlock(), vue.createElementBlock(
540
540
  "p",
541
541
  _hoisted_9$b,
542
- vue.toDisplayString($props.error),
542
+ vue.toDisplayString($props.error.message),
543
543
  1
544
544
  /* TEXT */
545
545
  )) : $props.helpText ? (vue.openBlock(), vue.createElementBlock(
@@ -1248,6 +1248,7 @@ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
1248
1248
  const {
1249
1249
  verifyMfa,
1250
1250
  sendMfaEmailCode,
1251
+ getMfaWebAuthnChallenge,
1251
1252
  mfaSessionId: authMfaSessionId,
1252
1253
  loading: authLoading,
1253
1254
  loadingMessage: authLoadingMessage,
@@ -1390,18 +1391,34 @@ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
1390
1391
  if (!window.navigator.credentials || !window.PublicKeyCredential) {
1391
1392
  throw new Error("Hardware keys are not supported in this browser");
1392
1393
  }
1393
- const challenge = new Uint8Array(32);
1394
- crypto.getRandomValues(challenge);
1394
+ const challengeResponse = await getMfaWebAuthnChallenge(selectedMethod.value.id);
1395
+ const challengeData = challengeResponse.challenge.publicKey || challengeResponse.challenge;
1396
+ const base64ToUint8Array = (base64) => {
1397
+ if (!base64 || typeof base64 !== "string") {
1398
+ return new Uint8Array(0);
1399
+ }
1400
+ const padding = "=".repeat((4 - base64.length % 4) % 4);
1401
+ const b64 = (base64 + padding).replace(/-/g, "+").replace(/_/g, "/");
1402
+ const rawData = window.atob(b64);
1403
+ const outputArray = new Uint8Array(rawData.length);
1404
+ for (let i = 0; i < rawData.length; ++i) {
1405
+ outputArray[i] = rawData.charCodeAt(i);
1406
+ }
1407
+ return outputArray;
1408
+ };
1395
1409
  const isPasskey = selectedMethod.value.device_type === "passkey";
1396
1410
  const publicKeyCredentialRequestOptions = {
1397
- challenge,
1398
- timeout: isPasskey ? 3e5 : 6e4,
1399
- // Longer timeout for passkeys
1400
- rpId: window.location.hostname,
1401
- allowCredentials: [],
1402
- // Empty to allow any registered credential
1411
+ ...challengeData,
1412
+ challenge: challengeData.challenge ? base64ToUint8Array(challengeData.challenge) : new Uint8Array(32),
1413
+ timeout: isPasskey ? 3e5 : challengeData.timeout || 6e4,
1403
1414
  userVerification: isPasskey ? "required" : "discouraged"
1404
1415
  };
1416
+ if (challengeData.allowCredentials && Array.isArray(challengeData.allowCredentials)) {
1417
+ publicKeyCredentialRequestOptions.allowCredentials = challengeData.allowCredentials.map((cred) => ({
1418
+ ...cred,
1419
+ id: base64ToUint8Array(cred.id)
1420
+ }));
1421
+ }
1405
1422
  const credential = await navigator.credentials.get({
1406
1423
  publicKey: publicKeyCredentialRequestOptions
1407
1424
  });
@@ -1442,10 +1459,11 @@ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
1442
1459
  await verifyMfa(selectedMethod.value.id, JSON.stringify(credentialData));
1443
1460
  emit("success");
1444
1461
  } catch (error) {
1462
+ console.error("Hardware key authentication error:", error);
1445
1463
  emit("error", error instanceof Error ? error.message : "Hardware key authentication failed");
1446
1464
  }
1447
1465
  };
1448
- const __returned__ = { props, emit, mfaLoading, getDeviceTypeIcon, getDeviceTypeName, verifyMfa, sendMfaEmailCode, authMfaSessionId, authLoading, authLoadingMessage, isSendingMfaEmail, isVerifyingMfa, loading: loading2, selectedMethod, verificationCode, verificationError, backupCode, backupCodeError, showBackupCodeInput, emailCodeSent, cooldownActive, cooldownSeconds, get cooldownInterval() {
1466
+ const __returned__ = { props, emit, mfaLoading, getDeviceTypeIcon, getDeviceTypeName, verifyMfa, sendMfaEmailCode, getMfaWebAuthnChallenge, authMfaSessionId, authLoading, authLoadingMessage, isSendingMfaEmail, isVerifyingMfa, loading: loading2, selectedMethod, verificationCode, verificationError, backupCode, backupCodeError, showBackupCodeInput, emailCodeSent, cooldownActive, cooldownSeconds, get cooldownInterval() {
1449
1467
  return cooldownInterval;
1450
1468
  }, set cooldownInterval(v) {
1451
1469
  cooldownInterval = v;