encryptEnvelope static method
Create a canonical envelope
Implementation
static Map<String, dynamic> encryptEnvelope(
String plaintext,
String senderId,
String receiverId, {
String? timestamp,
int windowSeconds = 120,
int seq = 1,
}) {
final time = timestamp ?? DateTime.now().toUtc().toIso8601String();
final key = keyResonance(senderId, timestamp: time);
final ct = _drum(utf8.encode(plaintext), time);
final envelope = {
'senderId': senderId,
'receiverId': receiverId,
'timestamp': time,
'window': windowSeconds,
'seq': seq,
'ciphertext': base64.encode(ct),
};
envelope['seal'] = _seal(envelope, key, time);
return envelope;
}