encodeKey method
Returns the encoded address string.
Implementation
@override
String encodeKey(List<int> pubKey) {
if (pubKey.length ==
Ed25519KeysConst.pubKeyByteLen + Ed25519KeysConst.pubKeyPrefix.length) {
pubKey = pubKey.sublist(Ed25519KeysConst.pubKeyPrefix.length);
}
if (pubKey.length != Ed25519KeysConst.pubKeyByteLen) {
throw CoreErrors.missingOrInvalidAddressArguments(
reason: "Invalid encoded address bytes length.",
);
}
final checksumBytes = _AlgoAddrUtils.computeChecksum(pubKey);
final encodedAddress = Base32Encoder.encodeNoPaddingBytes([
...pubKey,
...checksumBytes,
]);
return encodedAddress;
}