publicKeyToString function

dynamic publicKeyToString(
  1. IKey key
)

Convert key to string (base-58) form

Implementation

publicKeyToString(IKey key) {
  if (key.type == KeyType.k1 && key.data.length == publicKeyDataSize) {
    return keyToString(key, 'K1', 'PUB_K1_');
  } else if (key.type == KeyType.r1 && key.data.length == publicKeyDataSize) {
    return keyToString(key, 'R1', 'PUB_R1_');
  } else {
    throw 'unrecognized public key format';
  }
}