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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// SPDX-FileCopyrightText: 2026 ReallyMe Technologies Limited
//
// SPDX-License-Identifier: MIT OR Apache-2.0
//! Borrowed general CBOR framing, basic validity, and protected encoding.
//!
//! Framing preserves received bytes and has a distinct receipt type from profile
//! validation. Profiles check UTF-8, basic-model key uniqueness, selected float
//! policy, and optional preferred encoding or key ordering. Tag interpretation
//! is explicit; embedded tag-24 bytes are never reconstructed for authentication.
//!
//! Input storage remains with its owner. Use a zeroizing owner for sensitive
//! input and do not log borrowed bytes. Payload-bearing types have no Debug,
//! cloning, or serialization implementation. Encoder outputs zeroize on drop.
//!
//! ```
//! use codec_cbor::general::{validate_exact, Limits, Profile};
//! use zeroize::Zeroizing;
//!
//! // The owner outlives every borrowed receipt and erases the received bytes.
//! let received = Zeroizing::new(vec![0xd8, 0x18, 0x43, 0xa1, 0x01, 0x02]);
//! let item = validate_exact(&received, Profile::preferred(), Limits::default())?;
//! let tagged = item.frame().tagged_bytes()?;
//! assert_eq!(tagged.received_bytes(), received.as_slice());
//! assert_eq!(tagged.payload_bytes(), &[0xa1, 0x01, 0x02]);
//! let embedded = tagged.validate_embedded(Profile::preferred(), Limits::default())?;
//! # Ok::<(), codec_cbor::general::CborError>(())
//! ```
//!
//! Receipts cannot escape the lifetime of the received owner:
//!
//! ```compile_fail
//! use codec_cbor::general::{frame_exact, LengthPolicy, Limits};
//! let receipt;
//! {
//! let received = vec![0x41, 0x01];
//! receipt = frame_exact(&received, Limits::default(), LengthPolicy::DefiniteOnly).unwrap();
//! }
//! let _ = receipt.received_bytes();
//! ```
//!
//! A framing receipt cannot be substituted for a validated item:
//!
//! ```compile_fail
//! use codec_cbor::general::{Frame, Item};
//! fn validated(frame: Frame<'_>) -> Item<'_> { frame }
//! ```
//!
//! Payload-bearing receipts and protected output deliberately omit diagnostics
//! and duplication traits:
//!
//! ```compile_fail
//! use codec_cbor::general::{frame_exact, LengthPolicy, Limits};
//! let receipt = frame_exact(&[0x00], Limits::default(), LengthPolicy::DefiniteOnly).unwrap();
//! let _ = format!("{receipt:?}");
//! ```
//!
//! ```compile_fail
//! use codec_cbor::general::{encode, Limits, Profile, ValueRef};
//! let output = encode(&ValueRef::Unsigned(0), Profile::preferred(), Limits::default()).unwrap();
//! let _ = output.clone();
//! ```
pub use Cursor;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;