@signalwire/js 4.0.0-dev-20260410155733 → 4.0.0-dev-20260410161202

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
@@ -1698,10 +1698,10 @@ var StorageManager = class {
1698
1698
  //#region src/containers/DependencyContainer.ts
1699
1699
  var DependencyContainer = class {
1700
1700
  constructor() {
1701
+ this.persistSession = false;
1701
1702
  this._webSocketConstructor = typeof WebSocket !== "undefined" ? WebSocket : void 0;
1702
1703
  this._baseURL = this.apiHost;
1703
1704
  this._credential = {};
1704
- this.persistSession = false;
1705
1705
  }
1706
1706
  get subscriberId() {
1707
1707
  return this.subscriber.id;
@@ -1839,7 +1839,7 @@ const computeJwkThumbprint = async (jwk) => {
1839
1839
  });
1840
1840
  return base64url(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(canonical)));
1841
1841
  };
1842
- function openDpopDB() {
1842
+ async function openDpopDB() {
1843
1843
  return new Promise((resolve, reject) => {
1844
1844
  const request = indexedDB.open(DPOP_DB_NAME, DPOP_DB_VERSION);
1845
1845
  request.onupgradeneeded = () => {
@@ -1847,7 +1847,7 @@ function openDpopDB() {
1847
1847
  if (!db.objectStoreNames.contains(DPOP_STORE_NAME)) db.createObjectStore(DPOP_STORE_NAME);
1848
1848
  };
1849
1849
  request.onsuccess = () => resolve(request.result);
1850
- request.onerror = () => reject(request.error);
1850
+ request.onerror = () => reject(request.error ?? /* @__PURE__ */ new Error("Failed to open IndexedDB"));
1851
1851
  });
1852
1852
  }
1853
1853
  async function loadKeyPairFromDB() {
@@ -1857,7 +1857,7 @@ async function loadKeyPairFromDB() {
1857
1857
  const tx = db.transaction(DPOP_STORE_NAME, "readonly");
1858
1858
  const req = tx.objectStore(DPOP_STORE_NAME).get(DPOP_KEY_ID);
1859
1859
  req.onsuccess = () => resolve(req.result ?? null);
1860
- req.onerror = () => reject(req.error);
1860
+ req.onerror = () => reject(req.error ?? /* @__PURE__ */ new Error("Failed to load key pair from IndexedDB"));
1861
1861
  tx.oncomplete = () => db.close();
1862
1862
  });
1863
1863
  } catch (error) {
@@ -1877,7 +1877,7 @@ async function saveKeyPairToDB(keyPair) {
1877
1877
  };
1878
1878
  tx.onerror = () => {
1879
1879
  db.close();
1880
- reject(tx.error);
1880
+ reject(tx.error ?? /* @__PURE__ */ new Error("Failed to save key pair to IndexedDB"));
1881
1881
  };
1882
1882
  });
1883
1883
  } catch (error) {
@@ -1896,7 +1896,7 @@ async function deleteKeyPairFromDB() {
1896
1896
  };
1897
1897
  tx.onerror = () => {
1898
1898
  db.close();
1899
- reject(tx.error);
1899
+ reject(tx.error ?? /* @__PURE__ */ new Error("Failed to delete key pair from IndexedDB"));
1900
1900
  };
1901
1901
  });
1902
1902
  } catch (error) {
@@ -9745,7 +9745,7 @@ var SignalWire = class extends Destroyable {
9745
9745
  const cached = await this._deps.storage.getItem("sw:cached_credential", scope);
9746
9746
  if (cached?.token) {
9747
9747
  logger$1.debug(`[SignalWire] Using cached credential from ${scope}Storage`);
9748
- return this.validateCredentials(void 0, cached);
9748
+ return await this.validateCredentials(void 0, cached);
9749
9749
  }
9750
9750
  } catch {}
9751
9751
  throw new require_operators.InvalidCredentialsError("No credential provider and no cached session. Provide a CredentialProvider or enable persistSession with a prior login.");