
Security News
High Salaries No Longer Enough to Attract Top Cybersecurity Talent
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
@trentrand/capacitor-nfc
Advanced tools
Capacitor plugin to scan NFC tags
npm install @trentrand/capacitor-nfc
npx cap sync
Attempting to use this plugin on iOS without proper configuration in Xcode will result in an immediate app crash when NFCNDEFReaderSession.begin()
is called. To prevent this:
Enable NFC capabilities in Xcode and configure entitlements
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
<string>TAG</string>
</array>
Add NFC usage description to Info.plist
<key>NFCReaderUsageDescription</key>
<string>Describe why your app needs NFC access</string>
startScan(...)
stopScan()
write(...)
isEnabled()
addListener('nfcTagRead', ...)
removeAllListeners()
startScan(options?: NFCScanOptions | undefined) => Promise<void>
Start scanning for NFC tags.
Param | Type | Description |
---|---|---|
options | NFCScanOptions | Optional scan configuration |
stopScan() => Promise<void>
Stop scanning for NFC tags.
write(options: NFCWriteOptions) => Promise<void>
Write data to an NFC tag.
Param | Type | Description |
---|---|---|
options | NFCWriteOptions | Write configuration including the records to write |
isEnabled() => Promise<{ enabled: boolean; }>
Check if NFC is available and enabled on the device.
Returns: Promise<{ enabled: boolean; }>
addListener(eventName: 'nfcTagRead', listenerFunc: (event: NFCReadEvent) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Add a listener for NFC events.
Param | Type | Description |
---|---|---|
eventName | 'nfcTagRead' | Name of the event to listen for |
listenerFunc | (event: NFCReadEvent) => void | Callback function |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
removeAllListeners() => Promise<void>
Remove all listeners for NFC events.
Prop | Type |
---|---|
timeout | number |
Prop | Type |
---|---|
records | NFCRecord[] |
timeout | number |
Prop | Type |
---|---|
recordType | string |
mediaType | string |
data | DataView |
Prop | Type |
---|---|
buffer | ArrayBuffer |
byteLength | number |
byteOffset | number |
Method | Signature | Description |
---|---|---|
getFloat32 | (byteOffset: number, littleEndian?: boolean | undefined) => number | Gets the Float32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. |
getFloat64 | (byteOffset: number, littleEndian?: boolean | undefined) => number | Gets the Float64 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. |
getInt8 | (byteOffset: number) => number | Gets the Int8 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. |
getInt16 | (byteOffset: number, littleEndian?: boolean | undefined) => number | Gets the Int16 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. |
getInt32 | (byteOffset: number, littleEndian?: boolean | undefined) => number | Gets the Int32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. |
getUint8 | (byteOffset: number) => number | Gets the Uint8 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. |
getUint16 | (byteOffset: number, littleEndian?: boolean | undefined) => number | Gets the Uint16 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. |
getUint32 | (byteOffset: number, littleEndian?: boolean | undefined) => number | Gets the Uint32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. |
setFloat32 | (byteOffset: number, value: number, littleEndian?: boolean | undefined) => void | Stores an Float32 value at the specified byte offset from the start of the view. |
setFloat64 | (byteOffset: number, value: number, littleEndian?: boolean | undefined) => void | Stores an Float64 value at the specified byte offset from the start of the view. |
setInt8 | (byteOffset: number, value: number) => void | Stores an Int8 value at the specified byte offset from the start of the view. |
setInt16 | (byteOffset: number, value: number, littleEndian?: boolean | undefined) => void | Stores an Int16 value at the specified byte offset from the start of the view. |
setInt32 | (byteOffset: number, value: number, littleEndian?: boolean | undefined) => void | Stores an Int32 value at the specified byte offset from the start of the view. |
setUint8 | (byteOffset: number, value: number) => void | Stores an Uint8 value at the specified byte offset from the start of the view. |
setUint16 | (byteOffset: number, value: number, littleEndian?: boolean | undefined) => void | Stores an Uint16 value at the specified byte offset from the start of the view. |
setUint32 | (byteOffset: number, value: number, littleEndian?: boolean | undefined) => void | Stores an Uint32 value at the specified byte offset from the start of the view. |
Represents a raw buffer of binary data, which is used to store data for the different typed arrays. ArrayBuffers cannot be read from or written to directly, but can be passed to a typed array or DataView Object to interpret the raw buffer as needed.
Prop | Type | Description |
---|---|---|
byteLength | number | Read-only. The length of the ArrayBuffer (in bytes). |
Method | Signature | Description |
---|---|---|
slice | (begin: number, end?: number | undefined) => ArrayBuffer | Returns a section of an ArrayBuffer. |
Prop | Type |
---|---|
remove | () => Promise<void> |
Prop | Type |
---|---|
message | NFCMessage |
serialNumber | string |
Prop | Type |
---|---|
records | NFCRecord[] |
FAQs
Capacitor plugin to scan NFC tags
The npm package @trentrand/capacitor-nfc receives a total of 0 weekly downloads. As such, @trentrand/capacitor-nfc popularity was classified as not popular.
We found that @trentrand/capacitor-nfc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.
Security News
Corepack will be phased out from future Node.js releases following a TSC vote.