credentialHexToBase64 static method
- String credentialHex
credentialIdToBytes32Hex converts a 32 byte credentialAddress hex to a base64 string
Implementation
static String credentialHexToBase64(String credentialHex) {
// Remove the "0x" prefix if present.
if (credentialHex.startsWith("0x")) {
credentialHex = credentialHex.substring(2);
}
List<int> credentialId = hexToBytes(credentialHex);
while (credentialId.isNotEmpty && credentialId[0] == 0) {
credentialId.removeAt(0);
}
return base64Url.encode(credentialId);
}