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
//! Byte array serialization utilities for AT Protocol records.
//!
//! This module provides specialized Serde serialization and deserialization functions
//! for byte arrays (`Vec<u8>`), handling base64 encoding as required by the AT Protocol
//! lexicon specifications for binary data fields.
//!
//! ## Usage
//!
//! The `format` module is designed to be used with Serde's `#[serde(with = "...")]` attribute
//! on fields that contain binary data:
//!
//! ```ignore
//! use serde::{Deserialize, Serialize};
//!
//! #[derive(Serialize, Deserialize)]
//! struct Signature {
//! #[serde(rename = "$bytes", with = "atproto_record::bytes::format")]
//! signature: Vec<u8>,
//! }
//! ```
//!
//! ## Base64 Encoding
//!
//! The serialization uses standard base64 encoding (RFC 4648) with padding,
//! compatible with the `$bytes` field format used throughout AT Protocol.
/// Base64 serialization format for byte arrays.
///
/// This module provides serde serialization/deserialization for `Vec<u8>` values,
/// encoding them as base64 strings during JSON serialization and decoding them
/// back to byte vectors during deserialization. This is the standard format
/// for binary data in AT Protocol lexicon structures.