OneToken NFC Wallet SDK (React Native)
React Native TurboModule for NFC-Wallet Java Card applet (6F6E65746F6B656E02).\
Lightweight APDU session — no SCP11/SCP03, no GPChannel native libs.
Install
yarn add file:../onetoken_NFC_wallet_sdk
# or after publish:
# yarn add @onetokenfe/react-native-nfc-wallet-sdk
iOS (ds_dev / mobile app)
pod install in apps/mobile/ios
- Enable Near Field Communication Tag Reading capability
- Add to
Info.plist:
<key>NFCReaderUsageDescription</key>
<string>Scan NFC wallet card to sign transactions</string>
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>6F6E65746F6B656E02</string>
</array>
Android
AndroidManifest.xml of host app should include NFC permission (library manifest merges NFC permission).
Handle NFC intent in MainActivity (same as backup card SDK):
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
setIntent(intent)
}
Usage
import {
getWalletInfo,
initializeWallet,
unlockAndSign,
checkNFCPermission,
} from '@onetokenfe/react-native-nfc-wallet-sdk';
const perm = await checkNFCPermission();
const info = await getWalletInfo(); // one tap
const setup = await initializeWallet('1234'); // set PIN + create key, one tap
const sig = await unlockAndSign('1234', hashHex); // verify + sign, one tap
API
| Method |
Description |
getWalletInfo() |
Serial, status, PIN retries |
setPin(pin) |
First-time access code |
verifyPin(pin, expectedSerial?) |
Open session; optional on-card serial check (applet >= 1.0.17) |
createWallet(expectedSerial?) |
Card-generated master seed; optional on-card serial (applet >= 1.0.18) |
createWalletWithSeed(seedHex, expectedSerial?) |
Import 64-byte BIP39 seed; optional on-card serial |
getPublicKey() |
65-byte uncompressed hex |
signHash(hashHex) |
32-byte hash → ECDSA sig hex |
initializeWallet(pin) |
Composite: setup + create |
initializeWalletWithPubkeys(pin, pathsJson, seedHex?, expectedSerial?) |
Init + multi-path pubkeys; optional serial bind |
unlockAndSign(pin, hashHex) |
Composite: verify + sign |
wipeWallet() |
Factory reset |
ds_dev integration
Add package dependency in apps/mobile/package.json, then implement a hardware signer provider that calls unlockAndSign for transaction hashes.
Related
- Applet: NFC-Wallet
- Backup SDK:
@digitalshieldfe/react-native-backup-card-sdk