Expand description
Optional Tokio async helpers for base64-ng.
The crate provides two API tiers:
- read-all/write-all convenience functions, with
*_limitedvariants for peer-controlled request or frame boundaries. - manual
AsyncReadandAsyncWritestreaming 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§
- Decoder
Reader - Async reader that streams Base64 input as decoded bytes.
- Decoder
Writer - Async writer that accepts Base64 bytes and writes decoded bytes to
inner. - Encoder
Reader - Async reader that streams raw bytes as Base64.
- Encoder
Writer - 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_lenBase64 bytes fromreader, decodes them, and writes decoded bytes. - decode_
to_ vec - Decodes
inputinto 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_lenbytes fromreader, encodes them, and writes the encoded output. - encode_
to_ vec - Encodes
inputinto an owned byte vector.