From 52f17e9f46af5a65b0b3f2c5074924d828df1f14 Mon Sep 17 00:00:00 2001 From: greenart7c3 Date: Wed, 13 Sep 2023 16:23:56 -0300 Subject: [PATCH] nwc support with amber --- .../main/java/com/vitorpamplona/amethyst/model/Account.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/model/Account.kt b/app/src/main/java/com/vitorpamplona/amethyst/model/Account.kt index 8e5c609b3..5239998bc 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/model/Account.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/model/Account.kt @@ -526,16 +526,18 @@ class Account( } fun sendZapPaymentRequestFor(bolt11: String, zappedNote: Note?, onResponse: (Response?) -> Unit) { - if (!isWriteable()) return + if (!isWriteable() && !loginWithAmber) return zapPaymentRequest?.let { nip47 -> - val event = LnZapPaymentRequestEvent.create(bolt11, nip47.pubKeyHex, nip47.secret?.hexToByteArray() ?: keyPair.privKey!!) + val privateKey = if (loginWithAmber) nip47.secret?.hexToByteArray() else nip47.secret?.hexToByteArray() ?: keyPair.privKey + if (privateKey == null) return + val event = LnZapPaymentRequestEvent.create(bolt11, nip47.pubKeyHex, privateKey) val wcListener = NostrLnZapPaymentResponseDataSource( fromServiceHex = nip47.pubKeyHex, toUserHex = event.pubKey, replyingToHex = event.id, - authSigningKey = nip47.secret?.hexToByteArray() ?: keyPair.privKey!! + authSigningKey = privateKey ) wcListener.start()