Skip to content

Commit

Permalink
fix: ios lite (#4584)
Browse files Browse the repository at this point in the history
Co-authored-by: huhuanming <[email protected]>
  • Loading branch information
ByteZhang1024 and huhuanming authored May 14, 2024
1 parent 5031825 commit 7441a97
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/app/ios/OneKeyWallet/NFC/OKNFTLite/OKLiteV1.m
Original file line number Diff line number Diff line change
Expand Up @@ -577,13 +577,21 @@ - (BOOL)setPin:(NSString *)pin {
}

- (OKNFCLiteChangePinResult)setNewPin:(NSString *)newPin withOldPin:(NSString *)oldPin {
static const u_int8_t AuthenticationLockCode = 0x69;
static const u_int8_t AuthenticationLockSw2Code = 0x83;
static const u_int8_t FailedVerificationCode = 0x63;
static const u_int8_t PinRTLBitMask = 0x0f;

__block OKNFCLiteChangePinResult result = OKNFCLiteChangePinResultError;
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
OKLiteCommandModal *modal = [[OKLiteCommandModal alloc] initWithCommand:OKLiteCommandChangePIN version:self.version];
modal.parseResp = true;
[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) {
if (sw1 != OKNFC_SW1_OK) {
if (sw1 == 0x63) {
if (sw1 == FailedVerificationCode) {
self.pinRTL = sw2 & PinRTLBitMask;
} else if (sw1 == AuthenticationLockCode && sw2 == AuthenticationLockSw2Code) {
self.pinRTL = 0;
result = OKNFCLiteChangePinResultWiped;
}
dispatch_semaphore_signal(sema);
Expand Down

0 comments on commit 7441a97

Please sign in to comment.