Skip to content

Commit 7441a97

Browse files
fix: ios lite (#4584)
Co-authored-by: huhuanming <huanming@onekey.so>
1 parent 5031825 commit 7441a97

File tree

1 file changed

+9
-1
lines changed
  • packages/app/ios/OneKeyWallet/NFC/OKNFTLite

1 file changed

+9
-1
lines changed

packages/app/ios/OneKeyWallet/NFC/OKNFTLite/OKLiteV1.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,13 +577,21 @@ - (BOOL)setPin:(NSString *)pin {
577577
}
578578

579579
- (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;
584+
580585
__block OKNFCLiteChangePinResult result = OKNFCLiteChangePinResultError;
581586
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
582587
OKLiteCommandModal *modal = [[OKLiteCommandModal alloc] initWithCommand:OKLiteCommandChangePIN version:self.version];
583588
modal.parseResp = true;
584589
[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) {
585590
if (sw1 != OKNFC_SW1_OK) {
586-
if (sw1 == 0x63) {
591+
if (sw1 == FailedVerificationCode) {
592+
self.pinRTL = sw2 & PinRTLBitMask;
593+
} else if (sw1 == AuthenticationLockCode && sw2 == AuthenticationLockSw2Code) {
594+
self.pinRTL = 0;
587595
result = OKNFCLiteChangePinResultWiped;
588596
}
589597
dispatch_semaphore_signal(sema);

0 commit comments

Comments
 (0)