Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] NFC support #13

Open
rolznz opened this issue May 27, 2024 · 13 comments · May be fixed by #183
Open

[Feature Request] NFC support #13

rolznz opened this issue May 27, 2024 · 13 comments · May be fixed by #183

Comments

@rolznz
Copy link
Contributor

rolznz commented May 27, 2024

Not sure this is easy to do with expo?

@reneaaron
Copy link
Contributor

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

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

@calganaygun
Copy link

calganaygun commented Oct 30, 2024

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:

  • Using lightning invoices within a URI schema, we can directly trigger the wallet app on the payer’s phone.
  • I implemented “lightning:INVOICE” and emulated it as an NFC Tag Type 4 URL card.
  • In testing, my payer’s phone successfully read the tag and opened the Wallet of Satoshi, which currently appears to be the only URI handler for the lightning URI schema, not Go.

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
Copy link
Contributor Author

rolznz commented Oct 31, 2024

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
Copy link

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
Copy link
Contributor Author

rolznz commented Oct 31, 2024

@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
Copy link
Contributor

@calganaygun Awesome, looking forward to your PR! 💪

@calganaygun
Copy link

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

@rolznz
Copy link
Contributor Author

rolznz commented Nov 6, 2024

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
Copy link

@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
Copy link
Contributor Author

rolznz commented Nov 6, 2024

@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
Copy link

calganaygun commented Nov 6, 2024

@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
Copy link

calganaygun commented Nov 6, 2024

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
Copy link
Contributor Author

rolznz commented Nov 6, 2024

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

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

@im-adithya im-adithya linked a pull request Dec 27, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants