@onekeyfe/react-native-lite-card 1.0.5 → 1.0.6

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.
@@ -260,7 +260,7 @@
260
260
  if (status == OKNFCLiteGetMncStatusWiped) {
261
261
  self.status = OKNFCLiteStatusNewCard;
262
262
  }
263
- [self.delegate endNFCSessionWithError:status == OKNFCLiteGetMncStatusError || status == OKNFCLiteGetMncStatusPinNotMatch];
263
+ [self.delegate endNFCSessionWithError:status == OKNFCLiteGetMncStatusError || status == OKNFCLiteGetMncStatusPinNotMatch || status == OKNFCLiteGetMncStatusWiped];
264
264
  callback(self,mnc,status);
265
265
  }
266
266
 
@@ -577,13 +577,20 @@
577
577
  }
578
578
 
579
579
  - (OKNFCLiteChangePinResult)setNewPin:(NSString *)newPin withOldPin:(NSString *)oldPin {
580
+ static const u_int8_t AuthenticationLockCode = 0x69;
581
+ static const u_int8_t AuthenticationLockSw2Code = 0x83;
582
+ static const u_int8_t FailedVerificationCode = 0x63;
583
+ static const u_int8_t PinRTLBitMask = 0x0f;
580
584
  __block OKNFCLiteChangePinResult result = OKNFCLiteChangePinResultError;
581
585
  dispatch_semaphore_t sema = dispatch_semaphore_create(0);
582
586
  OKLiteCommandModal *modal = [[OKLiteCommandModal alloc] initWithCommand:OKLiteCommandChangePIN version:self.version];
583
587
  modal.parseResp = true;
584
588
  [self.commandTool sendCommandWithAPDU:[modal changePIN:oldPin newPin:newPin] modal:modal completionHandler:^(NSData * _Nonnull responseData, uint8_t sw1, uint8_t sw2, NSError * _Nullable error, NSString * _Nonnull parseRespon) {
585
589
  if (sw1 != OKNFC_SW1_OK) {
586
- if (sw1 == 0x63) {
590
+ if (sw1 == FailedVerificationCode) {
591
+ self.pinRTL = sw2 & PinRTLBitMask;
592
+ } else if (sw1 == AuthenticationLockCode && sw2 == AuthenticationLockSw2Code) {
593
+ self.pinRTL = 0;
587
594
  result = OKNFCLiteChangePinResultWiped;
588
595
  }
589
596
  dispatch_semaphore_signal(sema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-lite-card",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "lite card",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",