encodeKey method

  1. @override
String encodeKey(
  1. List<int> pubKey
)
override

Overrides the base class method to encode a public key as a Near Protocol address.

Implementation

@override
String encodeKey(List<int> pubKey) {
  /// Validate and get the Ed25519 public key.
  final pubKeyObj = AddrKeyValidator.validateAndGetEd25519Key(pubKey);

  /// Encode the public key as a hexadecimal representation and remove the '0x' prefix.
  return StringUtils.strip0x(
    BytesUtils.toHexString(pubKeyObj.compressed),
  ).substring(2);
}