genTestSig static method

dynamic genTestSig(
  1. String userId,
  2. int sdkAppId,
  3. String secretKey
)

Implementation

static genTestSig(String userId, int sdkAppId, String secretKey) {
  int currTime = _getCurrentTime();
  String sig = '';
  Map<String, dynamic> sigDoc = <String, dynamic>{};
  sigDoc.addAll({
    "TLS.ver": "2.0",
    "TLS.identifier": userId,
    "TLS.sdkappid": sdkAppId,
    "TLS.expire": expireTime,
    "TLS.time": currTime,
  });

  sig = _hmacsha256(
    identifier: userId,
    currTime: currTime,
    expire: expireTime,
    sdkAppId: sdkAppId,
    secretKey: secretKey
  );
  sigDoc['TLS.sig'] = sig;
  String jsonStr = json.encode(sigDoc);
  List<int> compress = zlib.encode(utf8.encode(jsonStr));
  return _escape(content: base64.encode(compress));
}