FakeHost class final

A host service in memory with a static X25519 key: reads message 1, checks its payload against the expected session token, answers message 2, records every frame of the device and sends data, exit, replay_begin and replay_end or closes the stream with any code.

final host = await FakeHost.create(hostId: hostId);
final transport = FakeTerminalTransport(host);
host.expectToken(sessionId, 'token');

Properties

connections ↔ int
The number of streams that connected so far.
getter/setter pair
deviceMessages ↔ int
The number of messages the device has put on any stream so far (counted when sent, not when the host has read them).
getter/setter pair
frames → List<TerminalFrame>
Every frame the device sent after the handshake, in order, over all streams.
final
frameSentAt → List<int>
For every entry of frames, the value of deviceMessages when the device sent it.
final
handshake ↔ FakeHostHandshake
How the host answers message 1.
getter/setter pair
handshakeDone → bool
Whether the current stream completed the handshake.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hostId → String
The ID of the host (the prologue's host ID).
final
identifies → List<Map<String, Object?>>
The d members of every terminal.identify the device sent.
final
input → Uint8List
The data frames of the device as bytes, concatenated.
no setter
noisePublicKey → String
The static key as Host.noise_public_key (base64url without padding).
final
openStreams → int
The number of streams that neither side has closed yet.
no setter
protocolVersions ↔ List<int>
The protocol versions announced in hello.
getter/setter pair
rejectedTokens → List<String>
The payloads of message 1 that did not match the expected token.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sendHello ↔ bool
Whether the host sends terminal.hello when a stream connects.
getter/setter pair

Methods

close(int code, [String? reason]) → Future<void>
Closes the current stream with code and reason.
expectToken(String sessionId, String token) → void
Expects token as the payload of message 1 on the stream of sessionId.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sendData(List<int> bytes) → Future<void>
Sends bytes as one data frame to the device.
sendExit(int code) → Future<void>
Sends exit with code.
sendRawEncrypted(List<int> plaintext) → Future<void>
Sends one raw message (no frame encoding) through the transport, for tampering tests.
sendReplay(List<int> scrollback) → Future<void>
Sends scrollback between replay_begin and replay_end.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

create({required String hostId, List<int>? seed}) → Future<FakeHost>
Creates a host with a fixed static key from seed (32 bytes; a default seed when null).