Taro.authPrivateMessage(option)
验证私密消息
支持情况: 
  
 
类型
(option: Option) => Promise<SuccessCallbackResult>
参数
| 参数 | 类型 | 
|---|---|
| option | Option | 
Option
| 参数 | 类型 | 必填 | 说明 | 
|---|---|---|---|
| shareTicket | string | 是 | shareTicket | 
| success | (result: SuccessCallbackResult) => void | 否 | 接口调用成功的回调函数 | 
| fail | (res: TaroGeneral.CallbackResult) => void | 否 | 接口调用失败的回调函数 | 
| complete | (res: TaroGeneral.CallbackResult) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | 
SuccessCallbackResult
| 参数 | 类型 | 必填 | 说明 | 
|---|---|---|---|
| cloudID | string | 否 | 敏感数据对应的云 ID,开通云开发的小程序才会返回,可通过云调用直接获取开放数据,详细见云调用直接获取开放数据 | 
| encryptedData | string | 是 | 包括敏感数据在内的完整转发信息的加密数据,详细见加密数据解密算法 | 
| errMsg | string | 是 | 错误信息 | 
| iv | string | 是 | 加密算法的初始向量,详细见加密数据解密算法 | 
示例代码
Taro.authPrivateMessage({
  shareTicket: 'xxxxxx',
  success(res) {
    console.log('authPrivateMessage success', res)
    // res
    // {
    //   errMsg: 'authPrivateMessage:ok'
    //   valid: true
    //   iv: 'xxxx',
    //   encryptedData: 'xxxxxx'
    // }
  },
  fail(res) {
    console.log('authPrivateMessage fail', res)
  }
})