To extend the account expiration date from client side, otpAcc.setExpiryTime() function is not available in iOS Mobile Authenticator SWIFT SDK.
Symantec Strong Authentication 9.1.5.1
CA Mobile Authenticator iOS SDK 2.2.2
Below is the recommended approach and sample code that can be used to update the expiration time in a custom function:
(void)updateAccountExpiry {
@try {
NSArray<AuthAccount *> *listAccs = [(MainActivity *)self.activity getAuthenticator].getAllAccounts;
NSInteger numOfYears = 10; // Number of years to extend the account expiry from current date
for (NSInteger i = 0; i < listAccs.count; i++) {
OTPAuthCredential *otpAcc = listAccs[i].otpAuthCredential;
NSTimeInterval time = otpAcc.expiryTime;
if (time <= [[NSDate date] timeIntervalSince1970]) {
NSDate *currentDate = [NSDate date];
NSDate *newExpiryDate = [currentDate dateByAddingTimeInterval:(numOfYears * 365.25 * 24 * 60 * 60)]; // Approx. 1 year in seconds
otpAcc.expiryTime = [newExpiryDate timeIntervalSince1970];
[(MainActivity *)self.activity.getAuthenticator saveAccount:listAccs[i].otpAccount];
}
}
} @catch (AccountException *e) {
NSLog(@"Error: %@", e.localizedDescription);
}
}
Note: The variable name and function name may differ.