consumeEnvelope static method

Future<(Envelope, RecordBase)> consumeEnvelope(
  1. Uint8List data,
  2. String domain
)

Unmarshals a serialized Envelope and validates its signature using the provided 'domain' string. If validation fails, an error is returned.

Implementation

static Future<(Envelope, RecordBase)> consumeEnvelope( Uint8List data, String domain) async {
  final e = unmarshalEnvelopeFromProto(data);
  await e.validate(domain);
  final rec = PeerRecord.fromProtobufBytes((await e.record()).writeToBuffer());
  return (e, rec);
}