Skip to content

Reading

Reading Everything at Once

readTag()

Comprehensive read: discovery + NDEF + counter + authentication state in one call.

const res = await tag.readTag();

Returns

Returns — large object, click to expand
{
success: true,
data: {
uid: '04A1B2C3D4E580',
randomUID: false,
variant: 'TagTamper',
ttStatus: { permanentStatus: 'closed', currentStatus: 'open', tamperDetected: true, featureConfigured: true, rawValues: 'C40C' },
capabilities: { pd: '000000000000', pcd: '000000000000' }, // PDcap2 / PCDcap2 (hex; AES '00…', LRP '02…')
authenticated: true,
authKey: 0,
authMode: 'EV2',
version: { // VersionRaw — raw hex-string bytes from GetVersion
uid: '04A1B2C3D4E580',
hwVendor: '04', hwType: '04', hwSubtype: '02', hwMajor: '30', hwMinor: '00', hwStorage: '11', hwProtocol: '05',
swVendor: '04', swType: '04', swSubtype: '02', swMajor: '30', swMinor: '00',
batchNo: 'C4D5E6F708', productionDate: '1A07',
fabKey: '04', variant: 'TagTamper'
},
files: { // keyed by file number (FileSettings — see getFileSettings)
'1': {
fileType: '00', fileOption: '00', readAccess: 14, writeAccess: 0, readWriteAccess: 0, changeAccess: 0,
fileSize: 32, sdmEnabled: false, commMode: 'plain'
},
'2': {
fileType: '00', fileOption: '40', readAccess: 14, writeAccess: 0, readWriteAccess: 0, changeAccess: 0,
fileSize: 256, sdmEnabled: true, sdmOptions: 'c1', sdmAccessRights: 'F123', offsets: [12, 45], commMode: 'plain'
},
'3': {
fileType: '00', fileOption: '03', readAccess: 0, writeAccess: 0, readWriteAccess: 0, changeAccess: 0,
fileSize: 128, sdmEnabled: false, commMode: 'full'
}
},
accessRights: { // keyed by file number (AccessRightInfo)
'1': { read: 14, write: 0, readWrite: 0, change: 0 },
'2': { read: 14, write: 0, readWrite: 0, change: 0 },
'3': { read: 0, write: 0, readWrite: 0, change: 0 }
},
sdm: { // SDMConfig
enabled: true,
profile: 'encrypted',
options: { uidMirror: true, readCounter: true, readCounterLimit: false, encryptedFileData: false, ttStatusMirror: false, asciiEncoding: false },
keys: { sdmCtrRet: 15, sdmMetaRead: 2, sdmFileRead: 3 },
offsets: [12, 45],
counterLimit: null,
raw: { sdmOptions: 193, sdmAccessRights: 61731 }
},
counter: 7,
ndef: { // ReadNDEFData
empty: false,
ndef: <Buffer d1 01 15 55 00 ...>,
raw: 'd10115550068747470733a2f2f6578616d706c652e636f6d2f74',
records: [{ type: 'U', payload: 'https://example.com/t' }],
recordCount: 1,
length: 42,
url: 'https://example.com/t',
text: null,
sdmParams: { type: 'url', baseUrl: 'https://example.com/t', params: { picc_data: 'EF7A91C5E08B264A1F9C7E03B5D8A420', cmac: 'A1B2C3D4E5F60718' }, features: ['Encrypted PICC Data', 'CMAC'], compressed: false, profile: 'encrypted', authMode: 'EV2', encSize: null }
}
},
duration: 38
}

Reading Individual Files

readNDEF()

Read and parse NDEF content from file 2. Auth: the NDEF file’s read key, if any (automatic; 'free' skips auth).

const res = await tag.readNDEF();

Returns

{
success: true,
data: {
empty: false,
ndef: <Buffer d1 01 ...>,
raw: 'd10115550068747470733a2f2f6578616d706c652e636f6d2f74',
records: [{ type: 'U', payload: 'https://example.com/t' }],
recordCount: 1,
length: 42,
url: 'https://example.com/t',
text: null,
sdmParams: { type: 'url', baseUrl: 'https://example.com/t', params: { picc_data: 'EF7A91C5E08B264A1F9C7E03B5D8A420', cmac: 'A1B2C3D4E5F60718' }, features: ['Encrypted PICC Data', 'CMAC'], compressed: false, profile: 'encrypted', authMode: 'EV2', encSize: null }
},
duration: 16
}

readProprietary()

Read proprietary data from file 3 (auth: the file’s read key, automatic).

const res = await tag.readProprietary();

Returns

{
success: true,
data: {
data: <Buffer 48 65 6c 6c 6f>,
text: 'Hello',
hex: '48656c6c6f',
length: 5,
empty: false,
raw: '48656c6c6f'
},
duration: 12
}

readCapabilityContainer()

Read and parse the Capability Container (file 1).

const res = await tag.readCapabilityContainer();

Returns

{
success: true,
data: {
raw: '001720010000ff0406e10401000000000506e10500808283',
ccLength: 23,
version: '2.0',
maxReadSize: 256,
maxWriteSize: 256,
ndef: { fileId: '0406', fileSize: 256, read: 0, write: 0, readByte: '00', writeByte: '00' },
proprietary: { fileId: '0506', fileSize: 128, read: 0, write: 0, readByte: '82', writeByte: '83' }
},
duration: 14
}

readFile(fileNo, offset?, length?)

Low-level raw file read (auth: the file’s read key, automatic). Automatically uses ISO READ BINARY or the native ReadData command depending on the file’s communication mode.

  • fileNo — 1=CC, 2=NDEF, 3=Proprietary.
  • offset (default 0) — start byte.
  • length (default 256) — bytes to read (max 256 per call).
const res = await tag.readFile(2, 0, 64);

Returns

{
success: true,
data: {
data: <Buffer d1 01 15 55 00 ...>,
fileNo: 2,
offset: 0,
length: 64,
mode: 'iso'
},
duration: 11
}

Settings & Counters

getFileSettings(fileNo)

Communication mode, access rights, and SDM config for a file (fileNo 1, 2, or 3). Access fields are raw numeric nibbles — 14 (0x0E) means free; fileType / fileOption / sdmOptions are hex strings and offsets are byte numbers.

const res = await tag.getFileSettings(2);

Returns

{
success: true,
data: {
settings: {
fileType: '00',
fileOption: '40',
readAccess: 14,
writeAccess: 0,
readWriteAccess: 0,
changeAccess: 0,
fileSize: 256,
sdmEnabled: true,
sdmOptions: 'c1',
sdmAccessRights: 'F123',
offsets: [12, 45],
commMode: 'plain'
}
},
duration: 13
}

getCounter()

SDM read counter (NDEF file). Requires SDM to be enabled.

const res = await tag.getCounter();

Returns

{
success: true,
data: { value: 7, fileNo: 2 },
duration: 9
}