Class NoiseStream

Wraps a normal Stream to add encryption based on the Noise_XX_25519_ChaChaPoly_BLAKE2b protocol.

class NoiseStream
  : vibe.core.stream.Stream;

Constructors

Constructors

NameDescription
this

Fields

Fields

NameTypeDescription
_finalizedbool
_readBufubyte[2048]
_readCiphernoise.NoiseCipherState*
_readDecryptedubyte[]
_streamvibe.core.stream.Stream
_writeBufubyte[2048]
_writeCiphernoise.NoiseCipherState*

Properties

Properties

NameTypeDescription
dataAvailableForRead[get]boolQueries if there is data available for immediate, non-blocking read.
empty[get]boolReturns true iff the end of the input stream has been reached.
leastSize[get]ulongReturns the maximum number of bytes that are known to remain in this stream until the end is reached. After leastSize() bytes have been read, the stream will either have reached EOS and empty() returns true, or leastSize() returns again a number > 0.

Methods

Methods

NameDescription
finalizeFlushes and finalizes the stream. Finalize has to be called on certain types of streams. No writes are possible after a call to finalize().
flushFlushes the stream and makes sure that all data is being written to the output device.
peekReturns a temporary reference to the data that is currently buffered. The returned slice typically has the size leastSize() or 0 if dataAvailableForRead() returns false. Streams that don't have an internal buffer will always return an empty slice. Note that any method invocation on the same stream potentially invalidates the contents of the returned buffer.
readFills the preallocated array 'bytes' with data from the stream.
writeWrites an array of bytes to the stream.
writeNot implemented.
handshake
readAndDecrypt
readPacket