getAlby / go

Alby Go - The easiest mobile app to use bitcoin on the Go and that works great with Alby Hub.
https://albygo.com
35 stars 4 forks source link

[Feature Request] NFC support #13

Open rolznz opened 6 months ago

rolznz commented 6 months ago

Not sure this is easy to do with expo?

reneaaron commented 3 months ago

Let's try to recreate this experience with Lightning: :100:

https://x.com/iam_chonchol/status/1825201712921194786

calganaygun commented 1 month ago

I successfully added NFC functionality on Android by integrating the HCE library and implementing NDEF messages. The library has a minor bug, which can be resolved with a simple Java code adjustment. This functionality enables invoice requests to be sent from the host phone to the payer’s phone. Here are the main points:

If you proceed with tag emulation, Alby Go would also need to handle its own/or the standard URI schema. However, this solution isn’t cross-platform, as iOS doesn’t support NFC tag emulation at this time, as my knowledge. (Probably can read by can't emulate)

If Alby Go can support the lightning URI schema, I am open to contributing this NFC functionality. What are your thoughts on adding this type of support?

rolznz commented 4 weeks ago

Hi @calganaygun , we already support the lightning URI schema.

But this would need to be implemented through expo/react native. It seems like support was added to do it in expo, just maybe not possible to test in expo go (not sure if this is still the case)? (https://expo.canny.io/feature-requests/p/nfc)

calganaygun commented 4 weeks ago

Hi @calganaygun , we already support the lightning URI schema.

@rolznz Oh my bad, yes it looks like the URI schema is already implemented. (Somehow WoS made itself default). So, I can open a PR in a few days with the NFC HCE implementation.

Already wrote the implementation, working just fine. Just wanted to make the calls and emulation robust, Before the PR :)

Btw, I am not using Expo Go. Since, NFC needs more native needs switched to development builds :)

rolznz commented 4 weeks ago

@calganaygun great! as long as it uses the native libraries so we do not need to eject. I don't think we want to eject from Expo as this increases the complexity significantly

reneaaron commented 4 weeks ago

@calganaygun Awesome, looking forward to your PR! :muscle:

calganaygun commented 4 weeks ago

⚡ First sats received via NFC in Go (from go to go)! Gonna open a draft PR tomorrow!

rolznz commented 3 weeks ago

Would it be good to add iOS support as well even if it's less capable (e.g. receiving payments only) like it does with WoS? but this would be a completely different implementation?

calganaygun commented 3 weeks ago

@rolznz Receiving or sending? I am emulating an lightning URL via NDEF tag standart. So, Android can broadcast any URL to the near device. lightning:INVOICE (or address) broadcasted now, and the receiver (iOS in this case) can get this invoice info and pay it. But can't broadcast itself lightning address or any invoice. So, iOS can send sats to nearby Android device. But, It can't receive in this implementation.

rolznz commented 3 weeks ago

@calganaygun ah. In WoS on iOS, it's the opposite as far as I know - it can receive payments via NFC, but not send them (I need to double check this).

calganaygun commented 3 weeks ago

@rolznz Update from my side: LNURL-withdraw vouchers can probably accomplish this. So, an android device can share withdraw voucher to the iOS. And, iOS can receive this voucher. Is it currently supported by the Go to create a voucher?

Or something like an additional service to claim sats from the holder. For example Bolt service WoS supports it.

calganaygun commented 3 weeks ago

If Alby supports/creates a service like this, it can be used to create passive NFC cards too. Like a debit card. (I think very accomplishable via NWC, an NWC connection can be stored in a card.)

For example a card with 1 year validity (exp. time for the debit cards). And monthly budget with 10k sats (like a virtual card budget). With the example scope:

image

The PoS app will read the NWC connection from the card, and send the amount to the PoS account.

rolznz commented 3 weeks ago

@calganaygun we are working on an NWC based LNURL server: https://github.com/getAlby/lite

This could possibly support bolt cards, one day (we need to deploy it properly first) :rocket:

But my main concern was just that we have something for both Android and iOS (rather than only Android). But maybe Android only is a first step? CC @reneaaron