Skip to content

Commit

Permalink
Add a log with the bunker response
Browse files Browse the repository at this point in the history
  • Loading branch information
greenart7c3 committed Jan 24, 2025
1 parent 8148139 commit ed41aa2
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.compose.runtime.mutableStateOf
import com.fasterxml.jackson.databind.ObjectMapper
import com.greenart7c3.nostrsigner.LocalPreferences
import com.greenart7c3.nostrsigner.NostrSigner
import com.greenart7c3.nostrsigner.database.LogEntity
import com.greenart7c3.nostrsigner.models.Account
import com.greenart7c3.nostrsigner.models.BunkerRequest
import com.greenart7c3.nostrsigner.models.BunkerResponse
Expand Down Expand Up @@ -71,6 +72,20 @@ object BunkerRequestUtils {
AmberListenerSingleton.getListener()!!,
)

NostrSigner.getInstance().applicationIOScope.launch {
relays.forEach { relay ->
NostrSigner.getInstance().getDatabase(account.signer.keyPair.pubKey.toNpub()).applicationDao().insertLog(
LogEntity(
id = 0,
url = relay.url,
type = "bunker response",
message = ObjectMapper().writeValueAsString(bunkerResponse),
time = System.currentTimeMillis(),
),
)
}
}

when (bunkerRequest.encryptionType) {
EncryptionType.NIP04 -> {
account.signer.nip04Encrypt(
Expand Down

0 comments on commit ed41aa2

Please sign in to comment.