Skip to content

Commit a2efcb2

Browse files
committed
fix: remove decryption for non encrypted requests, whenchanging the wallets, share svg smaller
1 parent ca8c8e2 commit a2efcb2

File tree

2 files changed

+32
-7
lines changed

2 files changed

+32
-7
lines changed

packages/single-invoice/src/lib/single-invoice.svelte

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,10 @@
229229
const testRequest = await requestNetwork?.fromRequestId(requestId);
230230
const data = testRequest?.getData();
231231
232-
// Check if the request has encrypted data
232+
// Check both extensions and transactions for encrypted data
233233
const hasEncryptedData = data?.extensionsData?.some(
234234
(ext: any) => ext.value?.encryptedData
235235
);
236-
237-
// Also check transactions for encryption
238236
const hasEncryptedTransactions = data?.transactions?.some(
239237
(tx: any) => tx.transaction?.encryptedData
240238
);
@@ -245,6 +243,7 @@
245243
if (String(error).includes("Decryption is not available")) {
246244
return true;
247245
}
246+
// For other errors, assume not encrypted
248247
console.log("Error checking encryption status:", error);
249248
return false;
250249
}
@@ -478,6 +477,17 @@
478477
localStorage.removeItem("lit-wallet-sig");
479478
}
480479
480+
// Only attempt decryption setup if needed
481+
if (isDecryptionEnabled && requestId) {
482+
const isEncrypted = await isRequestEncrypted(requestId);
483+
if (isEncrypted) {
484+
await ensureDecryption();
485+
} else {
486+
// For non-encrypted requests, just disable decryption
487+
cipherProvider?.enableDecryption(false);
488+
}
489+
}
490+
481491
if (requestId && requestNetwork) {
482492
await getOneRequest(requestId);
483493
}
@@ -508,7 +518,22 @@
508518
handleWalletDisconnection();
509519
510520
// Initialize new wallet state
511-
await handleWalletConnection();
521+
account = getAccount(wagmiConfig);
522+
523+
// Only attempt decryption setup if the request is encrypted
524+
if (isDecryptionEnabled && requestId) {
525+
const isEncrypted = await isRequestEncrypted(requestId);
526+
if (isEncrypted) {
527+
await ensureDecryption();
528+
} else {
529+
// For non-encrypted requests, just disable decryption
530+
cipherProvider?.enableDecryption(false);
531+
}
532+
}
533+
534+
if (requestId && requestNetwork) {
535+
await getOneRequest(requestId);
536+
}
512537
} else if (account?.address) {
513538
await handleWalletConnection();
514539
} else {

shared/icons/share.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
</script>
44

55
<svg
6-
width="24"
7-
height="24"
8-
viewBox="0 0 24 24"
6+
width="20"
7+
height="20"
8+
viewBox="0 0 20 20"
99
fill="none"
1010
xmlns="http://www.w3.org/2000/svg"
1111
on:click|stopPropagation={onClick}

0 commit comments

Comments
 (0)