derEncode static method

Uint8List derEncode(
  1. BinaryBlob publicKey
)

Implementation

static Uint8List derEncode(BinaryBlob publicKey) {
  if (publicKey.byteLength != Secp256k1PublicKey.RAW_KEY_LENGTH) {
    final bl = publicKey.byteLength;
    throw "secp256k1 public key must be ${Secp256k1PublicKey.RAW_KEY_LENGTH} bytes long (is $bl)";
  }
  return Uint8List.fromList([
    ...Secp256k1PublicKey.DER_PREFIX,
    ...Uint8List.fromList(publicKey),
  ]);
}