Construction
Verifies the SDM output a tag emits — no hardware. Construct once with your keys
and SDM settings, then call the decode* method matching the tag’s profile.
import { CrypTagDecoder } from 'cryptag';Creating a Decoder
new CrypTagDecoder(options?)
Construct a decoder with your keys and SDM settings. Throws if a key config or SDM setting is invalid.
options.keyList—{ '0'..'4': { masterKey: '<32 hex>', diversify: boolean } }. Missing slots default to the factory key, non-diversified.options.systemIdentifier(default'CRYPTAG') — for diversification.options.applicationId(default'3042F5') — for diversification.options.sdmSettings.sdmMetaRead(number|'free', default2) — key for PICCData decryption.options.sdmSettings.sdmFileRead(number|'free', default3) — key for the MAC / file-data.options.sdmSettings.cmacSeparator(default'') — the URL separator preceding the CMAC; it is part of the full-profile MAC input, so it must match how the URL was encoded.
const decoder = new CrypTagDecoder({ keyList: { '2': { masterKey: '00000000000000000000000000000000', diversify: false }, '3': { masterKey: '00000000000000000000000000000000', diversify: false }, }, systemIdentifier: 'CRYPTAG', applicationId: '3042F5', sdmSettings: { sdmMetaRead: 2, sdmFileRead: 3, cmacSeparator: '&cmac=' },});The constructor returns a CrypTagDecoder instance — call the decode* method matching the tag’s profile on it.