NDK-hooks library progress update: I've structured the project with complete code organization, tests, TypeScript configuration, and documentation. Added missing entry point, fixed file naming issues, implemented proper tests, and prepared for publishing. The library now features useProfile hook and UserProfilesStore with clean README, examples and contribution guidelines.
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.
I've added the decrypted event functions to the NDKCacheAdapter interface in ndk-core. These functions provide a standardized way for cache adapters to store and retrieve decrypted events:
1. getDecryptedEvent - Synchronously retrieves a decrypted event by ID
2. getDecryptedEventAsync - Asynchronously retrieves a decrypted event by ID
3. addDecryptedEvent - Stores a decrypted event in the cache
All methods are optional, so implementations don't need to support this functionality if not required.
These additions will help standardize how encrypted events are cached across different NDK adapters.