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

P2P support #529

Closed
kenchris opened this issue Jan 9, 2020 · 12 comments
Closed

P2P support #529

kenchris opened this issue Jan 9, 2020 · 12 comments

Comments

@kenchris
Copy link
Contributor

kenchris commented Jan 9, 2020

Android is deprecating SNEP and thus the current peer to peer support

The Simple NDEF Exchange Protocol (SNEP) is an application-level protocol suitable for sending or retrieving of application data units, in the form of NDEF messages between two NFC Forum Devices operating in NFC Forum Peer Mode

Answer from Android:

However most of the functionality can be provided using the card emulation interface. NFC Forum type 4 tag specification describes a mechanism for NDEF messages exchange

The current P2P support is a one time operation - when read, its done, where as HCE (Host Card Emulation) most probably isn't.

It might be possible to implement the existing peer support using HCE, but actually being able to not cancel on read might also be useful and affect API design.

Thus maybe it makes more sense to add a NDEFTagEmulation object or similar, as a specialization of HCE

@kenchris
Copy link
Contributor Author

kenchris commented Jan 9, 2020

@kenchris
Copy link
Contributor Author

kenchris commented Jan 9, 2020

My friend @justinribeiro has a nice example of how to emulate NDEF tags

https://github.com/justinribeiro/android-hostcardemulation-sample

@kenchris
Copy link
Contributor Author

kenchris commented Jan 9, 2020

HCE is not an NFC Forum thing but can be used for NDEF card emulation:

https://nfc-forum.org/nfc-forum-statement-regarding-host-card-emulation-hce/

It now also makes more sense that the name is so bad (card vs tag in NFC terminology)

@kenchris
Copy link
Contributor Author

kenchris commented Jan 9, 2020

Android supports HCE

  • Support for NFC-B (ISO/IEC 14443-4 Type B) technology is optional
  • Support for NFC-A (ISO/IEC 14443-3 Type A) technology is mandatory
  • Support for NFC-Forum ISO-DEP specification (based on ISO/IEC 14443-4) is mandatory and must be emulated on top of NFC-A.
    • Hence, the emulated tag is a very similar to NFC Forum Type 4, though NFC-B support is optional.
  • Process Application Protocol Data Units (APDUs) (ISO/IEC 7816-4 - smart card)
    • This comes from ISO-DEP which uses ISO/IEC 7816-4 APDU commands
    • This is what allows emulating NDEF

image

@kenchris
Copy link
Contributor Author

kenchris commented Jan 9, 2020

I am trying to understand https://developer.apple.com/documentation/corenfc/nfciso7816tag

I guess that is how it can read HCE emulated tags, but it this just the same as reading NFC Forum Type 4 tags or can it read additional tags?

@cyberphone
Copy link

cyberphone commented Jan 9, 2020

There is a bunch of mobile payment systems out there including AliPay which do not build on low level card protocols like EMV (which is security-wise unsuited for the Web). The systems mentioned are currently stuck with QR both at the Desktop/Web and at the POS terminal. HCE=EMV.

Apple Pay which implements EMV, does not use it over the Web.

@justinribeiro
Copy link

I am trying to understand https://developer.apple.com/documentation/corenfc/nfciso7816tag
I guess that is how it can read HCE emulated tags, but it this just the same as reading NFC Forum Type 4 tags or can it read additional tags?

I haven't yet tried to write an example with that on iOS, but based on my reading of the docs it reads to me like that would be specific to Type4. I'm on the road for the next couple of weeks, but I'll have to test that theory when I get back to office.

@kenchris
Copy link
Contributor Author

kenchris commented Jan 9, 2020

@justinribeiro what is the license of your sample ndef emulation code? Maybe we could base our on that if you are willing to relicense to the Chromium Project

@justinribeiro
Copy link

We can relicense that sample to the Chromium Project, I'm cool with that @kenchris.

@asoltys
Copy link

asoltys commented Jan 23, 2021

Hi, I'm eagerly awaiting some kind of P2P NFC support to land in Chromium so I can use it in a PWA bitcoin wallet app I've made. I made a short video demoing the non-P2P web NFC functionality a few months ago. Is #567 looking like the best hope at this point?

@eklem
Copy link

eklem commented Jan 11, 2022

Hope this actually happens! A nice use-case for peer-to-peer support could be transferring one-time pads between phones for encryption/decryption of messages sent/received on different messaging services.

@kenchris
Copy link
Contributor Author

This is what TNEP is for: #563

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants