encodeKey method
Encodes a Zilliqa blockchain address from a given public key.
Implementation
@override
String encodeKey(List<int> pubKey) {
/// Validate the public key and obtain a secp256k1 key object.
final pubKeyObj = AddrKeyValidator.validateAndGetSecp256k1Key(pubKey);
/// Calculate the SHA-256 hash of the compressed public key.
final keyHash = QuickCrypto.sha256Hash(pubKeyObj.compressed);
/// Encode the Zilliqa blockchain address using Bech32 encoding.
return Bech32Encoder.encode(
AddrKeyValidator.getConfigArg(
CoinsConf.zilliqa.params.addrHrp,
"addrHrp",
),
keyHash.sublist(keyHash.length - ZilAddrConst.sha256ByteLen),
);
}