Skip to main content

Crate base64_ng_tokio

Crate base64_ng_tokio 

Source
Expand description

Optional Tokio async helpers for base64-ng.

The crate provides two API tiers:

  • read-all/write-all convenience functions, with *_limited variants for peer-controlled request or frame boundaries.
  • manual AsyncRead and AsyncWrite streaming adapters with fixed internal buffers and explicit drop cleanup.

The streaming adapters are implemented as explicit state machines. They do not use async fn internally, so cancellation can only leave data in each adapter’s fixed pending/output buffers; those buffers are cleared on drop.

§Security

The read-all helpers use RAII-guarded temporary Vec<u8> allocations and the normal strict decode path. The guards wipe initialized bytes and spare capacity on ordinary return, I/O error, or future cancellation. They are not constant-time-oriented token validators or high-assurance secret decoders. For secret-bearing async frames, collect a bounded frame under the application’s approved memory policy and decode through base64_ng::ct, staged CT decode, base64-ng-derive, or base64-ng-sanitization.

Structs§

DecoderReader
Async reader that streams Base64 input as decoded bytes.
DecoderWriter
Async writer that accepts Base64 bytes and writes decoded bytes to inner.
EncoderReader
Async reader that streams raw bytes as Base64.
EncoderWriter
Async writer that accepts raw bytes and writes Base64 to the wrapped writer.

Functions§

decode_reader_to_writer
Reads all Base64 bytes from reader, decodes them, and writes decoded bytes.
decode_reader_to_writer_limited
Reads at most max_input_len Base64 bytes from reader, decodes them, and writes decoded bytes.
decode_to_vec
Decodes input into an owned byte vector.
encode_reader_to_writer
Reads all bytes from reader, encodes them, and writes the encoded output.
encode_reader_to_writer_limited
Reads at most max_input_len bytes from reader, encodes them, and writes the encoded output.
encode_to_vec
Encodes input into an owned byte vector.