@lumiapassport/ui-kit 1.6.3 → 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.d.cts CHANGED
@@ -229,6 +229,66 @@ declare function prepareUserOperation(session: AccountSession$1, callTarget: `0x
229
229
  userOp: UserOperationV07 | UserOperationV06;
230
230
  userOpHash: `0x${string}`;
231
231
  }>;
232
+ /**
233
+ * EIP712 Domain descriptor
234
+ */
235
+ interface TypedDataDomain {
236
+ name?: string;
237
+ version?: string;
238
+ chainId?: number;
239
+ verifyingContract?: `0x${string}`;
240
+ salt?: `0x${string}`;
241
+ }
242
+ /**
243
+ * EIP712 Type definition
244
+ */
245
+ interface TypedDataField {
246
+ name: string;
247
+ type: string;
248
+ }
249
+ /**
250
+ * Parameters for signing typed data (EIP712)
251
+ */
252
+ interface SignTypedDataParams {
253
+ domain: TypedDataDomain;
254
+ types: Record<string, TypedDataField[]>;
255
+ primaryType: string;
256
+ message: Record<string, any>;
257
+ }
258
+ /**
259
+ * Sign typed data according to EIP712 standard.
260
+ * This method computes the EIP712 hash and signs it using MPC.
261
+ *
262
+ * @param session - Account session with signing credentials
263
+ * @param params - EIP712 typed data parameters (domain, types, primaryType, message)
264
+ * @returns Hex-encoded signature
265
+ *
266
+ * @example
267
+ * ```typescript
268
+ * const signature = await signTypedData(session, {
269
+ * domain: {
270
+ * name: 'MyApp',
271
+ * version: '1',
272
+ * chainId: 994,
273
+ * verifyingContract: '0x...'
274
+ * },
275
+ * types: {
276
+ * Order: [
277
+ * { name: 'tokenIds', type: 'uint256[]' },
278
+ * { name: 'price', type: 'uint256' },
279
+ * { name: 'deadline', type: 'uint256' }
280
+ * ]
281
+ * },
282
+ * primaryType: 'Order',
283
+ * message: {
284
+ * tokenIds: [1n, 2n, 3n],
285
+ * price: 1000000000000000000n,
286
+ * deadline: 1735689600n
287
+ * }
288
+ * });
289
+ * ```
290
+ */
291
+ declare function signTypedData(session: AccountSession$1, params: SignTypedDataParams): Promise<`0x${string}`>;
232
292
 
233
293
  type AccountSession = AccountSession$1;
234
294
  interface SessionState {
@@ -901,4 +961,4 @@ interface WalletReadyStatus {
901
961
  timestamp: number;
902
962
  }
903
963
 
904
- export { type AccountSession$1 as AccountSession, Address, type AddressProps, type Asset, ConnectWalletButton, type ConnectWalletButtonProps, Hash, type HashProps, KeyshareBackup, LUMIA_EXPLORER_URL, LumiaLogo, type LumiaPassportCallbacks, type LumiaPassportConfig, LumiaPassportProvider, type LumiaPassportProviderProps, LumiaPassportSessionProvider, type LumiaPassportSessionProviderProps, LumiaRainbowKitProvider, type LumiaRainbowKitProviderProps, LumiaSessionProvider, type LumiaSessionProviderProps, LumiaWagmiProvider, type ProviderDetail, type SendTransactionParams, type SendTransactionResult, type Theme, ThemeToggle, type TokenBalance, type Transaction, TransactionsList, type UpdateProfileRequest, type UseSendTransactionReturn, type UseUserOpStatusOptions, type UseUserOpStatusReturn, type UserOpMempool, type UserOpReceipt, type SendTransactionParams$1 as UserOpSendTransactionParams, type UserOpState, UserOpStatus, type UserOpStatusProps, type UserOperation, type UserProfile, type WalletReadyStatus, getUserProfile, lumiaBeam, prepareUserOperation, queryClient, sendUserOperation, updateUserProfile, useAssets, useLumiaPassportConfig, useLumiaPassportLinkedProfiles, useLumiaPassportSession, useLumiaSession, useSendTransaction, useSmartAccountTransactions, useTheme, useTokenBalance, useTokenInfo, useTransactions, useUserOpStatus, wagmiConfig };
964
+ export { type AccountSession$1 as AccountSession, Address, type AddressProps, type Asset, ConnectWalletButton, type ConnectWalletButtonProps, Hash, type HashProps, KeyshareBackup, LUMIA_EXPLORER_URL, LumiaLogo, type LumiaPassportCallbacks, type LumiaPassportConfig, LumiaPassportProvider, type LumiaPassportProviderProps, LumiaPassportSessionProvider, type LumiaPassportSessionProviderProps, LumiaRainbowKitProvider, type LumiaRainbowKitProviderProps, LumiaSessionProvider, type LumiaSessionProviderProps, LumiaWagmiProvider, type ProviderDetail, type SendTransactionParams, type SendTransactionResult, type SignTypedDataParams, type Theme, ThemeToggle, type TokenBalance, type Transaction, TransactionsList, type TypedDataDomain, type TypedDataField, type UpdateProfileRequest, type UseSendTransactionReturn, type UseUserOpStatusOptions, type UseUserOpStatusReturn, type UserOpMempool, type UserOpReceipt, type SendTransactionParams$1 as UserOpSendTransactionParams, type UserOpState, UserOpStatus, type UserOpStatusProps, type UserOperation, type UserProfile, type WalletReadyStatus, getUserProfile, lumiaBeam, prepareUserOperation, queryClient, sendUserOperation, signTypedData, updateUserProfile, useAssets, useLumiaPassportConfig, useLumiaPassportLinkedProfiles, useLumiaPassportSession, useLumiaSession, useSendTransaction, useSmartAccountTransactions, useTheme, useTokenBalance, useTokenInfo, useTransactions, useUserOpStatus, wagmiConfig };
package/dist/index.d.ts CHANGED
@@ -229,6 +229,66 @@ declare function prepareUserOperation(session: AccountSession$1, callTarget: `0x
229
229
  userOp: UserOperationV07 | UserOperationV06;
230
230
  userOpHash: `0x${string}`;
231
231
  }>;
232
+ /**
233
+ * EIP712 Domain descriptor
234
+ */
235
+ interface TypedDataDomain {
236
+ name?: string;
237
+ version?: string;
238
+ chainId?: number;
239
+ verifyingContract?: `0x${string}`;
240
+ salt?: `0x${string}`;
241
+ }
242
+ /**
243
+ * EIP712 Type definition
244
+ */
245
+ interface TypedDataField {
246
+ name: string;
247
+ type: string;
248
+ }
249
+ /**
250
+ * Parameters for signing typed data (EIP712)
251
+ */
252
+ interface SignTypedDataParams {
253
+ domain: TypedDataDomain;
254
+ types: Record<string, TypedDataField[]>;
255
+ primaryType: string;
256
+ message: Record<string, any>;
257
+ }
258
+ /**
259
+ * Sign typed data according to EIP712 standard.
260
+ * This method computes the EIP712 hash and signs it using MPC.
261
+ *
262
+ * @param session - Account session with signing credentials
263
+ * @param params - EIP712 typed data parameters (domain, types, primaryType, message)
264
+ * @returns Hex-encoded signature
265
+ *
266
+ * @example
267
+ * ```typescript
268
+ * const signature = await signTypedData(session, {
269
+ * domain: {
270
+ * name: 'MyApp',
271
+ * version: '1',
272
+ * chainId: 994,
273
+ * verifyingContract: '0x...'
274
+ * },
275
+ * types: {
276
+ * Order: [
277
+ * { name: 'tokenIds', type: 'uint256[]' },
278
+ * { name: 'price', type: 'uint256' },
279
+ * { name: 'deadline', type: 'uint256' }
280
+ * ]
281
+ * },
282
+ * primaryType: 'Order',
283
+ * message: {
284
+ * tokenIds: [1n, 2n, 3n],
285
+ * price: 1000000000000000000n,
286
+ * deadline: 1735689600n
287
+ * }
288
+ * });
289
+ * ```
290
+ */
291
+ declare function signTypedData(session: AccountSession$1, params: SignTypedDataParams): Promise<`0x${string}`>;
232
292
 
233
293
  type AccountSession = AccountSession$1;
234
294
  interface SessionState {
@@ -901,4 +961,4 @@ interface WalletReadyStatus {
901
961
  timestamp: number;
902
962
  }
903
963
 
904
- export { type AccountSession$1 as AccountSession, Address, type AddressProps, type Asset, ConnectWalletButton, type ConnectWalletButtonProps, Hash, type HashProps, KeyshareBackup, LUMIA_EXPLORER_URL, LumiaLogo, type LumiaPassportCallbacks, type LumiaPassportConfig, LumiaPassportProvider, type LumiaPassportProviderProps, LumiaPassportSessionProvider, type LumiaPassportSessionProviderProps, LumiaRainbowKitProvider, type LumiaRainbowKitProviderProps, LumiaSessionProvider, type LumiaSessionProviderProps, LumiaWagmiProvider, type ProviderDetail, type SendTransactionParams, type SendTransactionResult, type Theme, ThemeToggle, type TokenBalance, type Transaction, TransactionsList, type UpdateProfileRequest, type UseSendTransactionReturn, type UseUserOpStatusOptions, type UseUserOpStatusReturn, type UserOpMempool, type UserOpReceipt, type SendTransactionParams$1 as UserOpSendTransactionParams, type UserOpState, UserOpStatus, type UserOpStatusProps, type UserOperation, type UserProfile, type WalletReadyStatus, getUserProfile, lumiaBeam, prepareUserOperation, queryClient, sendUserOperation, updateUserProfile, useAssets, useLumiaPassportConfig, useLumiaPassportLinkedProfiles, useLumiaPassportSession, useLumiaSession, useSendTransaction, useSmartAccountTransactions, useTheme, useTokenBalance, useTokenInfo, useTransactions, useUserOpStatus, wagmiConfig };
964
+ export { type AccountSession$1 as AccountSession, Address, type AddressProps, type Asset, ConnectWalletButton, type ConnectWalletButtonProps, Hash, type HashProps, KeyshareBackup, LUMIA_EXPLORER_URL, LumiaLogo, type LumiaPassportCallbacks, type LumiaPassportConfig, LumiaPassportProvider, type LumiaPassportProviderProps, LumiaPassportSessionProvider, type LumiaPassportSessionProviderProps, LumiaRainbowKitProvider, type LumiaRainbowKitProviderProps, LumiaSessionProvider, type LumiaSessionProviderProps, LumiaWagmiProvider, type ProviderDetail, type SendTransactionParams, type SendTransactionResult, type SignTypedDataParams, type Theme, ThemeToggle, type TokenBalance, type Transaction, TransactionsList, type TypedDataDomain, type TypedDataField, type UpdateProfileRequest, type UseSendTransactionReturn, type UseUserOpStatusOptions, type UseUserOpStatusReturn, type UserOpMempool, type UserOpReceipt, type SendTransactionParams$1 as UserOpSendTransactionParams, type UserOpState, UserOpStatus, type UserOpStatusProps, type UserOperation, type UserProfile, type WalletReadyStatus, getUserProfile, lumiaBeam, prepareUserOperation, queryClient, sendUserOperation, signTypedData, updateUserProfile, useAssets, useLumiaPassportConfig, useLumiaPassportLinkedProfiles, useLumiaPassportSession, useLumiaSession, useSendTransaction, useSmartAccountTransactions, useTheme, useTokenBalance, useTokenInfo, useTransactions, useUserOpStatus, wagmiConfig };
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
  );
@@ -794,7 +798,7 @@ async function signDigestWithMpc(userId, digest32, userOpDetails) {
794
798
  }
795
799
  const transaction = {
796
800
  to: userOpDetails?.callTarget || "0x0000000000000000000000000000000000000000",
797
- value: "0",
801
+ value: userOpDetails?.value || "0",
798
802
  data: userOpDetails?.callData || "0x",
799
803
  digest32,
800
804
  // Pre-computed digest - DO NOT recompute!
@@ -820,6 +824,47 @@ async function signDigestWithMpc(userId, digest32, userOpDetails) {
820
824
  return null;
821
825
  }
822
826
  }
827
+ async function signTypedDataWithMpc(userId, digest32, typedData) {
828
+ const startTime = performance.now();
829
+ currentSigningStats = {
830
+ startTime,
831
+ rounds: []
832
+ };
833
+ try {
834
+ console.log("[signTypedDataWithMpc] Starting EIP712 signature request:", {
835
+ userId,
836
+ primaryType: typedData?.primaryType,
837
+ digest32
838
+ });
839
+ const iframeManager = getIframeManager();
840
+ const { jwtTokenManager: jwtTokenManager3 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
841
+ const accessToken = jwtTokenManager3.getAccessToken();
842
+ if (!accessToken) {
843
+ console.error("[signTypedDataWithMpc] No access token available");
844
+ throw new Error("No access token available for signing");
845
+ }
846
+ console.log("[signTypedDataWithMpc] Calling iframeManager.signTypedData...");
847
+ const signature = await iframeManager.signTypedData(userId, typedData, digest32, accessToken);
848
+ console.log("[signTypedDataWithMpc] Signature received:", signature);
849
+ const endTime = performance.now();
850
+ currentSigningStats.endTime = endTime;
851
+ currentSigningStats.totalDurationMs = endTime - startTime;
852
+ return signature;
853
+ } catch (error) {
854
+ console.error("[signTypedDataWithMpc] Error occurred:", error);
855
+ logSdkError(
856
+ error instanceof Error ? error : new Error("EIP712 MPC signing failed"),
857
+ { userId, primaryType: typedData?.primaryType },
858
+ "iframe-mpc"
859
+ );
860
+ const endTime = performance.now();
861
+ if (currentSigningStats) {
862
+ currentSigningStats.endTime = endTime;
863
+ currentSigningStats.totalDurationMs = endTime - startTime;
864
+ }
865
+ return null;
866
+ }
867
+ }
823
868
  async function checkKeyshare(userId) {
824
869
  try {
825
870
  const iframeManager = getIframeManager();
@@ -872,7 +917,9 @@ var init_httpClient = __esm({
872
917
  }
873
918
  const requestConfig = {
874
919
  method,
875
- headers: requestHeaders
920
+ headers: requestHeaders,
921
+ credentials: "include"
922
+ // Enable cookies for cross-origin requests
876
923
  };
877
924
  if (body && method !== "GET") {
878
925
  requestConfig.body = typeof body === "string" ? body : JSON.stringify(body);
@@ -1133,7 +1180,8 @@ var init_cloudStorage = __esm({
1133
1180
  const searchResponse = await fetch(
1134
1181
  `https://www.googleapis.com/drive/v3/files?q=name='${folderName}' and mimeType='application/vnd.google-apps.folder' and trashed=false`,
1135
1182
  {
1136
- headers: { Authorization: `Bearer ${this.accessToken}` }
1183
+ headers: { Authorization: `Bearer ${this.accessToken}` },
1184
+ credentials: "include"
1137
1185
  }
1138
1186
  );
1139
1187
  if (!searchResponse.ok) {
@@ -1149,6 +1197,7 @@ var init_cloudStorage = __esm({
1149
1197
  Authorization: `Bearer ${this.accessToken}`,
1150
1198
  "Content-Type": "application/json"
1151
1199
  },
1200
+ credentials: "include",
1152
1201
  body: JSON.stringify({
1153
1202
  name: folderName,
1154
1203
  mimeType: "application/vnd.google-apps.folder"
@@ -1171,6 +1220,7 @@ var init_cloudStorage = __esm({
1171
1220
  headers: {
1172
1221
  Authorization: `Bearer ${this.accessToken}`
1173
1222
  },
1223
+ credentials: "include",
1174
1224
  body: form
1175
1225
  }
1176
1226
  );
@@ -1255,7 +1305,7 @@ async function getShareVaultToken(scopes) {
1255
1305
  async function getShareRecoveryStats() {
1256
1306
  try {
1257
1307
  const token = await getShareVaultToken(["share:get"]);
1258
- 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" });
1259
1309
  if (response.status === 404) return null;
1260
1310
  if (!response.ok) return null;
1261
1311
  return await response.json();
@@ -1265,26 +1315,26 @@ async function getShareRecoveryStats() {
1265
1315
  }
1266
1316
  async function getShare() {
1267
1317
  const token = await getShareVaultToken(["share:get"]);
1268
- 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" });
1269
1319
  if (response.status === 404) return null;
1270
1320
  if (!response.ok) throw new Error(`Failed to fetch share: ${response.status} ${response.statusText}`);
1271
1321
  return await response.json();
1272
1322
  }
1273
1323
  async function uploadShare(share, idempotencyKey) {
1274
1324
  const token = await getShareVaultToken(["share:put"]);
1275
- 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) });
1276
1326
  if (!response.ok) throw new Error(`Failed to upload share: ${response.status} ${response.statusText}`);
1277
1327
  return await response.json();
1278
1328
  }
1279
1329
  async function rewrapShare(payload, idempotencyKey) {
1280
1330
  const token = await getShareVaultToken(["share:rewrap"]);
1281
- 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) });
1282
1332
  if (!response.ok) throw new Error(`Failed to rewrap share: ${response.status} ${response.statusText}`);
1283
1333
  return await response.json();
1284
1334
  }
1285
1335
  async function deleteShare() {
1286
1336
  const token = await getShareVaultToken(["share:delete"]);
1287
- 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" });
1288
1338
  if (!response.ok && response.status !== 404) throw new Error(`Failed to delete share: ${response.status} ${response.statusText}`);
1289
1339
  }
1290
1340
  async function deriveKEKFromPasskey(userId, requiredCredentialId) {
@@ -1461,7 +1511,7 @@ function clearBackupStatus(userId) {
1461
1511
  async function checkServerBackupAvailability() {
1462
1512
  try {
1463
1513
  const token = await getShareVaultToken(["share:get"]);
1464
- 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" });
1465
1515
  if (response.status === 404) return { hasBackup: false, serviceAvailable: true };
1466
1516
  if (!response.ok) return { hasBackup: false, serviceAvailable: false };
1467
1517
  return { hasBackup: true, serviceAvailable: true };
@@ -1471,14 +1521,14 @@ async function checkServerBackupAvailability() {
1471
1521
  }
1472
1522
  async function uploadShareToVault(envelope, token) {
1473
1523
  const idempotencyKey = crypto.randomUUID ? crypto.randomUUID() : `backup-${Date.now()}`;
1474
- 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) });
1475
1525
  if (!response.ok) {
1476
1526
  const errorText = await response.text();
1477
1527
  throw new Error(`Failed to upload share: ${response.status} ${response.statusText} - ${errorText}`);
1478
1528
  }
1479
1529
  }
1480
1530
  async function downloadShareFromVault(token) {
1481
- 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" });
1482
1532
  if (!response.ok) {
1483
1533
  if (response.status === 404) throw new Error("No backup found on server for this user");
1484
1534
  const errorText = await response.text();
@@ -2727,6 +2777,32 @@ var init_iframe_manager = __esm({
2727
2777
  }
2728
2778
  throw new Error("Transaction signing failed");
2729
2779
  }
2780
+ /**
2781
+ * Sign EIP712 typed data
2782
+ */
2783
+ async signTypedData(userId, typedData, digest32, accessToken) {
2784
+ console.log("[IframeManager] signTypedData: Sending SIGN_TYPED_DATA message", {
2785
+ userId,
2786
+ primaryType: typedData.primaryType,
2787
+ digest32
2788
+ });
2789
+ const response = await this.sendMessage("SIGN_TYPED_DATA", {
2790
+ userId,
2791
+ projectId: this.projectId,
2792
+ typedData,
2793
+ digest32,
2794
+ accessToken
2795
+ // Pass access token for TSS API authentication
2796
+ });
2797
+ console.log("[IframeManager] signTypedData: Response received", {
2798
+ type: response.type,
2799
+ hasSignature: !!response.signature
2800
+ });
2801
+ if (response.type === "LUMIA_PASSPORT_EIP712_SIGNATURE") {
2802
+ return response.signature;
2803
+ }
2804
+ throw new Error("EIP712 signing failed");
2805
+ }
2730
2806
  /**
2731
2807
  * Get user's wallet address
2732
2808
  */
@@ -4298,6 +4374,7 @@ var init_AuthModal = __esm({
4298
4374
  headers: {
4299
4375
  "Content-Type": "application/json"
4300
4376
  },
4377
+ credentials: "include",
4301
4378
  body: JSON.stringify({
4302
4379
  email,
4303
4380
  purpose: "login"
@@ -4415,6 +4492,7 @@ var init_AuthModal = __esm({
4415
4492
  headers: {
4416
4493
  "Content-Type": "application/json"
4417
4494
  },
4495
+ credentials: "include",
4418
4496
  body: JSON.stringify({
4419
4497
  email,
4420
4498
  purpose: "login"
@@ -5001,7 +5079,7 @@ var init_akHelpers = __esm({
5001
5079
  });
5002
5080
 
5003
5081
  // src/internal/clients/account.ts
5004
- import { parseEther, encodeFunctionData, createWalletClient, http as http3 } from "viem";
5082
+ import { parseEther, encodeFunctionData, createWalletClient, http as http3, hashTypedData } from "viem";
5005
5083
  import { entryPoint07Abi } from "viem/account-abstraction";
5006
5084
  import { privateKeyToAccount } from "viem/accounts";
5007
5085
  import {
@@ -5248,8 +5326,10 @@ async function sendUserOperation(session, callTarget, amountWei, innerData = "0x
5248
5326
  paymaster: userOp.paymaster,
5249
5327
  factory: userOp.factory,
5250
5328
  factoryData: userOp.factoryData,
5251
- callTarget
5329
+ callTarget,
5252
5330
  // Add callTarget so iframe can display "To" address
5331
+ value: amountWei
5332
+ // Add value so iframe can display transaction amount
5253
5333
  });
5254
5334
  if (!mpcSig) throw new Error("MPC signing failed");
5255
5335
  signature = mpcSig;
@@ -5498,6 +5578,61 @@ async function getEntryPointDeposit(address, entryPointVersion = "v0.7") {
5498
5578
  const depositAbi = [{ type: "function", name: "balanceOf", stateMutability: "view", inputs: [{ name: "account", type: "address" }], outputs: [{ name: "", type: "uint256" }] }];
5499
5579
  return await publicClient.readContract({ address: entryPointAddress, abi: depositAbi, functionName: "balanceOf", args: [address] });
5500
5580
  }
5581
+ async function signTypedData(session, params) {
5582
+ const { domain, types, primaryType, message } = params;
5583
+ const digest = hashTypedData({
5584
+ domain,
5585
+ types,
5586
+ primaryType,
5587
+ message
5588
+ });
5589
+ const serializeForIframe = (obj) => {
5590
+ if (typeof obj === "bigint") {
5591
+ return obj.toString();
5592
+ }
5593
+ if (Array.isArray(obj)) {
5594
+ return obj.map(serializeForIframe);
5595
+ }
5596
+ if (obj !== null && typeof obj === "object") {
5597
+ const result = {};
5598
+ for (const key in obj) {
5599
+ result[key] = serializeForIframe(obj[key]);
5600
+ }
5601
+ return result;
5602
+ }
5603
+ return obj;
5604
+ };
5605
+ let signature;
5606
+ if (session.mpcUserId) {
5607
+ const mpcSig = await signTypedDataWithMpc(
5608
+ session.mpcUserId,
5609
+ digest,
5610
+ {
5611
+ domain: {
5612
+ name: domain.name,
5613
+ version: domain.version,
5614
+ chainId: domain.chainId,
5615
+ verifyingContract: domain.verifyingContract,
5616
+ salt: domain.salt
5617
+ },
5618
+ types,
5619
+ primaryType,
5620
+ message: serializeForIframe(message)
5621
+ }
5622
+ );
5623
+ if (!mpcSig) {
5624
+ throw new Error("MPC signing failed");
5625
+ }
5626
+ signature = mpcSig;
5627
+ } else if (session.ownerPrivateKey) {
5628
+ const account = privateKeyToAccount(session.ownerPrivateKey);
5629
+ const rawSig = await account.sign({ hash: digest });
5630
+ signature = normalizeSignature(rawSig);
5631
+ } else {
5632
+ throw new Error("No signing method available");
5633
+ }
5634
+ return signature;
5635
+ }
5501
5636
  var PAYMASTER_VERIFICATION_GAS_LIMIT, PAYMASTER_POSTOP_GAS_LIMIT, MAX_BUNDLER_VERIFICATION_GAS, PAYMASTER_VERIFICATION_GAS, executeAbi;
5502
5637
  var init_account = __esm({
5503
5638
  "src/internal/clients/account.ts"() {
@@ -5590,6 +5725,7 @@ __export(clients_exports, {
5590
5725
  sendDemoUserOp: () => sendDemoUserOp,
5591
5726
  sendLumiaUserOp: () => sendLumiaUserOp,
5592
5727
  sendUserOperation: () => sendUserOperation,
5728
+ signTypedData: () => signTypedData,
5593
5729
  viemBundlerClient: () => viemBundlerClient
5594
5730
  });
5595
5731
  var init_clients = __esm({
@@ -7096,7 +7232,7 @@ var TransactionsModal = ({ open, onOpenChange, onBack }) => {
7096
7232
  const explorerUrl = getExplorerUrl();
7097
7233
  const baseUrl = explorerUrl.replace(/\/$/, "");
7098
7234
  const apiUrl = `${baseUrl}/api/v2/addresses/${address}/transactions?items_count=20`;
7099
- const response = await fetch(apiUrl);
7235
+ const response = await fetch(apiUrl, { credentials: "include" });
7100
7236
  if (!response.ok) {
7101
7237
  throw new Error(`Failed to fetch transactions: ${response.status}`);
7102
7238
  }
@@ -7743,6 +7879,7 @@ var UserOpStatus = ({
7743
7879
  const res = await fetch(getBundlerUrl(), {
7744
7880
  method: "POST",
7745
7881
  headers: { "content-type": "application/json" },
7882
+ credentials: "include",
7746
7883
  body: JSON.stringify(body)
7747
7884
  });
7748
7885
  const json = await res.json();
@@ -8508,7 +8645,7 @@ function useLumiaPassportLinkedProfiles() {
8508
8645
  // package.json
8509
8646
  var package_default = {
8510
8647
  name: "@lumiapassport/ui-kit",
8511
- version: "1.6.3",
8648
+ version: "1.8.0",
8512
8649
  description: "React UI components and hooks for Lumia Passport authentication and Account Abstraction",
8513
8650
  type: "module",
8514
8651
  main: "./dist/index.cjs",
@@ -9626,7 +9763,7 @@ var TransactionsList = ({
9626
9763
  const baseUrl = explorerUrl.replace(/\/$/, "");
9627
9764
  const apiUrl = `${baseUrl}/api/v2/addresses/${address}/transactions?items_count=${itemsCount}`;
9628
9765
  console.log("[TransactionsList] Fetching from:", apiUrl);
9629
- const response = await fetch(apiUrl);
9766
+ const response = await fetch(apiUrl, { credentials: "include" });
9630
9767
  if (!response.ok) {
9631
9768
  throw new Error(`Failed to fetch transactions: ${response.status}`);
9632
9769
  }
@@ -9770,6 +9907,7 @@ function useUserOpStatus(options = {}) {
9770
9907
  const res = await fetch(getBundlerUrl(), {
9771
9908
  method: "POST",
9772
9909
  headers: { "content-type": "application/json" },
9910
+ credentials: "include",
9773
9911
  body: JSON.stringify(body)
9774
9912
  });
9775
9913
  const json = await res.json();
@@ -10076,6 +10214,7 @@ export {
10076
10214
  prepareUserOperation,
10077
10215
  queryClient,
10078
10216
  sendUserOperation,
10217
+ signTypedData,
10079
10218
  updateUserProfile,
10080
10219
  useAssets,
10081
10220
  useLumiaPassportConfig,