@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.cjs CHANGED
@@ -438,6 +438,7 @@ async function beginPasskeyAuthentication(username) {
438
438
  {
439
439
  method: "POST",
440
440
  headers: { "Content-Type": "application/json" },
441
+ credentials: "include",
441
442
  body: JSON.stringify({ username })
442
443
  }
443
444
  );
@@ -481,6 +482,7 @@ async function completePasskeyAuthentication(challengeId, credential, options) {
481
482
  {
482
483
  method: "POST",
483
484
  headers: { "Content-Type": "application/json" },
485
+ credentials: "include",
484
486
  body: JSON.stringify({ challengeId, credential: credentialData })
485
487
  }
486
488
  );
@@ -510,6 +512,7 @@ async function beginPasskeyRegistration(username) {
510
512
  {
511
513
  method: "POST",
512
514
  headers: { "Content-Type": "application/json" },
515
+ credentials: "include",
513
516
  body: JSON.stringify({ username })
514
517
  }
515
518
  );
@@ -553,6 +556,7 @@ async function completePasskeyRegistration(challengeId, credential, options) {
553
556
  {
554
557
  method: "POST",
555
558
  headers: { "Content-Type": "application/json" },
559
+ credentials: "include",
556
560
  body: JSON.stringify({ challengeId, credential: credentialData })
557
561
  }
558
562
  );
@@ -925,7 +929,9 @@ var init_httpClient = __esm({
925
929
  }
926
930
  const requestConfig = {
927
931
  method,
928
- headers: requestHeaders
932
+ headers: requestHeaders,
933
+ credentials: "include"
934
+ // Enable cookies for cross-origin requests
929
935
  };
930
936
  if (body && method !== "GET") {
931
937
  requestConfig.body = typeof body === "string" ? body : JSON.stringify(body);
@@ -1186,7 +1192,8 @@ var init_cloudStorage = __esm({
1186
1192
  const searchResponse = await fetch(
1187
1193
  `https://www.googleapis.com/drive/v3/files?q=name='${folderName}' and mimeType='application/vnd.google-apps.folder' and trashed=false`,
1188
1194
  {
1189
- headers: { Authorization: `Bearer ${this.accessToken}` }
1195
+ headers: { Authorization: `Bearer ${this.accessToken}` },
1196
+ credentials: "include"
1190
1197
  }
1191
1198
  );
1192
1199
  if (!searchResponse.ok) {
@@ -1202,6 +1209,7 @@ var init_cloudStorage = __esm({
1202
1209
  Authorization: `Bearer ${this.accessToken}`,
1203
1210
  "Content-Type": "application/json"
1204
1211
  },
1212
+ credentials: "include",
1205
1213
  body: JSON.stringify({
1206
1214
  name: folderName,
1207
1215
  mimeType: "application/vnd.google-apps.folder"
@@ -1224,6 +1232,7 @@ var init_cloudStorage = __esm({
1224
1232
  headers: {
1225
1233
  Authorization: `Bearer ${this.accessToken}`
1226
1234
  },
1235
+ credentials: "include",
1227
1236
  body: form
1228
1237
  }
1229
1238
  );
@@ -1307,7 +1316,7 @@ async function getShareVaultToken(scopes) {
1307
1316
  async function getShareRecoveryStats() {
1308
1317
  try {
1309
1318
  const token = await getShareVaultToken(["share:get"]);
1310
- const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/recovery/stats`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" } });
1319
+ const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/recovery/stats`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" }, credentials: "include" });
1311
1320
  if (response.status === 404) return null;
1312
1321
  if (!response.ok) return null;
1313
1322
  return await response.json();
@@ -1317,26 +1326,26 @@ async function getShareRecoveryStats() {
1317
1326
  }
1318
1327
  async function getShare() {
1319
1328
  const token = await getShareVaultToken(["share:get"]);
1320
- const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" } });
1329
+ const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" }, credentials: "include" });
1321
1330
  if (response.status === 404) return null;
1322
1331
  if (!response.ok) throw new Error(`Failed to fetch share: ${response.status} ${response.statusText}`);
1323
1332
  return await response.json();
1324
1333
  }
1325
1334
  async function uploadShare(share, idempotencyKey) {
1326
1335
  const token = await getShareVaultToken(["share:put"]);
1327
- 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) });
1336
+ 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) });
1328
1337
  if (!response.ok) throw new Error(`Failed to upload share: ${response.status} ${response.statusText}`);
1329
1338
  return await response.json();
1330
1339
  }
1331
1340
  async function rewrapShare(payload, idempotencyKey) {
1332
1341
  const token = await getShareVaultToken(["share:rewrap"]);
1333
- 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) });
1342
+ 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) });
1334
1343
  if (!response.ok) throw new Error(`Failed to rewrap share: ${response.status} ${response.statusText}`);
1335
1344
  return await response.json();
1336
1345
  }
1337
1346
  async function deleteShare() {
1338
1347
  const token = await getShareVaultToken(["share:delete"]);
1339
- const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "DELETE", headers: { Authorization: `Bearer ${token.token}` } });
1348
+ const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "DELETE", headers: { Authorization: `Bearer ${token.token}` }, credentials: "include" });
1340
1349
  if (!response.ok && response.status !== 404) throw new Error(`Failed to delete share: ${response.status} ${response.statusText}`);
1341
1350
  }
1342
1351
  async function deriveKEKFromPasskey(userId, requiredCredentialId) {
@@ -1513,7 +1522,7 @@ function clearBackupStatus(userId) {
1513
1522
  async function checkServerBackupAvailability() {
1514
1523
  try {
1515
1524
  const token = await getShareVaultToken(["share:get"]);
1516
- const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/recovery/stats`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" } });
1525
+ const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/recovery/stats`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" }, credentials: "include" });
1517
1526
  if (response.status === 404) return { hasBackup: false, serviceAvailable: true };
1518
1527
  if (!response.ok) return { hasBackup: false, serviceAvailable: false };
1519
1528
  return { hasBackup: true, serviceAvailable: true };
@@ -1523,14 +1532,14 @@ async function checkServerBackupAvailability() {
1523
1532
  }
1524
1533
  async function uploadShareToVault(envelope, token) {
1525
1534
  const idempotencyKey = crypto.randomUUID ? crypto.randomUUID() : `backup-${Date.now()}`;
1526
- 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) });
1535
+ 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) });
1527
1536
  if (!response.ok) {
1528
1537
  const errorText = await response.text();
1529
1538
  throw new Error(`Failed to upload share: ${response.status} ${response.statusText} - ${errorText}`);
1530
1539
  }
1531
1540
  }
1532
1541
  async function downloadShareFromVault(token) {
1533
- 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" } });
1542
+ 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" });
1534
1543
  if (!response.ok) {
1535
1544
  if (response.status === 404) throw new Error("No backup found on server for this user");
1536
1545
  const errorText = await response.text();
@@ -4367,6 +4376,7 @@ var init_AuthModal = __esm({
4367
4376
  headers: {
4368
4377
  "Content-Type": "application/json"
4369
4378
  },
4379
+ credentials: "include",
4370
4380
  body: JSON.stringify({
4371
4381
  email,
4372
4382
  purpose: "login"
@@ -4484,6 +4494,7 @@ var init_AuthModal = __esm({
4484
4494
  headers: {
4485
4495
  "Content-Type": "application/json"
4486
4496
  },
4497
+ credentials: "include",
4487
4498
  body: JSON.stringify({
4488
4499
  email,
4489
4500
  purpose: "login"
@@ -7250,7 +7261,7 @@ var TransactionsModal = ({ open, onOpenChange, onBack }) => {
7250
7261
  const explorerUrl = getExplorerUrl();
7251
7262
  const baseUrl = explorerUrl.replace(/\/$/, "");
7252
7263
  const apiUrl = `${baseUrl}/api/v2/addresses/${address}/transactions?items_count=20`;
7253
- const response = await fetch(apiUrl);
7264
+ const response = await fetch(apiUrl, { credentials: "include" });
7254
7265
  if (!response.ok) {
7255
7266
  throw new Error(`Failed to fetch transactions: ${response.status}`);
7256
7267
  }
@@ -7897,6 +7908,7 @@ var UserOpStatus = ({
7897
7908
  const res = await fetch(getBundlerUrl(), {
7898
7909
  method: "POST",
7899
7910
  headers: { "content-type": "application/json" },
7911
+ credentials: "include",
7900
7912
  body: JSON.stringify(body)
7901
7913
  });
7902
7914
  const json = await res.json();
@@ -8662,7 +8674,7 @@ function useLumiaPassportLinkedProfiles() {
8662
8674
  // package.json
8663
8675
  var package_default = {
8664
8676
  name: "@lumiapassport/ui-kit",
8665
- version: "1.7.0",
8677
+ version: "1.8.0",
8666
8678
  description: "React UI components and hooks for Lumia Passport authentication and Account Abstraction",
8667
8679
  type: "module",
8668
8680
  main: "./dist/index.cjs",
@@ -9780,7 +9792,7 @@ var TransactionsList = ({
9780
9792
  const baseUrl = explorerUrl.replace(/\/$/, "");
9781
9793
  const apiUrl = `${baseUrl}/api/v2/addresses/${address}/transactions?items_count=${itemsCount}`;
9782
9794
  console.log("[TransactionsList] Fetching from:", apiUrl);
9783
- const response = await fetch(apiUrl);
9795
+ const response = await fetch(apiUrl, { credentials: "include" });
9784
9796
  if (!response.ok) {
9785
9797
  throw new Error(`Failed to fetch transactions: ${response.status}`);
9786
9798
  }
@@ -9924,6 +9936,7 @@ function useUserOpStatus(options = {}) {
9924
9936
  const res = await fetch(getBundlerUrl(), {
9925
9937
  method: "POST",
9926
9938
  headers: { "content-type": "application/json" },
9939
+ credentials: "include",
9927
9940
  body: JSON.stringify(body)
9928
9941
  });
9929
9942
  const json = await res.json();