authPost static method

Future<WitsystemError> authPost(
  1. String url,
  2. Map<String, dynamic> map
)

验证签名的post 请求

Implementation

static Future<WitsystemError> authPost(
    String url, Map<String, dynamic> map) async {
  String nonceStr = StringUtil.getRandomString(16);
  int timeStamp = DateTime.now().millisecondsSinceEpoch;
  String body = convert.json.encode(map);
  String str = WitsystemConfig().appId +
      "\n" +
      WitsystemConfig().token +
      "\n" +
      timeStamp.toString() +
      "\n" +
      nonceStr +
      "\n" +
      body +
      "\n";
  _options.headers = {
    "appId": WitsystemConfig().appId,
    "token": WitsystemConfig().token,
    "sign": RSAUtil.sign(
        RSAUtil.creatdParseKey(WitsystemConfig().rsaPrivateKey), str),
    "nonceStr": nonceStr,
    "timeStamp": timeStamp,
  };
  _dio.options = _options;
  return await _ask(url, body);
}