Skip to content

AnyBit-Project/NFCReaderAndroid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

NFCReader

1.Get Device Information

fun checkIntentPage(intent: Intent, callback: ((tagId: String, result: String)

Success return:aid#serial#publicKey
Uninitialized return:aid#serial#6D05

2.Initialize Device

fun initCard(version: String, password: String, initString: String)

version:Version(01,02,03,...)
password: Device password (6-digit number)
initStr: privateKeyHex + publicKeyHex + crc8Hex(privateKeyHex + publicKeyHex)

Success return:aid#serial#publicKey

3.Verify Password

fun verifyPassword(word: String)

word: Device password (6-digit number)
Success return:9A00

4.Write Password

fun writePassword(newPassword: String)

newPassword: Device password (6-digit number)
Success return:9A00

5.Change Password

fun changePassword(oldPassword: String, newPassword: String)

oldPassword: Device password (6-digit number)
newPassword: New password (6-digit number)
Success return:9A00

6.Strat Send BTC

fun transferBTC(word: String)

password: Device password (6-digit number)
Success return:9A00

7.Sign BTC (Sign a single input of BTC)

fun signBTC(command: String, password: String)

command: single input transaction hex([0x80, 0x80, 0x04, 0x00, hashLength, 0x02, hashData])
password: Device password (6-digit number)
Success return:xxxxxxxx9A00

8.Get Signature rs of EVM or TRX Transaction

fun transferEVMAndTRX(version: String, hash: String, password: String)

version:Version(01,02,03,...)
password: Device password (6-digit number)
hashStr: Transaction hash string

Success return:rs string - the first 6 characters have no practical use; characters 6-7 are a hexadecimal number (its value ×2 is the character length of r segment (leftLen)), the r segment starts at character 8; after the r segment, the hexadecimal number from position 10+leftLen to 12+leftLen (its value ×2 is the character length of s segment) determines the length of s segment, and the s segment starts at position 12+leftLen

9.Read Mnemonic Phrase

fun readSeed(password: String, isOnlyRead: Boolean, seed: String)

password: Device password (6-digit number)
isOnlyRead: Whether it is read-only; if not, writing will be performed when the read result is empty
seed:Mnemonic phrase to be written
Success return:9A00

10.Write Mnemonic Phrase

fun writeSeed(password: String, seed: String)

password: Device password (6-digit number)
seed:Mnemonic phrase to be written

Success return:9A00

11.Read 2FA

fun read2fa(password: String)

password: Device password (6-digit number)

Success return:xxxxxxxx9A00 - The first two hexadecimal characters represent the length of the tag, followed by the ASCII value of the tag. For example: 0170026F6F9A00 01 indicates that the first tag has a length of 1, and 70 represents the ASCII value of the tag 'p'; 02 indicates that the second tag has a length of 2, and 6F6F represents the ASCII value of the second tag 'oo'.

12.Write 2FA

ffun write2fa(hashStr: String, password: String)

password: Device password (6-digit number)
hashStr:name and private hex([(name.len + private.len).toBytes, nameBytes, privateBytes])

Success return:xxxxxxxx9A00 - The first two hexadecimal characters represent the length of the tag, followed by the ASCII value of the tag. For example: 0170026F6F9A00 01 indicates that the first tag has a length of 1, and 70 represents the ASCII value of the tag 'p'; 02 indicates that the second tag has a length of 2, and 6F6F represents the ASCII value of the second tag 'oo'.

13.Get 2FA Code

fun get2fa(hashStr: String)

hashStr: tag length and tag hex(0170, 026F6F, ...)

Success return:xxxxxxxx9A00 - When the NFC command completes successfully (Status Word 0x9A00), the preceding response data must be processed using the platform-provided 2FA derivation mechanism. The response data should be treated as an opaque value and must not be interpreted or transformed directly by the application. The derivation process produces a deterministic, numeric verification code that is always exactly six digits in length and left-padded with zeros if necessary. Applications should rely exclusively on the official SDK or utility method to obtain the final 2FA code.

14.Delete 2FA

fun delete2fa(hashStr: String, password: String)

password: Device password (6-digit number)
hashStr: tag length and tag hex(0170, 026F6F, ...)

Success return:9A00

Error Code

  • -1 -- Multiple devices scanned at one time
  • -2 -- Unsupported device
  • -3 -- Device unavailable
  • -4 -- Incorrect aid length
  • -5 -- Version error
  • -6 -- Password not set
  • -7 -- No device detected
  • -999 -- Unknown error
  • 9A00 -- Success
  • 6D01 -- Initialization failed
  • 6D05 -- Uninitialized
  • 6D07 -- Incorrect password length
  • 6D0C -- Password verification failed
  • 6D00 -- 10 consecutive verification failures, device locked

Note: When verifying the password, 6D0C will be returned for the first error; subsequent failures will return 6D09, 6D08, 6D07, ... , 6D00 in sequence

About

Open-source NFC-based cold wallet implementation. Uses NFCReader protocol to securely manage seed phrases, initialize devices, verify/change passwords, and sign BTC (single-input), TRX, and EVM transactions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors