@lumiapassport/ui-kit 1.7.0 → 1.8.0

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.js CHANGED
@@ -429,6 +429,7 @@ async function beginPasskeyAuthentication(username) {
429
429
  {
430
430
  method: "POST",
431
431
  headers: { "Content-Type": "application/json" },
432
+ credentials: "include",
432
433
  body: JSON.stringify({ username })
433
434
  }
434
435
  );
@@ -472,6 +473,7 @@ async function completePasskeyAuthentication(challengeId, credential, options) {
472
473
  {
473
474
  method: "POST",
474
475
  headers: { "Content-Type": "application/json" },
476
+ credentials: "include",
475
477
  body: JSON.stringify({ challengeId, credential: credentialData })
476
478
  }
477
479
  );
@@ -501,6 +503,7 @@ async function beginPasskeyRegistration(username) {
501
503
  {
502
504
  method: "POST",
503
505
  headers: { "Content-Type": "application/json" },
506
+ credentials: "include",
504
507
  body: JSON.stringify({ username })
505
508
  }
506
509
  );
@@ -544,6 +547,7 @@ async function completePasskeyRegistration(challengeId, credential, options) {
544
547
  {
545
548
  method: "POST",
546
549
  headers: { "Content-Type": "application/json" },
550
+ credentials: "include",
547
551
  body: JSON.stringify({ challengeId, credential: credentialData })
548
552
  }
549
553
  );
@@ -913,7 +917,9 @@ var init_httpClient = __esm({
913
917
  }
914
918
  const requestConfig = {
915
919
  method,
916
- headers: requestHeaders
920
+ headers: requestHeaders,
921
+ credentials: "include"
922
+ // Enable cookies for cross-origin requests
917
923
  };
918
924
  if (body && method !== "GET") {
919
925
  requestConfig.body = typeof body === "string" ? body : JSON.stringify(body);
@@ -1174,7 +1180,8 @@ var init_cloudStorage = __esm({
1174
1180
  const searchResponse = await fetch(
1175
1181
  `https://www.googleapis.com/drive/v3/files?q=name='${folderName}' and mimeType='application/vnd.google-apps.folder' and trashed=false`,
1176
1182
  {
1177
- headers: { Authorization: `Bearer ${this.accessToken}` }
1183
+ headers: { Authorization: `Bearer ${this.accessToken}` },
1184
+ credentials: "include"
1178
1185
  }
1179
1186
  );
1180
1187
  if (!searchResponse.ok) {
@@ -1190,6 +1197,7 @@ var init_cloudStorage = __esm({
1190
1197
  Authorization: `Bearer ${this.accessToken}`,
1191
1198
  "Content-Type": "application/json"
1192
1199
  },
1200
+ credentials: "include",
1193
1201
  body: JSON.stringify({
1194
1202
  name: folderName,
1195
1203
  mimeType: "application/vnd.google-apps.folder"
@@ -1212,6 +1220,7 @@ var init_cloudStorage = __esm({
1212
1220
  headers: {
1213
1221
  Authorization: `Bearer ${this.accessToken}`
1214
1222
  },
1223
+ credentials: "include",
1215
1224
  body: form
1216
1225
  }
1217
1226
  );
@@ -1296,7 +1305,7 @@ async function getShareVaultToken(scopes) {
1296
1305
  async function getShareRecoveryStats() {
1297
1306
  try {
1298
1307
  const token = await getShareVaultToken(["share:get"]);
1299
- const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/recovery/stats`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" } });
1308
+ const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/recovery/stats`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" }, credentials: "include" });
1300
1309
  if (response.status === 404) return null;
1301
1310
  if (!response.ok) return null;
1302
1311
  return await response.json();
@@ -1306,26 +1315,26 @@ async function getShareRecoveryStats() {
1306
1315
  }
1307
1316
  async function getShare() {
1308
1317
  const token = await getShareVaultToken(["share:get"]);
1309
- const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" } });
1318
+ const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" }, credentials: "include" });
1310
1319
  if (response.status === 404) return null;
1311
1320
  if (!response.ok) throw new Error(`Failed to fetch share: ${response.status} ${response.statusText}`);
1312
1321
  return await response.json();
1313
1322
  }
1314
1323
  async function uploadShare(share, idempotencyKey) {
1315
1324
  const token = await getShareVaultToken(["share:put"]);
1316
- const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "PUT", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json", "Idempotency-Key": idempotencyKey }, body: JSON.stringify(share) });
1325
+ const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "PUT", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json", "Idempotency-Key": idempotencyKey }, credentials: "include", body: JSON.stringify(share) });
1317
1326
  if (!response.ok) throw new Error(`Failed to upload share: ${response.status} ${response.statusText}`);
1318
1327
  return await response.json();
1319
1328
  }
1320
1329
  async function rewrapShare(payload, idempotencyKey) {
1321
1330
  const token = await getShareVaultToken(["share:rewrap"]);
1322
- const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/rewrap`, { method: "POST", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json", "Idempotency-Key": idempotencyKey }, body: JSON.stringify(payload) });
1331
+ const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/rewrap`, { method: "POST", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json", "Idempotency-Key": idempotencyKey }, credentials: "include", body: JSON.stringify(payload) });
1323
1332
  if (!response.ok) throw new Error(`Failed to rewrap share: ${response.status} ${response.statusText}`);
1324
1333
  return await response.json();
1325
1334
  }
1326
1335
  async function deleteShare() {
1327
1336
  const token = await getShareVaultToken(["share:delete"]);
1328
- const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "DELETE", headers: { Authorization: `Bearer ${token.token}` } });
1337
+ const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "DELETE", headers: { Authorization: `Bearer ${token.token}` }, credentials: "include" });
1329
1338
  if (!response.ok && response.status !== 404) throw new Error(`Failed to delete share: ${response.status} ${response.statusText}`);
1330
1339
  }
1331
1340
  async function deriveKEKFromPasskey(userId, requiredCredentialId) {
@@ -1502,7 +1511,7 @@ function clearBackupStatus(userId) {
1502
1511
  async function checkServerBackupAvailability() {
1503
1512
  try {
1504
1513
  const token = await getShareVaultToken(["share:get"]);
1505
- const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/recovery/stats`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" } });
1514
+ const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/recovery/stats`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" }, credentials: "include" });
1506
1515
  if (response.status === 404) return { hasBackup: false, serviceAvailable: true };
1507
1516
  if (!response.ok) return { hasBackup: false, serviceAvailable: false };
1508
1517
  return { hasBackup: true, serviceAvailable: true };
@@ -1512,14 +1521,14 @@ async function checkServerBackupAvailability() {
1512
1521
  }
1513
1522
  async function uploadShareToVault(envelope, token) {
1514
1523
  const idempotencyKey = crypto.randomUUID ? crypto.randomUUID() : `backup-${Date.now()}`;
1515
- const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "PUT", headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}`, "Idempotency-Key": idempotencyKey }, body: JSON.stringify(envelope) });
1524
+ const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "PUT", headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}`, "Idempotency-Key": idempotencyKey }, credentials: "include", body: JSON.stringify(envelope) });
1516
1525
  if (!response.ok) {
1517
1526
  const errorText = await response.text();
1518
1527
  throw new Error(`Failed to upload share: ${response.status} ${response.statusText} - ${errorText}`);
1519
1528
  }
1520
1529
  }
1521
1530
  async function downloadShareFromVault(token) {
1522
- const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "GET", headers: { Authorization: `Bearer ${token}`, "X-Client-Device-Id": "lumia-ui-kit", "X-Client-Device-Name": "Lumia UI Kit" } });
1531
+ const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "GET", headers: { Authorization: `Bearer ${token}`, "X-Client-Device-Id": "lumia-ui-kit", "X-Client-Device-Name": "Lumia UI Kit" }, credentials: "include" });
1523
1532
  if (!response.ok) {
1524
1533
  if (response.status === 404) throw new Error("No backup found on server for this user");
1525
1534
  const errorText = await response.text();
@@ -4365,6 +4374,7 @@ var init_AuthModal = __esm({
4365
4374
  headers: {
4366
4375
  "Content-Type": "application/json"
4367
4376
  },
4377
+ credentials: "include",
4368
4378
  body: JSON.stringify({
4369
4379
  email,
4370
4380
  purpose: "login"
@@ -4482,6 +4492,7 @@ var init_AuthModal = __esm({
4482
4492
  headers: {
4483
4493
  "Content-Type": "application/json"
4484
4494
  },
4495
+ credentials: "include",
4485
4496
  body: JSON.stringify({
4486
4497
  email,
4487
4498
  purpose: "login"
@@ -7221,7 +7232,7 @@ var TransactionsModal = ({ open, onOpenChange, onBack }) => {
7221
7232
  const explorerUrl = getExplorerUrl();
7222
7233
  const baseUrl = explorerUrl.replace(/\/$/, "");
7223
7234
  const apiUrl = `${baseUrl}/api/v2/addresses/${address}/transactions?items_count=20`;
7224
- const response = await fetch(apiUrl);
7235
+ const response = await fetch(apiUrl, { credentials: "include" });
7225
7236
  if (!response.ok) {
7226
7237
  throw new Error(`Failed to fetch transactions: ${response.status}`);
7227
7238
  }
@@ -7868,6 +7879,7 @@ var UserOpStatus = ({
7868
7879
  const res = await fetch(getBundlerUrl(), {
7869
7880
  method: "POST",
7870
7881
  headers: { "content-type": "application/json" },
7882
+ credentials: "include",
7871
7883
  body: JSON.stringify(body)
7872
7884
  });
7873
7885
  const json = await res.json();
@@ -8633,7 +8645,7 @@ function useLumiaPassportLinkedProfiles() {
8633
8645
  // package.json
8634
8646
  var package_default = {
8635
8647
  name: "@lumiapassport/ui-kit",
8636
- version: "1.7.0",
8648
+ version: "1.8.0",
8637
8649
  description: "React UI components and hooks for Lumia Passport authentication and Account Abstraction",
8638
8650
  type: "module",
8639
8651
  main: "./dist/index.cjs",
@@ -9751,7 +9763,7 @@ var TransactionsList = ({
9751
9763
  const baseUrl = explorerUrl.replace(/\/$/, "");
9752
9764
  const apiUrl = `${baseUrl}/api/v2/addresses/${address}/transactions?items_count=${itemsCount}`;
9753
9765
  console.log("[TransactionsList] Fetching from:", apiUrl);
9754
- const response = await fetch(apiUrl);
9766
+ const response = await fetch(apiUrl, { credentials: "include" });
9755
9767
  if (!response.ok) {
9756
9768
  throw new Error(`Failed to fetch transactions: ${response.status}`);
9757
9769
  }
@@ -9895,6 +9907,7 @@ function useUserOpStatus(options = {}) {
9895
9907
  const res = await fetch(getBundlerUrl(), {
9896
9908
  method: "POST",
9897
9909
  headers: { "content-type": "application/json" },
9910
+ credentials: "include",
9898
9911
  body: JSON.stringify(body)
9899
9912
  });
9900
9913
  const json = await res.json();