convertLegacyPublicKey function
If a key is in the legacy format (AM prefix), then convert it to the new format (PUB_K1_).
Leaves other formats untouched
Implementation
String convertLegacyPublicKey(String s) {
if (s.substring(0, 2) == 'AM') {
return publicKeyToString(stringToPublicKey(s));
}
return s;
}