SecureFlightSerializer class
Serialises / deserialises FlightSession objects to / from encrypted
.eflightlog files.
Encryption uses CryptoEngine (ChaCha20-inspired stream cipher + HMAC-SHA256), applied on top of GZIP-compressed JSON.
Example usage:
final key = CryptoEngine.generateRandomKey();
final crypto = CryptoEngine.withKey(key);
final ser = SecureFlightSerializer(crypto: crypto);
// Write
final file = await ser.writeEncryptedToFile(session, '/tmp/my.eflightlog');
// Read back
final loaded = await ser.readEncryptedFromFile('/tmp/my.eflightlog');
Constructors
- SecureFlightSerializer({required CryptoEngine crypto})
-
const
Properties
- crypto → CryptoEngine
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
fromEncryptedBytes(
Uint8List bytes) → FlightSession -
Decrypts and deserialises a FlightSession from
bytesproduced by toEncryptedBytes. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readEncryptedFromFile(
String filePath) → Future< FlightSession> -
Reads the file at
filePath, decrypts, and deserialises the FlightSession. -
toEncryptedBytes(
FlightSession session) → Uint8List -
Serialises
sessionto an encrypted.eflightlogbyte array. -
toString(
) → String -
A string representation of this object.
inherited
-
writeEncryptedToFile(
FlightSession session, String filePath) → Future< File> -
Serialises
session, encrypts it, and writes the result tofilePath.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
hasEflightMagic(
Uint8List bytes) → bool -
Returns
trueifbytesbegin with the 8-byte.eflightlogmagic header. -
readAutoDetect(
String filePath, {CryptoEngine? crypto}) → Future< FlightSession> -
Reads
filePathand auto-detects whether it is an encrypted.eflightlogor a plain.flightlog.