1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// SPDX-FileCopyrightText: 2022 Profian Inc. <opensource@profian.com>
// SPDX-License-Identifier: Apache-2.0 OR MIT
//! Streamed encoding/decoding types
//!
//! **SECURITY NOTE**: DO NOT use these types for decoding secrets.
//!
//! These types are useful for streams feeding into JWS or JWE. However, since
//! they report invalid base64 errors for each block, this could be used in a
//! timing attack if used to decode secrets.
//!
//! ```
//! use jose_b64::stream::{Decoder, Encoder, Update};
//! use jose_b64::base64ct::Base64UrlUnpadded;
//!
//! let mut enc: Encoder<String, Base64UrlUnpadded> = Encoder::default();
//! enc.update("Hello world!").unwrap();
//! let encoded = enc.finish().unwrap();
//! assert_eq!(encoded, "SGVsbG8gd29ybGQh");
//!
//! // If you may need to serialize potentially invalid UTF8 or can't guarantee that your
//! // chunks are at utf8 boundaries, use `Decoder<Vec<u8>, _>` instead
//! let mut dec: Decoder<String, Base64UrlUnpadded> = Decoder::default();
//! dec.update(encoded).unwrap();
//! let decoded = dec.finish().unwrap();
//! assert_eq!(decoded, "Hello world!");
//! ```
use Infallible;
pub use Decoder;
pub use Encoder;
pub use Optional;
pub use Update;
/// A Base64 error.