Skip to content

New version of the Web NFC specification and the Security and Privacy document. #44

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

Merged
merged 5 commits into from
Sep 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 0 additions & 56 deletions idl/draft.idl

This file was deleted.

45 changes: 27 additions & 18 deletions idl/web-nfc.idl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

partial interface Navigator {
readonly attribute NFC nfc;
};
Expand All @@ -6,30 +7,38 @@ interface NFC {
Promise<NFCAdapter> requestAdapter();
};

interface NFCAdapter : EventTarget {
attribute EventHandler onmessage;
Promise<void> send (NFCMessage message, optional NFCSendOptions options);
};
interface NFCAdapter {
Promise<void> pushMessage(NFCMessage message, optional NFCPushOptions options);
void cancelPush();

interface NFCMessageEvent : Event {
readonly attribute NFCMessage message;
Promise<long> watch(NFCWatchOptions options, MessageCallback callback);
Promise<void> unwatch(long id);
};

[NoInterfaceObject]
interface NFCMessage {
readonly attribute USVString scope;
readonly attribute sequence<any> data; // (DOMString or URL or Blob or JSON)
dictionary NFCPushOptions {
NFCDeviceType target;
long timeout; // in ms, default (and max) is 10sec, UAs MAY shorten it
};

typedef (DOMString or URL or Blob or JSON) NFCData;
enum NFCPushTarget { "tag", "peer", "any" };

enum NFCTarget {
"tag",
"peer",
"any"
};
dictionary NFCWatchOptions {
USVString url; // domain/path or URL pattern
USVString kind;
USVString type;
NFCWatchMode mode;
}

dictionary NFCSendOptions {
NFCTarget target;
enum NFCWatchMode { "web-only", "all" };

callback MessageCallback = void (NFCMessage message, USVString url);

dictionary NFCRecord {
NFCRecordType kind; // based on TNF + JSON
USVString type; // IANA media type, with parameters
any data; // null, string (text, url), Object (json), ArrayBuffer
};

typedef sequence<NFCRecord> NFCMessage;

enum NFCRecordType { "empty", "text", "url", "json", "opaque" };
Loading