toRawBytes method

  1. @override
Uint8List toRawBytes()
override

Return the byte array representation of the Secp256 public key

Implementation

@override
Uint8List toRawBytes() {
  Uint8List buffer = encodeBigIntAsUnsigned(_bn);
  if (buffer.length == SECP256_PUBLIC_KEY_SIZE) {
    return buffer;
  }

  final zeroPad = Uint8List(SECP256_PUBLIC_KEY_SIZE);
  zeroPad.setAll(SECP256_PUBLIC_KEY_SIZE - buffer.length, buffer);
  return zeroPad;
}