unmarshal static method

Future<PrivateKey> unmarshal(
  1. Uint8List bytes
)

Creates an EcdsaPrivateKey from its protobuf bytes

Implementation

static Future<p2pkeys.PrivateKey> unmarshal(Uint8List bytes) async {
  final pbKey = pb.PrivateKey.fromBuffer(bytes);

  if (pbKey.type != pb.KeyType.ECDSA) {
    throw FormatException('Not an ECDSA private key');
  }

  return fromRawBytes(Uint8List.fromList(pbKey.data));
}