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
dmembers of everyterminal.identifythe device sent.final - input → Uint8List
-
The
dataframes 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.hellowhen a stream connects.getter/setter pair
Methods
-
close(
int code, [String? reason]) → Future< void> -
Closes the current stream with
codeandreason. -
expectToken(
String sessionId, String token) → void -
Expects
tokenas the payload of message 1 on the stream ofsessionId. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sendData(
List< int> bytes) → Future<void> -
Sends
bytesas onedataframe to the device. -
sendExit(
int code) → Future< void> -
Sends
exitwithcode. -
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
scrollbackbetweenreplay_beginandreplay_end. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited