生物认证

SOTER 生物认证秘钥签名验证

生物认证是可以支持TouchID(指纹认证)FaceID(面容)声纹等认证。

  1. MiniProgramApp.Soter.VerifySignature(ctx, &request.RequestSoter{
  2. OpenID: openID,
  3. JsonString: jsonString,
  4. JsonSignature: jsonSignature,
  5. })

微信官方文档

下面附上获取json_stringjson_signature的一段小程序代码,需要的自取.

  1. // https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.startSoterAuthentication.html
  2. wx.startSoterAuthentication({
  3. requestAuthModes: ['fingerPrint', 'facial'],
  4. challenge: '123456',
  5. authContent: '请用指纹解锁',
  6. success(res) {
  7. console.log(res);
  8. // output:
  9. /* {
  10. "errMsg": "startSoterAuthentication:ok",
  11. "resultJSON": "{\"raw\":\"123456\",\"counter\":15,\"uid\":\"303d957f373ab2536b1a5e087e80ddf3\",\"cpu_id\":\"CDF3C5B8-EB98-4CD6-9733-7F920551FD86\"}",
  12. "resultJSONSignature": "MTuvNi8zP9nt+YuBG7iq/W6JI8kVMhGDINp0cHfRFsjyg7170YTpglMW13SI3lx4zC/t77D6Q==",
  13. "authMode": "fingerPrint",
  14. "errCode": 0
  15. } */
  16. },
  17. fail(e) {
  18. console.error(e);
  19. }
  20. })

使用示例

参考: PowerWechatTutorial