nwc support with amber

pull/543/head
greenart7c3 2023-09-13 16:23:56 -03:00
rodzic 1e7ffa365b
commit 52f17e9f46
1 zmienionych plików z 5 dodań i 3 usunięć

Wyświetl plik

@ -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()