community-cordova-plugin-nfc 1.3.0 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,46 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## [1.5.0](https://github.com/EYALIN/community-cordova-plugin-nfc/compare/v1.4.0...v1.5.0) (2026-01-17)
7
+
8
+ ### Features
9
+
10
+ * **Advanced Tag Analysis**: Add premium methods for deep NFC tag analysis
11
+ - `readMemoryPages(startPage, numPages)` - Read raw memory pages from NTAG/MIFARE Ultralight using READ command (0x30)
12
+ - `getNtagVersion()` - Get NTAG version info including IC type and memory size using GET_VERSION command (0x60)
13
+ - `readNtagCounter()` - Read NTAG 24-bit tap counter using READ_CNT command (0x39)
14
+ - `readNtagSignature()` - Read NTAG 32-byte ECC originality signature using READ_SIG command (0x3C)
15
+ - `getPasswordProtectionStatus(configPage)` - Check password protection configuration from config pages
16
+ - `fullMemoryDump()` - Perform complete memory dump with automatic tag type detection
17
+
18
+ * **TypeScript Support**: Add full TypeScript definitions
19
+ - Added `types/index.d.ts` with complete type definitions
20
+ - Interfaces for NDEF records, tags, and advanced analysis results
21
+ - Global declarations for `nfc`, `ndef`, and `util` objects
22
+
23
+ * **Package Improvements**:
24
+ - Updated `package.json` to match community plugin conventions
25
+ - Added `main` and `types` fields for TypeScript support
26
+ - Cleaned up platform list to focus on Android and iOS
27
+
28
+ ### Breaking Changes
29
+
30
+ * Legacy platforms (Windows, BlackBerry) are no longer actively maintained
31
+
32
+ ---
33
+
34
+ ## [1.4.0](https://github.com/EYALIN/community-cordova-plugin-nfc/releases/tag/v1.4.0) (2024-07-19)
35
+
36
+ ### Features
37
+
38
+ * Change Android code to support SDK 34
39
+ * Deprecate `share`, `unshare`, `handover`, `stopHandover` functions
40
+ * Organize and clean up codebase
41
+
42
+ ---
43
+
44
+ ## Previous Versions
45
+
46
+ See the [original phonegap-nfc changelog](https://github.com/chariotsolutions/phonegap-nfc) for earlier version history.
package/README.md CHANGED
@@ -1,9 +1,8 @@
1
1
  [![NPM version](https://img.shields.io/npm/v/community-cordova-plugin-nfc)](https://www.npmjs.com/package/community-cordova-plugin-nfc)
2
2
 
3
- #### This is a fork of the original plugin phonegap-nfc
4
-
5
- # community-cordova-plugin-nfc
3
+ # Community Cordova NFC Plugin
6
4
 
5
+ A comprehensive Cordova plugin for NFC (Near Field Communication) on Android and iOS.
7
6
 
8
7
  I dedicate a considerable amount of my free time to developing and maintaining many cordova plugins for the community ([See the list with all my maintained plugins][community_plugins]).
9
8
  To help ensure this plugin is kept updated,
@@ -14,43 +13,50 @@ or if you're asking for new features or priority bug fixes. Thank you!
14
13
 
15
14
  [![](https://img.shields.io/static/v1?label=Sponsor%20Me&style=for-the-badge&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/eyalin)
16
15
 
16
+ ## Features
17
+
18
+ - **Read/Write NDEF** - Read and write NDEF formatted NFC tags
19
+ - **Raw Commands** - Send raw commands via transceive (ISO 14443-3A, ISO 14443-4, ISO 15693)
20
+ - **Advanced Tag Analysis** (v1.5.0+) - Read raw memory, get NTAG version, counter, signature
21
+ - **TypeScript Support** - Full TypeScript definitions included
22
+
23
+ ## What's New in v1.5.0
24
+
25
+ ### Advanced Tag Analysis Methods
17
26
 
27
+ New methods for premium NFC tag analysis:
18
28
 
19
- The NFC plugin allows you to read and write NFC tags. You can also beam to, and receive from, other NFC enabled devices.
29
+ | Method | Description |
30
+ |--------|-------------|
31
+ | `readMemoryPages(startPage, numPages)` | Read raw memory pages from NTAG/MIFARE Ultralight |
32
+ | `getNtagVersion()` | Get NTAG version info (IC type, memory size) |
33
+ | `readNtagCounter()` | Read 24-bit NFC tap counter |
34
+ | `readNtagSignature()` | Read 32-byte ECC originality signature |
35
+ | `getPasswordProtectionStatus()` | Check password protection configuration |
36
+ | `fullMemoryDump()` | Complete memory dump with automatic tag detection |
20
37
 
21
- Use to
22
- * read data from NFC tags
23
- * write data to NFC tags
24
- * send data to other NFC enabled devices
25
- * receive data from NFC devices
26
- * send raw commands (ISO 14443-3A, ISO 14443-3A, ISO 14443-4, JIS 6319-4, ISO 15693) to NFC tags
38
+ ## Supported Platforms
27
39
 
28
- This plugin uses NDEF (NFC Data Exchange Format) for maximum compatibilty between NFC devices, tag types, and operating systems.
40
+ - ✅ Android (API 16+)
41
+ - ✅ iOS 11+ (CoreNFC)
29
42
 
30
- Supported Platforms
31
- -------------------
32
- * Android
33
- * [iOS 11](#ios-notes)
34
- * Windows (includes Windows Phone 8.1, Windows 8.1, Windows 10)
35
- * BlackBerry 10
36
- * Windows Phone 8
37
- * BlackBerry 7
43
+ > Note: Legacy platforms (Windows, BlackBerry) are no longer actively maintained but may still work.
38
44
 
39
45
  ## Contents
40
46
 
41
47
  * [Installing](#installing)
48
+ * [TypeScript Usage](#typescript-usage)
49
+ * [Advanced Tag Analysis](#advanced-tag-analysis-v150)
42
50
  * [NFC](#nfc)
43
51
  * [NDEF](#ndef)
44
52
  - [NdefMessage](#ndefmessage)
45
53
  - [NdefRecord](#ndefrecord)
46
54
  * [Events](#events)
47
55
  * [Platform Differences](#platform-differences)
48
- * [BlackBerry 10 Invoke Target](#blackberry-10-invoke-target)
49
56
  * [Launching Application when Scanning a Tag](#launching-your-android-application-when-scanning-a-tag)
50
57
  * [Testing](#testing)
51
58
  * [Sample Projects](#sample-projects)
52
59
  * [Host Card Emulation (HCE)](#hce)
53
- * [Book](#book)
54
60
  * [License](#license)
55
61
 
56
62
  # Installing
@@ -71,11 +77,165 @@ Edit config.xml to install the plugin for [PhoneGap Build](http://build.phonegap
71
77
  <plugin name="phonegap-nfc" source="npm" />
72
78
 
73
79
 
74
- Windows Phone 8.1 should use the **windows** platform. The Silverlight based Windows Phone 8 code is no longer being maintained.
80
+ Or from local path:
81
+
82
+ ```bash
83
+ cordova plugin add /path/to/community-cordova-plugin-nfc
84
+ ```
85
+
86
+ # TypeScript Usage
87
+
88
+ ```typescript
89
+ import { INdefTag, INtagVersionInfo, IFullMemoryDump } from 'community-cordova-plugin-nfc';
90
+
91
+ declare var nfc: any;
92
+
93
+ // Read NDEF tag (iOS)
94
+ const tag: INdefTag = await nfc.scanNdef();
95
+ console.log('Tag:', JSON.stringify(tag));
96
+
97
+ // Get NTAG version info (Android - requires connect first)
98
+ await nfc.connect('android.nfc.tech.NfcA');
99
+ const version: INtagVersionInfo = await nfc.getNtagVersion();
100
+ console.log('IC Type:', version.icType);
101
+
102
+ // Full memory dump
103
+ const dump: IFullMemoryDump = await nfc.fullMemoryDump();
104
+ console.log('Memory:', dump.hexDump);
105
+ await nfc.close();
106
+ ```
107
+
108
+ # Advanced Tag Analysis (v1.5.0+)
109
+
110
+ These methods require connecting to the tag first using `nfc.connect()`.
111
+
112
+ ## nfc.readMemoryPages
113
+
114
+ Read raw memory pages from NTAG/MIFARE Ultralight tags.
115
+
116
+ ```javascript
117
+ await nfc.connect('android.nfc.tech.NfcA');
118
+ const memory = await nfc.readMemoryPages(0, 16);
119
+ console.log('Memory:', util.arrayBufferToHexString(memory));
120
+ await nfc.close();
121
+ ```
122
+
123
+ ### Parameters
124
+
125
+ - __startPage__: Starting page number (0-based)
126
+ - __numPages__: Number of pages to read
127
+
128
+ ### Returns
129
+
130
+ - Promise with ArrayBuffer containing raw memory data
131
+
132
+ ## nfc.getNtagVersion
133
+
134
+ Get NTAG version information using GET_VERSION command (0x60).
135
+
136
+ ```javascript
137
+ await nfc.connect('android.nfc.tech.NfcA');
138
+ const version = await nfc.getNtagVersion();
139
+ console.log('IC Type:', version.icType);
140
+ console.log('Storage Size:', version.storageSize);
141
+ await nfc.close();
142
+ ```
143
+
144
+ ### Returns
145
+
146
+ - Promise with version info object:
147
+ - `vendorId`: Vendor ID (0x04 = NXP)
148
+ - `productType`: Product type (0x04 = NTAG, 0x03 = MIFARE Ultralight)
149
+ - `storageSize`: Storage size indicator
150
+ - `icType`: Human-readable IC type string (e.g., "NTAG215")
151
+
152
+ ## nfc.readNtagCounter
153
+
154
+ Read the NTAG 24-bit NFC tap counter.
155
+
156
+ ```javascript
157
+ await nfc.connect('android.nfc.tech.NfcA');
158
+ const counter = await nfc.readNtagCounter();
159
+ console.log('Tag has been tapped', counter, 'times');
160
+ await nfc.close();
161
+ ```
162
+
163
+ ### Returns
164
+
165
+ - Promise with counter value (0 to 16,777,215)
166
+
167
+ ## nfc.readNtagSignature
168
+
169
+ Read the NTAG 32-byte ECC originality signature.
170
+
171
+ ```javascript
172
+ await nfc.connect('android.nfc.tech.NfcA');
173
+ const signature = await nfc.readNtagSignature();
174
+ console.log('Signature:', util.arrayBufferToHexString(signature));
175
+ await nfc.close();
176
+ ```
177
+
178
+ ### Returns
179
+
180
+ - Promise with 32-byte signature as ArrayBuffer
181
+
182
+ ## nfc.getPasswordProtectionStatus
183
+
184
+ Check password protection configuration.
185
+
186
+ ```javascript
187
+ await nfc.connect('android.nfc.tech.NfcA');
188
+ const status = await nfc.getPasswordProtectionStatus();
189
+ console.log('Protected:', status.isProtected);
190
+ console.log('Protection starts at page:', status.protectionStartPage);
191
+ await nfc.close();
192
+ ```
193
+
194
+ ### Parameters
195
+
196
+ - __configPage__: (Optional) Config page number, defaults to NTAG216 config page
197
+
198
+ ### Returns
199
+
200
+ - Promise with protection status object:
201
+ - `protectionStartPage`: Page where protection starts
202
+ - `isProtected`: Whether protection is enabled
203
+ - `readProtected`: Whether read is protected
204
+ - `writeProtected`: Whether write is protected
205
+ - `authLimitEnabled`: Whether auth limit is enabled
206
+ - `authLimitCounter`: Auth attempt counter (0-7)
207
+
208
+ ## nfc.fullMemoryDump
209
+
210
+ Perform complete memory dump with automatic tag type detection.
211
+
212
+ ```javascript
213
+ await nfc.connect('android.nfc.tech.NfcA');
214
+ const dump = await nfc.fullMemoryDump();
215
+ if (dump.success) {
216
+ console.log('Tag Type:', dump.tagType);
217
+ console.log('Total Pages:', dump.totalPages);
218
+ console.log('Hex Dump:', dump.hexDump);
219
+ }
220
+ await nfc.close();
221
+ ```
222
+
223
+ ### Returns
224
+
225
+ - Promise with dump result object:
226
+ - `success`: Whether dump succeeded
227
+ - `tagType`: Detected tag type string
228
+ - `version`: NTAG version info (if available)
229
+ - `totalPages`: Total pages in tag
230
+ - `memoryDump`: Raw memory as ArrayBuffer
231
+ - `hexDump`: Memory as hex string
232
+ - `error`: Error message (if failed)
233
+
234
+ ### Supported Platforms
75
235
 
76
- BlackBerry 7 support is only available for Cordova 2.x. For applications targeting BlackBerry 7, you may need to use an older version of phonegap-nfc.
236
+ - Android (requires `nfc.connect()` first)
77
237
 
78
- See [Getting Started](https://github.com/chariotsolutions/phonegap-nfc/blob/master/doc/GettingStartedCLI.md) and [Getting Started BlackBerry 10](https://github.com/chariotsolutions/phonegap-nfc/blob/master/doc/GettingStartedBlackberry10.md)for more details.
238
+ ---
79
239
 
80
240
  ## iOS Notes
81
241
 
@@ -99,11 +259,11 @@ Writing NFC tags on iOS uses the same [nfc.write](#nfcwrite) function as other p
99
259
  - [nfc.addNdefFormatableListener](#nfcaddndefformatablelistener)
100
260
  - [nfc.write](#nfcwrite)
101
261
  - [nfc.makeReadOnly](#nfcmakereadonly)
102
- - [nfc.share](#nfcshare)
103
- - [nfc.unshare](#nfcunshare)
262
+ - [~~nfc.share~~](#nfcshare)
263
+ - [~~nfc.unshare~~](#nfcunshare)
104
264
  - [nfc.erase](#nfcerase)
105
- - [nfc.handover](#nfchandover)
106
- - [nfc.stopHandover](#nfcstophandover)
265
+ - [~~nfc.handover~~](#nfchandover)
266
+ - [~~nfc.stopHandover~~](#nfcstophandover)
107
267
  - [nfc.enabled](#nfcenabled)
108
268
  - [nfc.showSettings](#nfcshowsettings)
109
269
  - [~~nfc.beginSession~~](#nfcbeginsession)
package/package.json CHANGED
@@ -1,33 +1,50 @@
1
1
  {
2
2
  "name": "community-cordova-plugin-nfc",
3
- "version": "1.3.0",
4
- "description": "Near Field Communication (NFC) Plugin. Read and write NDEF messages to NFC tags and share NDEF messages with peers.",
3
+ "version": "1.5.2",
4
+ "description": "Community Cordova NFC Plugin - Read and write NDEF messages, advanced tag analysis, raw memory access",
5
+ "main": "./types/index.d.ts",
6
+ "types": "./types/index.d.ts",
5
7
  "cordova": {
6
- "id": "phonegap-nfc",
8
+ "id": "community-cordova-plugin-nfc",
7
9
  "platforms": [
8
10
  "android",
9
- "wp8",
10
- "windows",
11
- "blackberry10",
12
11
  "ios"
13
12
  ]
14
13
  },
15
- "repository": "EYALIN/community-cordova-plugin-nfc/tree/master",
14
+ "readme": "README.md",
15
+ "repository": "EYALIN/community-cordova-plugin-nfc",
16
+ "homepage": "https://github.com/EYALIN/community-cordova-plugin-nfc",
17
+ "funding": "https://github.com/sponsors/EYALIN",
18
+ "bugs": "https://github.com/EYALIN/community-cordova-plugin-nfc/issues",
16
19
  "keywords": [
20
+ "cordova",
17
21
  "nfc",
18
22
  "ndef",
23
+ "ntag",
24
+ "mifare",
25
+ "rfid",
26
+ "tag",
19
27
  "ecosystem:cordova",
20
- "cordova",
21
28
  "cordova-android",
22
- "cordova-wp8",
23
- "cordova-windows",
24
- "cordova-blackberry10",
25
29
  "cordova-ios"
26
30
  ],
31
+ "scripts": {
32
+ "test": "npm run lint",
33
+ "lint": "eslint ."
34
+ },
27
35
  "author": "Don Coleman <don.coleman@gmail.com>",
36
+ "contributors": [
37
+ "EYALIN"
38
+ ],
28
39
  "license": "MIT",
29
- "homepage": "https://github.com/EYALIN/community-cordova-plugin-nfc/tree/master",
30
- "funding": "https://github.com/sponsors/EYALIN",
31
- "bugs": "https://github.com/EYALIN/community-cordova-plugin-nfc/issues"
32
-
40
+ "engines": {
41
+ "cordovaDependencies": {
42
+ "1.0.0": {
43
+ "cordova": ">100"
44
+ }
45
+ }
46
+ },
47
+ "devDependencies": {
48
+ "@cordova/eslint-config": "^3.0.0"
49
+ }
33
50
  }
package/plugin.xml CHANGED
@@ -1,18 +1,20 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ Community Cordova NFC Plugin
4
+ Licensed under MIT License
5
+ -->
2
6
  <plugin
3
- xmlns="http://www.phonegap.com/ns/plugins/1.0"
7
+ xmlns="http://apache.org/cordova/ns/plugins/1.0"
4
8
  xmlns:android="http://schemas.android.com/apk/res/android"
5
9
  id="community-cordova-plugin-nfc"
6
- version="1.3.0">
10
+ version="1.5.0">
7
11
 
8
12
  <name>NFC</name>
9
-
10
- <description>Near Field Communication (NFC) Plugin. Read and write NDEF messages to NFC tags and share NDEF messages with peers.</description>
11
-
13
+ <description>Community Cordova NFC Plugin - Read and write NDEF messages, advanced tag analysis, raw memory access</description>
12
14
  <license>MIT</license>
13
- <keywords>nfc, NFC, NDEF</keywords>
14
- <repo>https://github.com/EYALIN/community-cordova-plugin-nfc.git.git</repo>
15
- <issue>https://github.com/EYALIN/community-cordova-plugin-nfc.git/issues</issue>
15
+ <keywords>cordova,nfc,ndef,ntag,mifare,rfid</keywords>
16
+ <repo>https://github.com/EYALIN/community-cordova-plugin-nfc</repo>
17
+ <issue>https://github.com/EYALIN/community-cordova-plugin-nfc/issues</issue>
16
18
 
17
19
  <platform name="android">
18
20
  <js-module src="www/phonegap-nfc.js" name="NFC">