encodeKey method
Encodes a Filecoin address for a public key using the secp256k1 address type.
This method takes a public key represented as a List<int>
, validates it as a
secp256k1 public key, converts it to raw uncompressed bytes, and then encodes
a Filecoin address of the secp256k1 address type. The resulting address is
returned as a string.
Parameters:
- pubKey: The public key to encode as a
List<int>
.
Returns: A string representing the encoded Filecoin address.
Implementation
@override
String encodeKey(List<int> pubKey, [Map<String, dynamic> kwargs = const {}]) {
final pubkey = AddrKeyValidator.validateAndGetSecp256k1Key(pubKey);
final tobytes = pubkey.uncompressed;
return _FilAddrUtils.encodeKeyBytes(tobytes, FillAddrTypes.secp256k1);
}