微信小程序調用指紋驗證共有三個相關的接口
1.wx.checkIsSupportSoterAuthentication() 獲取本機支持的 SOTER 生物認證方式
wx.checkIsSupportSoterAuthentication({ success(res) { // res.supportMode = [] 不具備任何被SOTER支持的生物識別方式 // res.supportMode = ['fingerPrint'] 只支持指紋識別 // res.supportMode = ['fingerPrint', 'facial'] 支持指紋識別和人臉識別 } })
2.wx.checkIsSoterEnrolledInDevice() 獲取設備內是否錄入如指紋等生物信息的接口
wx.checkIsSoterEnrolledInDevice({ checkAuthMode: 'fingerPrint', success(res) { console.log(res.isEnrolled)// isEnrolled的值是0或者1,不知道是不是指紋個數或是Boolean } })
3.wx.startSoterAuthentication() 開始 SOTER 生物認證
wx.startSoterAuthentication({ requestAuthModes: ['fingerPrint'], challenge: '123456', authContent: '請用指紋解鎖', success(res) { } })
如果只是簡單的驗證指紋功能,可以只到這一步了
但是要做防止在客戶端被破解,還需要后台進行向小程序后台進行api驗證
相關鏈接:
https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.startSoterAuthentication.html
后續補充項目實踐代碼......