Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
chrome-nfc
Advanced tools
Readme
With this simple library, you can build a Chrome App that communicates over USB with NFC Readers.
ACR122U | SCL3711 |
---|---|
Developer Mode
in chrome://extensions
chrome://extensions
and select the sample folder.Learn more about USB Devices Caveats at https://developer.chrome.com/apps/app_usb#caveats
Once you've imported the chrome-nfc.js javascript library into your Chrome App, you need to add the permissions below to your manifest file:
"permissions": [
"usb",
{
"usbDevices": [
{ "vendorId": 1254, "productId": 21905 }, // SCL3711
{ "vendorId": 1839, "productId": 8704 } // ACR122U
]
}
]
chrome.nfc.findDevices(function(devices) {
console.log("Found " + devices.length + " NFC device(s)");
for (var i = 0; i < devices.length; i++) {
var device = devices[i];
console.log(device.vendorId, device.productId);
}
});
chrome.nfc.findDevices(function(devices) {
var device = devices[0];
chrome.nfc.read(device, {}, function(type, ndef) {
console.lof(ndef);
var uri = ndef.ndef[0]["uri"];
console.log(uri);
var text = ndef.ndef[1]["text"];
console.log(text);
});
});
chrome.nfc.findDevices(function(devices) {
var device = devices[0];
var ndef = [
{"text": "Chromium.org website" },
{"uri": "http://chromium.org" },
{"aar": "com.google.samples.apps.iosched" },
];
chrome.nfc.write(device, {"ndef": ndef}, function(rc) {
if (!rc) {
console.log("WRITE() success!");
} else {
console.log("WRITE() FAILED, rc = " + rc);
}
});
});
chrome.nfc.findDevices(function(devices) {
var device = devices[0];
var ndef = [
{"type": "URI", "uri": "http://chromium.org"}
];
chrome.nfc.emulate_tag(device, {"ndef": ndef}, function(rc) {
if (!rc) {
console.log("EMULATE() success!");
} else {
console.log("EMULATE() FAILED, rc = " + rc);
}
});
});
chrome.nfc.findDevices(function(devices) {
var device = devices[0];
chrome.nfc.read_logic(device, 0, 2, function(rc, data) {
console.log(UTIL_BytesToHex(data));
});
});
chrome.nfc.findDevices(function(devices) {
var device = devices[0];
var data = new Uint8Array([ // NDEF(http://google.com)
0xdb, 0x00, 0x03, 0xe1, 0x00, 0x00, 0x00, 0x00, // block 0 (MAD1)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // block 1 (MAD1)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x0f, 0xd1, 0x01, 0x0b, 0x55, 0x03, 0x67, // block 2 (NDEF)
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f,
0x6d, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // block 3 (NDEF)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]);
chrome.nfc.write_logic(device, 0, data, function(rc) {
console.log("WRITE_LOGIC() SUCCESS");
});
});
Compiling script requires Python 3.0 and will use online Closure Compiler. Just run
python3 compile.py
and the library will be written to chrome-nfc.js
.
FAQs
Chrome App NFC Library
The npm package chrome-nfc receives a total of 1 weekly downloads. As such, chrome-nfc popularity was classified as not popular.
We found that chrome-nfc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.