fromSha256toBase64 method

String fromSha256toBase64(
  1. String value
)

Implementation

String fromSha256toBase64(final String value) {
  final String formattedValue = value.replaceAll(':', '');

  if (!isValidSha256Format(formattedValue)) {
    throw const FormatException('Value is not SHA-256');
  }

  final List<int> bytes = hex.decode(formattedValue);
  final String base64Form = base64.encode(bytes);

  return base64Form;
}