|
265 | 265 | const clearLitStorage = () => { |
266 | 266 | localStorage?.removeItem("lit-wallet-sig"); |
267 | 267 | localStorage?.removeItem("lit-session-key"); |
268 | | - localStorage.setItem("isDecryptionEnabled", "false"); |
| 268 | + localStorage?.setItem("isDecryptionEnabled", "false"); |
269 | 269 | if (cipherProvider) { |
270 | 270 | cipherProvider.enableDecryption(false); |
271 | 271 | } |
272 | | - console.log("Cleared Lit session storage."); |
273 | 272 | }; |
274 | 273 |
|
275 | 274 | onMount(async () => { |
|
331 | 330 | const sessionKey = localStorage.getItem("lit-session-key"); |
332 | 331 | const isEnabled = localStorage.getItem("isDecryptionEnabled") === "true"; |
333 | 332 |
|
334 | | - console.log("walletSig", walletSig); |
335 | | - console.log("sessionKey", sessionKey); |
336 | | - console.log("isEnabled", isEnabled); |
337 | | -
|
338 | 333 | if (walletSig && sessionKey && isEnabled) { |
339 | 334 | try { |
340 | 335 | // Use existing signatures |
341 | 336 | cipherProvider.enableDecryption(true); |
342 | 337 | return true; |
343 | 338 | } catch (error) { |
344 | | - console.error( |
345 | | - "Failed to enable decryption with existing signatures:", |
346 | | - error |
347 | | - ); |
348 | 339 | // Clear invalid signatures |
349 | 340 | localStorage.removeItem("lit-wallet-sig"); |
350 | 341 | localStorage.removeItem("lit-session-key"); |
|
360 | 351 | loading = true; |
361 | 352 | unsupportedNetwork = false; |
362 | 353 |
|
363 | | - // Only attempt decryption setup if needed |
364 | | - console.log("isDecryptionEnabled", isDecryptionEnabled); |
365 | 354 | if (isDecryptionEnabled) { |
366 | 355 | const encrypted = await isRequestEncrypted(requestId); |
367 | | - console.log("encrypted", encrypted); |
368 | 356 | if (encrypted) { |
369 | | - console.log("Ensuring decryption..."); |
370 | 357 | const decryptionReady = await ensureDecryption(); |
371 | | - console.log("decryptionReady", decryptionReady); |
372 | 358 | if (!decryptionReady) { |
373 | 359 | throw new Error("Failed to initialize decryption"); |
374 | 360 | } |
375 | 361 | } else { |
376 | | - // For non-encrypted requests, just disable decryption |
377 | 362 | cipherProvider?.enableDecryption(false); |
378 | 363 | } |
379 | 364 | } |
380 | 365 |
|
381 | 366 | const singleRequest = await requestNetwork?.fromRequestId(requestId); |
382 | | - console.log("singleRequest", singleRequest); |
383 | 367 | if (!singleRequest) { |
384 | | - console.log("No request found"); |
385 | 368 | return; |
386 | 369 | } |
387 | 370 |
|
388 | 371 | request = singleRequest.getData(); |
389 | 372 | if (!request) { |
390 | | - console.log("No request data found"); |
391 | 373 | return; |
392 | 374 | } |
393 | 375 |
|
|
480 | 462 | status = checkStatus(requestData); |
481 | 463 | await checkBalance(); |
482 | 464 | } catch (error) { |
483 | | - console.error("Failed to fetch request:", error); |
484 | 465 | if (String(error).includes("Unsupported payment")) { |
485 | 466 | unsupportedNetwork = true; |
486 | 467 | } else if (String(error).includes("LitNodeClient is not ready")) { |
|
0 commit comments