我正在研究 Apple 的 Touch ID,更准确地说是本地身份验证器。截至目前的文档非常稀疏。它主要是这样的:
LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
NSString *myLocalizedReasonString = <#String explaining why app needs authentication#>;
if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:myLocalizedReasonString
reply:^(BOOL success, NSError *error) {
if (success) {
// User authenticated successfully, take appropriate action
} else {
// User did not authenticate successfully, look at error and take appropriate action
}
}];
} else {
// Could not evaluate policy; look at authError and present an appropriate message to user
}
取自https://developer.apple.com/documentation/localauthentication
使用指纹进行身份验证的想法很好。但如果我知道密码,我可以在设备中添加指纹。获取密码非常容易,就像您坐在受害者旁边的火车上,看着他/她输入密码一样。
我想使用指纹作为安全身份验证的一种方式,但希望能够检测自上次请求指纹以来是否添加了新指纹。
Apple 正在为 AppStore 做这件事。如果您想在 AppStore 中验证交易并且自上次交易以来添加了新指纹,AppStore 会请求您的 AppleId-Password。这是正常的行为,因为电话可能已被知道密码并添加自己的指纹以购买昂贵东西的其他人拿走。
我的问题:我能否检测到自上次使用本地身份验证器后是否添加了新指纹?