generateHmac static method

Future<String> generateHmac(
  1. String data,
  2. String appSecret
)

Sign the payload with your appSecret. Otherwise the server will deny the request

Implementation

static Future<String> generateHmac(String data, String appSecret) async {
  var key = utf8.encode(appSecret);
  var bytes = utf8.encode(data);

  var hmacSha256 = Hmac(sha256, key);
  var digest = hmacSha256.convert(bytes);

  return digest.toString();
}