12

我已经浏览了 local_auth 包,它工作正常,但它没有使用密码或 pin 进行身份验证的选项。帮助表示赞赏!

String _authorized = 'Not Authorized';//Start

Future<Null> _authenticate() async {
    final LocalAuthentication auth = new LocalAuthentication();
    bool authenticated = false;
    try {
        authenticated = await auth.authenticateWithBiometrics(
        localizedReason: 'Scan your fingerprint to authenticate',
        useErrorDialogs: true,
        stickyAuth: false);
        authenticated = await auth.authenticateWithBiometrics(localizedReason: 'Authenticate');
    } on PlatformException catch (e) {
        print(e);
    }
    if (!mounted) return;

    setState(() {
      _authorized = authenticated ? 'Authorized' : 'Not Authorized';
    });
}//End

所以这是示例代码,您可以使用生物特征验证,但是指纹也存在的默认 Pin/密码验证呢?

4

1 回答 1

7

出于安全原因,移动设备(iOS/Android)将仅通过生物识别验证用户,而不是系统密码/密码。如果您想让用户通过生物识别以外的其他方法进行身份验证,则应用程序本身必须存储和处理(加密)凭证,该凭证与系统密码/密码完全分离。

您可以在许多银行/金融相关的应用程序中看到这种行为(使用系统生物识别和应用程序特定的凭据),例如https://play.google.com/store/apps/details?id=com.konylabs.capitalone&hl =zh

于 2019-02-27T12:06:13.580 回答