@ukeyfe/react-native-nfc-litecard 1.0.4 → 1.0.5
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/dist/nfc-core.js +4 -3
- package/package.json +1 -1
package/dist/nfc-core.js
CHANGED
|
@@ -143,12 +143,13 @@ function computeCommandCmac(sessionKey, cmdCtr, command) {
|
|
|
143
143
|
return truncateCmac(mac);
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
146
|
-
* Truncate a 16-byte CMAC to 8 bytes using the MIFARE convention:
|
|
147
|
-
* select
|
|
146
|
+
* Truncate a 16-byte CMAC to 8 bytes using the NXP MIFARE convention:
|
|
147
|
+
* select odd-indexed bytes (0-based): MAC[1], MAC[3], MAC[5], ..., MAC[15].
|
|
148
|
+
* NXP docs refer to these as "even-numbered bytes" using 1-based numbering.
|
|
148
149
|
* (First introduced in MIFARE Plus, see NXP AN13452.)
|
|
149
150
|
*/
|
|
150
151
|
function truncateCmac(mac) {
|
|
151
|
-
return new Uint8Array([mac[
|
|
152
|
+
return new Uint8Array([mac[1], mac[3], mac[5], mac[7], mac[9], mac[11], mac[13], mac[15]]);
|
|
152
153
|
}
|
|
153
154
|
/**
|
|
154
155
|
* Compute the 8-byte truncated CMAC for an NFC response.
|