calculateClientSecretHash static method

String calculateClientSecretHash(
  1. String userName,
  2. String clientId,
  3. String clientSecret
)

Translated from library aws-android-sdk-cognitoprovider@2.6.30 file CognitoSecretHash.java::getSecretHash()

Implementation

static String calculateClientSecretHash(
    String userName, String clientId, String clientSecret) {
  final hmac = Hmac(sha256, utf8.encode(clientSecret));
  final digest = hmac.convert(utf8.encode(userName + clientId));
  hmac.convert(digest.bytes);
  return base64.encode(digest.bytes);
}