calculateSignature function

Future<String> calculateSignature(
  1. String key,
  2. String stringToSign
)

Implementation

Future<String> calculateSignature(String key, String stringToSign) async {
  List<int> secretKey = utf8.encode(key);
  List<int> message = utf8.encode(stringToSign);

  Hmac hmacSha256 = Hmac(sha256, secretKey);
  Digest signature = hmacSha256.convert(message);

  return signature.toString();
}