ASTBinaryReader class

Decodes a binary AST image — .avma, for Apollo Virtual Machine Archive — back into a parsed ASTRoot.

The CRC-32 is verified on every read. It detects corruption — a truncated write, bit rot, a mangled transfer — but it is not a defence against anyone: an attacker who edits the file recomputes it in microseconds. Pass a verifier to require a signature made with a key they do not have.

An unsigned image deserves exactly as much trust as the source it came from; loading one and running it is equivalent to running arbitrary code from that source.

Constructors

ASTBinaryReader({ASTBinaryVerifier? verifier, bool verifyChecksum = true})
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
verifier → ASTBinaryVerifier?
Checks the image's signature. When given, the image must be signed and the signature must verify.
final
verifyChecksum → bool
Whether to verify the CRC-32. On by default; turning it off is for forensics and repair tooling, not for loading.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readCodeUnit(Uint8List bytes, {String? id, String? namespace}) → BinaryCodeUnit
Decodes bytes into a CodeUnit whose root is already populated.
readInfo(Uint8List bytes) → ASTBinaryInfo
Reads the header and metadata without decoding the AST.
readRoot(Uint8List bytes) → ASTRoot
Decodes bytes into a fully resolved ASTRoot.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

isASTBinary(Uint8List bytes) → bool
Whether bytes looks like a binary AST image, by its magic.