@ukeyfe/react-native-nfc-litecard 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +7 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -745,13 +745,19 @@ async function readMnemonic(password, onCardIdentified) {
745
745
  }
746
746
  const aesKey = passwordToAesKey(password);
747
747
  await authenticate(aesKey);
748
+ let finalRetryCount;
749
+ try {
750
+ await writeRetryCountInSession(DEFAULT_PIN_RETRY_COUNT);
751
+ finalRetryCount = DEFAULT_PIN_RETRY_COUNT;
752
+ } catch {
753
+ }
748
754
  onCardIdentified?.();
749
755
  const data = await readUserMemory();
750
756
  const mnemonicData = data.slice(0, MNEMONIC_MEMORY_SIZE);
751
757
  if (mnemonicData.every((b) => b === 0)) {
752
758
  await releaseNfcTech();
753
759
  releaseNfcLock();
754
- return { code: NfcStatusCode.CHECK_EMPTY, success: false };
760
+ return { code: NfcStatusCode.CHECK_EMPTY, success: false, data: { retryCount: finalRetryCount } };
755
761
  }
756
762
  const result = entropyToMnemonic2(data);
757
763
  let nickname;
@@ -759,12 +765,6 @@ async function readMnemonic(password, onCardIdentified) {
759
765
  nickname = await readUserNicknameInternal();
760
766
  } catch {
761
767
  }
762
- let finalRetryCount;
763
- try {
764
- await writeRetryCountInSession(DEFAULT_PIN_RETRY_COUNT);
765
- finalRetryCount = DEFAULT_PIN_RETRY_COUNT;
766
- } catch {
767
- }
768
768
  await releaseNfcTech();
769
769
  releaseNfcLock();
770
770
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ukeyfe/react-native-nfc-litecard",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "NFC read/write for MIFARE Ultralight AES (LiteCard mnemonic storage)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",