fixes imports

This commit is contained in:
nrobi144
2026-01-01 07:55:31 +02:00
parent 3750c7e26e
commit 4bc7e86448
14 changed files with 125 additions and 70 deletions
@@ -0,0 +1,31 @@
/**
* Copyright (c) 2025 Vitor Pamplona
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
* Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.vitorpamplona.quartz.nip57Zaps
/**
* Interface for private zap decryption cache.
* Used by Note.kt for checking private zap status.
*/
interface IPrivateZapsDecryptionCache {
fun cachedPrivateZap(event: LnZapRequestEvent): LnZapPrivateEvent?
suspend fun decryptPrivateZap(event: LnZapRequestEvent): LnZapPrivateEvent?
}
@@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.caches.DecryptCache
class PrivateZapCache(
signer: NostrSigner,
) {
) : IPrivateZapsDecryptionCache {
private val decryptionCache =
object : LruCache<LnZapRequestEvent, PrivateZapDecryptCache>(1000) {
override fun create(key: LnZapRequestEvent): PrivateZapDecryptCache? {
@@ -43,9 +43,9 @@ class PrivateZapCache(
decryptionCache.remove(event)
}
fun cachedPrivateZap(event: LnZapRequestEvent): LnZapPrivateEvent? = decryptionCache[event]?.cached()
override fun cachedPrivateZap(event: LnZapRequestEvent): LnZapPrivateEvent? = decryptionCache[event]?.cached()
suspend fun decryptPrivateZap(event: LnZapRequestEvent) = decryptionCache[event]?.decrypt(event)
override suspend fun decryptPrivateZap(event: LnZapRequestEvent) = decryptionCache[event]?.decrypt(event)
}
class PrivateZapDecryptCache(