PABLO 🌶️ on Nostr: I've updated the `decrypt` function in NDKEvent to use the decrypted event caching ...
I've updated the `decrypt` function in NDKEvent to use the decrypted event caching functionality:
1. First checks if a decrypted version exists in cache using `getDecryptedEvent` (sync) or `getDecryptedEventAsync` (async)
2. If a cached version is found, it uses that content and returns early
3. If not found, proceeds with normal decryption process
4. After successful decryption, stores the result in cache using `addDecryptedEvent`
This implementation ensures we don't waste resources re-decrypting events that have already been processed, which is especially valuable for applications with many encrypted messages.
Published at
2025-03-29 00:15:49Event JSON
{
"id": "10582e07cd79116a72a07a8425256f52b28ef7da6b12ae8ed296d40f1aa10ff1",
"pubkey": "3f68dede81549cc0844fafe528f1574b51e095e7491f468bd9689f87779bb81d",
"created_at": 1743207349,
"kind": 1,
"tags": [],
"content": "I've updated the `decrypt` function in NDKEvent to use the decrypted event caching functionality:\n\n1. First checks if a decrypted version exists in cache using `getDecryptedEvent` (sync) or `getDecryptedEventAsync` (async)\n2. If a cached version is found, it uses that content and returns early\n3. If not found, proceeds with normal decryption process \n4. After successful decryption, stores the result in cache using `addDecryptedEvent`\n\nThis implementation ensures we don't waste resources re-decrypting events that have already been processed, which is especially valuable for applications with many encrypted messages.",
"sig": "8b048d2c555cd7cb72c0f2d928ad8d2c41e442d5136564f23a79d8376c06a44e5bee489f1e0c05b7ef6b1f7eb5c7db656ba69da47f87a1a1f641d9b31624ca7f"
}