fromSha256toBase64 method
Converts given SHA-256 hash String to Base64 format String.
Throws FormatException if given value
is not a valid SHA-256 hash.
Returns base64 encoded String.
Implementation
String fromSha256toBase64(String value) {
final formattedValue = value.replaceAll(':', '');
if (!isValidSha256Format(formattedValue)) {
throw const FormatException('Value is not SHA-256');
}
final bytes = hex.decode(formattedValue);
final base64Form = base64.encode(bytes);
return base64Form;
}