API Reference
中文

WeChat

1.1 Mini program management background add plug-in
  1. Log in to the WeChat public platform and click the Settings menu on the lower left
  2. Go to the Settings page and click the third-party Settings TAB
  3. In the plug-in management module, click the Add Plug-in button
  4. Search for wxfp, select the plug-in, and finish adding (If the application is urgent, the administrator can contact the developer for quick approval)
1.2 Integrate mini program code

1.app.json declares the plugin

{


  "plugins": {
    "tdfp-plugin": {
      "version": "1.9.4",
      "provider": "wxc3b909c3d24c5417"
    }
  },


}
  • Note: The tripartite framework can be added accordingly. For example, in uni-app, you can add the above declaration to the mp-weixin module of the manifest.json file
  1. Initialize the plug-in js and necessary configuration
    In app.js, partnerCode is the required parameter, appname and channel are optional fields:
const plugin = requirePlugin('tdfp-plugin')
App({
  ......
  globalData: {
    ......
    _fmOpt: {
      partnerCode: "", // Please fill in your partner code
      appName: "", // Please fill in your app name,Please fill in different appnames for different applets of the same company
      channel:"", // Please fill in your channel
    }
  },
  onLaunch(){
    let fmagent = new plugin.FMAgent(this.globalData._fmOpt)
    fmagent.init()
  }
  ......
})
  1. Get BlackBox
    Our device fingerprint SDK adopts a call mode similar to WeChat API and supports passing success, fail, complete callback, and other configuration fields:
const plugin = requirePlugin('tdfp-plugin')
var that = this
var fmagent = new plugin.FMAgent(app.globalData._fmOpt)
fmagent.getInfo({
  page: that,  // The Page or Component object where FMAgent resides
  mode:'plugin',
  openid: '', // If openid or unionid is empty or undefined, do not encrypt upload, pass an empty string
  // If you have the unionid function enabled, pass in the encrypted user unionid
  // Please pass in the encrypted openid of the user (ensure that the encrypted openid is one-to-one corresponding to the original openid).
  unionid: '', 
  success: function (res) {},//Successful callback, res is BlackBox string
  fail: function (res) {},// Failure callback, res for various exception objects
  complete: function (res) {} //Complete callback, res for BlackBox string or various exception objects
})

Parameter Description

parametertypedescribesampleRequiredRemove Field
pageObjectThe page object or a component object that you are currently inthatYes
openidStringUser openid after encryption (encryption algorithm can be selected at will, please ensure one-to-one correspondence before and after encryption, MD5 or SHA256 is recommended) (remember that custom default value cannot be passed, no value please pass an empty string, otherwise collision will occur)ef54040ea9cb599823077Yes
modeStringdocking mode(Please pass in' plugin' for plug-in access, and ignore the sdk mode)'plugin'No
unionidStringUser unionid after encryption (encryption algorithm can be selected at will, please ensure one-to-one correspondence before and after encryption, MD5 or SHA256 is recommended) (remember that custom default value cannot be passed, no value please pass an empty string, otherwise collision will occur))ef54040ea9cb599823077No
timeoutNumberGet BlackBox timeout (default: 2500, including the total duration of collecting and sending requests, range: 2500-16000,Unit: ms)6000No
getInfoTypestringGet blackbox mode ('1' : use cached blackbox first, '2' : use real-time collection blackbox first, '3' : use unexpired blackbox first to expire, default mode is '1')'1'
getLocationAllowedBooleanWhether to collect location information. If you need to collect location information, please contact the operation to obtain privacy compliance guidance (The default is false. If you need to collect, please obtain the authorization of wechat and mini program location information in advance and set the current item to true).falseNolatitude、longitude
noClipboardBooleanWhether not to collect the clipboard (some phones will have the system prompt that the clipboard has been collected, and the clipboard can partially enhance our recovery ability) The default is truefalseNolipboard
successFunctionSuccessful callbackfunction(res) {/res for BlackBox string /}Yes
failFunctionFailed callbackfunction(res) {/res for various exception objects /}No
completeFunctionComplete callbackfunction(res) {/res for BlackBox string or various exception objects /}No

Note:

  • blackbox has an expiration date, so please do not cache blackbox yourself, there is a caching mechanism inside our SDK, so please call the getInfo interface where you need blackbox
  • Degrade The blackbox length ranges from 3000 to 5000 bytes. You are advised to report the blackbox to the body
  • If you need the sdk version integration method, please contact the operation support