getSignatureKey function

Future<Uint8List> getSignatureKey(
  1. String dateString,
  2. String secretAccessKey,
  3. String region,
  4. String service,
)

Implementation

Future<Uint8List> getSignatureKey(String dateString, String secretAccessKey,
    String region, String service) async {
  List<int> kDate = Hmac(sha256, utf8.encode('AWS4$secretAccessKey'))
      .convert(utf8.encode(dateString))
      .bytes;
  List<int> kRegion = Hmac(sha256, kDate).convert(utf8.encode(region)).bytes;
  List<int> kService =
      Hmac(sha256, kRegion).convert(utf8.encode(service)).bytes;
  List<int> kSigning =
      Hmac(sha256, kService).convert(utf8.encode('aws4_request')).bytes;

  return Uint8List.fromList(kSigning);
}