Skip to content

Commit 9d6da4a

Browse files
committed
fix: align counter codes with CESR V2 specification
Revert V1 alignment and off-by-one commits, restore correct V2 codes: Universal codes (unchanged): A=GenericPipeline, C=Attachments, E=ESSR Group codes: K=ControllerIdxSigs, L=WitnessIdxSigs, M=NonTransReceipt, O=FirstSeenReplay, S=SealSourceCouples, T=AnchoringEventSeals, P=PathedMaterial, Z=TSPPayload Fix S/T swap: SealSourceCouples is -S (was -T), AnchoringEventSeals is -T (was -S), matching the published spec at https://trustoverip.github.io/kswg-cesr-specification/
1 parent 105b5f1 commit 9d6da4a

6 files changed

Lines changed: 67 additions & 52 deletions

File tree

cesr/src/group/codes.rs

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ impl DerivationCode for GroupCode {
3535

3636
fn to_str(&self) -> String {
3737
let (code, count) = match self {
38-
GroupCode::IndexedControllerSignatures(count) => ("-A", count),
39-
GroupCode::IndexedWitnessSignatures(count) => ("-B", count),
40-
GroupCode::NontransferableReceiptCouples(count) => ("-C", count),
41-
GroupCode::FirstSeenReplyCouples(count) => ("-E", count),
42-
GroupCode::SealSourceCouples(count) => ("-G", count),
43-
GroupCode::AnchoringEventSeals(count) => ("-I", count),
38+
GroupCode::IndexedControllerSignatures(count) => ("-K", count),
39+
GroupCode::IndexedWitnessSignatures(count) => ("-L", count),
40+
GroupCode::NontransferableReceiptCouples(count) => ("-M", count),
41+
GroupCode::FirstSeenReplyCouples(count) => ("-O", count),
42+
GroupCode::SealSourceCouples(count) => ("-S", count),
43+
GroupCode::AnchoringEventSeals(count) => ("-T", count),
4444
#[cfg(feature = "cesr-proof")]
45-
GroupCode::PathedMaterialQuadruple(len) => ("-L", len),
45+
GroupCode::PathedMaterialQuadruple(len) => ("-P", len),
4646
GroupCode::TSPPayload(len) => ("-Z", len),
4747
};
4848
[code, &adjust_with_num(count.to_owned(), self.soft_size())].join("")
@@ -57,14 +57,21 @@ impl FromStr for GroupCode {
5757
let count_part = s.get(2..4).ok_or(Error::EmptyCodeError)?;
5858
let count = b64_to_num(count_part)?;
5959
match code {
60-
"-A" => Ok(Self::IndexedControllerSignatures(count)),
61-
"-B" => Ok(Self::IndexedWitnessSignatures(count)),
62-
"-C" => Ok(Self::NontransferableReceiptCouples(count)),
63-
"-E" => Ok(Self::FirstSeenReplyCouples(count)),
64-
"-G" => Ok(Self::SealSourceCouples(count)),
65-
"-I" => Ok(Self::AnchoringEventSeals(count)),
60+
"-K" => Ok(Self::IndexedControllerSignatures(count)),
61+
"-L" => Ok(Self::IndexedWitnessSignatures(count)),
62+
"-M" => Ok(Self::NontransferableReceiptCouples(count)),
63+
"-N" => todo!(),
64+
"-O" => Ok(Self::FirstSeenReplyCouples(count)),
6665
#[cfg(feature = "cesr-proof")]
67-
"-L" => Ok(Self::PathedMaterialQuadruple(count)),
66+
"-P" => Ok(Self::PathedMaterialQuadruple(count)),
67+
"-R" => todo!(),
68+
"-S" => Ok(Self::SealSourceCouples(count)),
69+
"-T" => Ok(Self::AnchoringEventSeals(count)),
70+
"-U" => todo!(),
71+
"-V" => todo!(),
72+
"-W" => todo!(),
73+
"-X" => todo!(),
74+
"-Y" => todo!(),
6875
"-Z" => Ok(Self::TSPPayload(count)),
6976
_ => Err(Error::UnknownCodeError),
7077
}
@@ -73,28 +80,28 @@ impl FromStr for GroupCode {
7380

7481
#[test]
7582
pub fn test_group_codes_to_str() -> Result<(), Error> {
76-
assert_eq!(GroupCode::IndexedControllerSignatures(3).to_str(), "-AAD");
77-
assert_eq!(GroupCode::IndexedWitnessSignatures(30).to_str(), "-BAe");
83+
assert_eq!(GroupCode::IndexedControllerSignatures(3).to_str(), "-KAD");
84+
assert_eq!(GroupCode::IndexedWitnessSignatures(30).to_str(), "-LAe");
7885
assert_eq!(
7986
GroupCode::NontransferableReceiptCouples(100).to_str(),
80-
"-CBk"
87+
"-MBk"
8188
);
82-
assert_eq!(GroupCode::FirstSeenReplyCouples(127).to_str(), "-EB_");
83-
assert_eq!(GroupCode::AnchoringEventSeals(4095).to_str(), "-I__");
84-
assert_eq!(GroupCode::SealSourceCouples(0).to_str(), "-GAA");
89+
assert_eq!(GroupCode::FirstSeenReplyCouples(127).to_str(), "-OB_");
90+
assert_eq!(GroupCode::SealSourceCouples(0).to_str(), "-SAA");
91+
assert_eq!(GroupCode::AnchoringEventSeals(4095).to_str(), "-T__");
8592
Ok(())
8693
}
8794

8895
#[test]
8996
pub fn test_group_codes_from_str() -> Result<(), Error> {
90-
assert_eq!(GroupCode::IndexedControllerSignatures(3), "-AAD".parse()?);
91-
assert_eq!(GroupCode::IndexedWitnessSignatures(30), "-BAe".parse()?);
97+
assert_eq!(GroupCode::IndexedControllerSignatures(3), "-KAD".parse()?);
98+
assert_eq!(GroupCode::IndexedWitnessSignatures(30), "-LAe".parse()?);
9299
assert_eq!(
93100
GroupCode::NontransferableReceiptCouples(100),
94-
"-CBk".parse()?
101+
"-MBk".parse()?
95102
);
96-
assert_eq!(GroupCode::AnchoringEventSeals(4095), "-I__".parse()?);
97-
assert_eq!(GroupCode::FirstSeenReplyCouples(127), "-EB_".parse()?);
98-
assert_eq!(GroupCode::SealSourceCouples(0), "-GAA".parse()?);
103+
assert_eq!(GroupCode::SealSourceCouples(0), "-SAA".parse()?);
104+
assert_eq!(GroupCode::FirstSeenReplyCouples(127), "-OB_".parse()?);
105+
assert_eq!(GroupCode::AnchoringEventSeals(4095), "-T__".parse()?);
99106
Ok(())
100107
}

cesr/src/group/parsers.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ pub fn group_code(s: &str) -> nom::IResult<&str, GroupCode> {
2929
}
3030

3131
pub fn parse_group(stream: &str) -> nom::IResult<&str, Group> {
32+
// let first_byte = stream
33+
// .first()
34+
// .ok_or(nom::Err::Error(make_error(stream, ErrorKind::Eof)))?;
35+
// let first_three_bits = check_first_three_bits(first_byte);
36+
// if !(first_three_bits == 0b111 || first_three_bits == 0b001 || first_three_bits == 0b010) {
37+
// // It's not attachment
38+
// return Err(nom::Err::Error(make_error(stream, ErrorKind::IsNot)));
39+
// }
40+
3241
let (rest, group_code) = group_code(stream)?;
3342
Ok(match group_code {
3443
GroupCode::IndexedControllerSignatures(n) => {
@@ -112,7 +121,7 @@ pub fn parse_group(stream: &str) -> nom::IResult<&str, Group> {
112121
#[test]
113122
pub fn test_parse_group() {
114123
use crate::primitives::Timestamp;
115-
let group_str = "-EAB0AAAAAAAAAAAAAAAAAAAAAAA1AAG2022-10-25T12c04c30d175309p00c00";
124+
let group_str = "-OAB0AAAAAAAAAAAAAAAAAAAAAAA1AAG2022-10-25T12c04c30d175309p00c00";
116125
let (_rest, group) = parse_group(group_str).unwrap();
117126
let expected = (
118127
0,
@@ -128,7 +137,7 @@ pub fn test_parse_group() {
128137
fn test_pathed_material() {
129138
use crate::cesr_proof::MaterialPath;
130139

131-
let attached_str = "-LAZ5AABAA-a-AABAAFjjD99-xy7J0LGmCkSE_zYceED5uPF4q7l8J23nNQ64U-oWWulHI5dh3cFDWT4eICuEQCALdh8BO5ps-qx0qBA";
140+
let attached_str = "-PAZ5AABAA-a-KABAAFjjD99-xy7J0LGmCkSE_zYceED5uPF4q7l8J23nNQ64U-oWWulHI5dh3cFDWT4eICuEQCALdh8BO5ps-qx0qBA";
132141
let (_rest, attached_material) = parse_group(attached_str).unwrap();
133142
let expected_path = MaterialPath::create_from_str("-a".into());
134143
if let Group::PathedMaterialQuadruplet(material_path, groups) = attached_material {

cesr/src/universal_codes.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl FromStr for UniversalGroupCode {
4646
let group_code = GenusCountCode::from_str(genus_code)?;
4747
Ok(Self::Genus(group_code))
4848
}
49-
'T' | 'V' => {
49+
'A' | 'B' | 'C' => {
5050
let length = s.get(1..3).ok_or(Error::EmptyCodeError)?;
5151
let quadlets = b64_to_num(length)?;
5252
let special_code = CustomizableCode::from_str(&code.to_string())?;
@@ -150,8 +150,8 @@ impl FromStr for CustomizableCode {
150150
fn from_str(s: &str) -> Result<Self, Self::Err> {
151151
let code = s.get(..1).ok_or(Error::EmptyCodeError)?;
152152
match code {
153-
"T" => Ok(Self::GenericPipeline),
154-
"V" => Ok(Self::Attachments),
153+
"A" => Ok(Self::GenericPipeline),
154+
"C" => Ok(Self::Attachments),
155155
_ => Err(Error::UnknownCodeError),
156156
}
157157
}
@@ -160,8 +160,8 @@ impl FromStr for CustomizableCode {
160160
impl Display for CustomizableCode {
161161
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
162162
match self {
163-
CustomizableCode::GenericPipeline => write!(f, "T"),
164-
CustomizableCode::Attachments => write!(f, "V"),
163+
CustomizableCode::GenericPipeline => write!(f, "A"),
164+
CustomizableCode::Attachments => write!(f, "C"),
165165
}
166166
}
167167
}
@@ -178,7 +178,7 @@ impl FromStr for FixedCode {
178178
fn from_str(s: &str) -> Result<Self, Self::Err> {
179179
let code = s.get(..1).ok_or(Error::EmptyCodeError)?;
180180
match code {
181-
"Z" => Ok(Self::Essr),
181+
"E" => Ok(Self::Essr),
182182
_ => Err(Error::UnknownCodeError),
183183
}
184184
}
@@ -187,7 +187,7 @@ impl FromStr for FixedCode {
187187
impl Display for FixedCode {
188188
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
189189
match self {
190-
FixedCode::Essr => write!(f, "Z"),
190+
FixedCode::Essr => write!(f, "E"),
191191
}
192192
}
193193
}

cesr/src/value.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub fn parse_value(stream: &str) -> IResult<&str, Value> {
4949
let (rest, genus) = genus_code(rest)?;
5050
Ok((rest, Value::VersionGenus(genus)))
5151
}
52-
'T' | 'V' => {
52+
'A' | 'B' | 'C' | 'E' => {
5353
// Universal group code
5454
let (rest, group_code) = short_universal_group_code(rest)?;
5555
let length = group_code.value_size();
@@ -134,7 +134,7 @@ mod tests {
134134

135135
#[test]
136136
fn test_parse_controller_signatures() {
137-
let stream = "-AABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
137+
let stream = "-KABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
138138
let (_, val) = parse_value(stream).unwrap();
139139
let expected_val = Value::SpecificGroup(Group::IndexedControllerSignatures(vec![(
140140
AttachedSignatureCode {
@@ -146,7 +146,7 @@ mod tests {
146146
assert_eq!(val, expected_val);
147147
assert_eq!(val.to_string(), stream);
148148

149-
let stream = "-AACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
149+
let stream = "-KACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
150150
let (_rest, val) = parse_value(stream).unwrap();
151151
let expected_val = Value::SpecificGroup(Group::IndexedControllerSignatures(vec![
152152
(
@@ -167,7 +167,7 @@ mod tests {
167167
assert_eq!(val, expected_val);
168168
assert_eq!(val.to_string(), stream);
169169

170-
let stream_with_extra_data = "-AACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAextra data";
170+
let stream_with_extra_data = "-KACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAextra data";
171171
let (rest, val) = parse_value(stream_with_extra_data).unwrap();
172172
let expected_val = Value::SpecificGroup(Group::IndexedControllerSignatures(vec![
173173
(
@@ -192,12 +192,12 @@ mod tests {
192192
stream_with_extra_data[..stream_with_extra_data.len() - 10]
193193
);
194194

195-
assert!(parse_value("-AABAA0Q7bqPvenjWXo_YIikMBKOg-pghLKwBi1Plm0PEqdv67L1_c6dq9bll7OFnoLp0a74Nw1cBGdjIPcu-yAllHAw").is_ok());
195+
assert!(parse_value("-KABAA0Q7bqPvenjWXo_YIikMBKOg-pghLKwBi1Plm0PEqdv67L1_c6dq9bll7OFnoLp0a74Nw1cBGdjIPcu-yAllHAw").is_ok());
196196
}
197197

198198
#[test]
199199
fn test_parse_groups() {
200-
let attached_str = "-GAC0AAAAAAAAAAAAAAAAAAAAAABEJtQndkvwnMpVGE5oVVbLWSCm-jLviGw1AOOkzBvNwsS0AAAAAAAAAAAAAAAAAAAAAABEJtQndkvwnMpVGE5oVVbLWSCm-jLviGw1AOOkzBvNwsS";
200+
let attached_str = "-SAC0AAAAAAAAAAAAAAAAAAAAAABEJtQndkvwnMpVGE5oVVbLWSCm-jLviGw1AOOkzBvNwsS0AAAAAAAAAAAAAAAAAAAAAABEJtQndkvwnMpVGE5oVVbLWSCm-jLviGw1AOOkzBvNwsS";
201201
let (_rest, attached_sn_dig) = parse_value(attached_str).unwrap();
202202
let expected_value = Value::SpecificGroup(Group::SourceSealCouples(vec![
203203
(
@@ -224,7 +224,7 @@ mod tests {
224224
assert_eq!(attached_sn_dig, expected_value);
225225
assert_eq!(attached_sn_dig.to_string(), attached_str);
226226

227-
let attached_str = "-IABEKC8085pwSwzLwUGzh-HrEoFDwZnCJq27bVp5atdMT9o0AAAAAAAAAAAAAAAAAAAAAAAEKC8085pwSwzLwUGzh-HrEoFDwZnCJq27bVp5atdMT9o-AABAABB5IVZOhEfcH4TBQgOCyMgyQrJujtBBjT8K_zTPk0-FLMtTZuBgXV7jnLw6fDe6FWtzshh2HGCL_H_j4i1b9kF";
227+
let attached_str = "-TABEKC8085pwSwzLwUGzh-HrEoFDwZnCJq27bVp5atdMT9o0AAAAAAAAAAAAAAAAAAAAAAAEKC8085pwSwzLwUGzh-HrEoFDwZnCJq27bVp5atdMT9o-KABAABB5IVZOhEfcH4TBQgOCyMgyQrJujtBBjT8K_zTPk0-FLMtTZuBgXV7jnLw6fDe6FWtzshh2HGCL_H_j4i1b9kF";
228228
let (rest, value) = parse_value(attached_str).unwrap();
229229
let expected_value_1 = Value::SpecificGroup(Group::AnchoringSeals(vec![(
230230
(
@@ -264,7 +264,7 @@ mod tests {
264264
assert_eq!(value, expected_value_2);
265265
assert_eq!(value.to_string(), attached_str[116..]);
266266

267-
let attached_str = "-CABBMrwi0a-Zblpqe5Hg7w7iz9JCKnMgWKu_W9w4aNUL64y0BB6cL0DtDVDW26lgjbQu0_D_Pd_6ovBZj6fU-Qjmm7epVs51jEOOwXKbmG4yUvCSN-DQSYSc7HXZRp8CfAw9DQL";
267+
let attached_str = "-MABBMrwi0a-Zblpqe5Hg7w7iz9JCKnMgWKu_W9w4aNUL64y0BB6cL0DtDVDW26lgjbQu0_D_Pd_6ovBZj6fU-Qjmm7epVs51jEOOwXKbmG4yUvCSN-DQSYSc7HXZRp8CfAw9DQL";
268268
let (_rest, value) = parse_value(attached_str).unwrap();
269269
let expected_value = Value::SpecificGroup(Group::NontransReceiptCouples(vec![(
270270
(
@@ -288,7 +288,7 @@ mod tests {
288288
assert_eq!(value, expected_value);
289289
assert_eq!(value.to_string(), attached_str);
290290

291-
let cesr_attachment = "-AABAAB6P97kZ3al3V3z3VstRtHRPeOrotuqZZUgBl2yHzgpGyOjAXYGinVqWLAMhdmQ089FTSAzqSTBmJzI8RvIezsJ";
291+
let cesr_attachment = "-KABAAB6P97kZ3al3V3z3VstRtHRPeOrotuqZZUgBl2yHzgpGyOjAXYGinVqWLAMhdmQ089FTSAzqSTBmJzI8RvIezsJ";
292292
let (_rest, value) = parse_value(cesr_attachment).unwrap();
293293
let expected_value = Value::SpecificGroup(Group::IndexedControllerSignatures(vec![(
294294
AttachedSignatureCode {
@@ -325,7 +325,7 @@ mod tests {
325325

326326
#[test]
327327
fn test_parse_nested() {
328-
let input = "-TAX-AABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
328+
let input = "-AAX-KABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
329329
let (rest, value) = parse_value(input).unwrap();
330330
match &value {
331331
Value::UniversalGroup(
@@ -357,7 +357,7 @@ mod tests {
357357

358358
#[test]
359359
fn test_parse_stream() {
360-
let input = r#"{"hello":"world"}-TAX-AABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"#;
360+
let input = r#"{"hello":"world"}-AAX-KABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"#;
361361
let (rest, value) = nom::multi::many0(parse_value)(input).unwrap();
362362
assert!(rest.is_empty());
363363
assert_eq!(value.len(), 2);

cesr/tests/client.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub mod test {
1111

1212
#[test]
1313
pub fn test_hello_cesr() {
14-
let cesr_stream = r#"{"name":"John","surname":"Doe"}-CABBPKahcQ56qkcaTNiGjNYUCQyfM3u-NEymzPv6tKFYthx0BC9uKulSSZ6Ta30reEA4kImQBu-wZ4hISXoSSOGKB0lBIpkLaBMjVS16A_KMsxBtE6VbL1Ry9FHJAg7ygdZbqkK"#;
14+
let cesr_stream = r#"{"name":"John","surname":"Doe"}-MABBPKahcQ56qkcaTNiGjNYUCQyfM3u-NEymzPv6tKFYthx0BC9uKulSSZ6Ta30reEA4kImQBu-wZ4hISXoSSOGKB0lBIpkLaBMjVS16A_KMsxBtE6VbL1Ry9FHJAg7ygdZbqkK"#;
1515

1616
let (_rest, values) = parse_all(cesr_stream).unwrap();
1717
assert_eq!(values.len(), 2);
@@ -71,7 +71,7 @@ pub mod test {
7171

7272
assert_eq!(
7373
&cesr_stream,
74-
r#"{"name":"John","surname":"Doe"}-CABBNdamAGCsQq31Uv-08lkBzoO4XLz2qYjJa8CGmj3B1Ea0BDkGKpYn5i5fhRrE57RGGonHMlwmfZBmsIAex6rPXuZqScZY3NPdyP60fDHmGjLy7kQj04vZsFBAyid1XOJxBgG"#
74+
r#"{"name":"John","surname":"Doe"}-MABBNdamAGCsQq31Uv-08lkBzoO4XLz2qYjJa8CGmj3B1Ea0BDkGKpYn5i5fhRrE57RGGonHMlwmfZBmsIAex6rPXuZqScZY3NPdyP60fDHmGjLy7kQj04vZsFBAyid1XOJxBgG"#
7575
);
7676

7777
let (_rest, parsed_data) = parse_all(&cesr_stream).unwrap();
@@ -82,19 +82,19 @@ pub mod test {
8282

8383
#[test]
8484
fn test_incomplete_stream() {
85-
let cesr_stream = r#"{"hello":"world"}-IABEECGIp5CTCJZlZg-kap5Ma04x_tP_xWG90oKRPTW0Geq0AAAAAAAAAAAAAAAAAAAAAAAEECGIp5CTCJZlZg-kap5Ma04x_tP_xWG90oKRPTW0Geq-AABAAArmG_maHPKlUvMXkJfEysM_ej84lWdbtJXYWlrOBkhM1td1idMU0wUIBm5XkaRIw78QmFHUrYoi_kkryhJJy8J-CABBDg3H7Sr-eES0XWXiO8nvMxW6mD_1LxLeE1nuiZxhGp40BBFHf56jD6v15vWezesWY-RPj2ZiXGC-"#;
85+
let cesr_stream = r#"{"hello":"world"}-TABEECGIp5CTCJZlZg-kap5Ma04x_tP_xWG90oKRPTW0Geq0AAAAAAAAAAAAAAAAAAAAAAAEECGIp5CTCJZlZg-kap5Ma04x_tP_xWG90oKRPTW0Geq-KABAAArmG_maHPKlUvMXkJfEysM_ej84lWdbtJXYWlrOBkhM1td1idMU0wUIBm5XkaRIw78QmFHUrYoi_kkryhJJy8J-MABBDg3H7Sr-eES0XWXiO8nvMxW6mD_1LxLeE1nuiZxhGp40BBFHf56jD6v15vWezesWY-RPj2ZiXGC-"#;
8686

8787
let (rest, values) = parse_all(cesr_stream).expect("Invalid CESR stream");
8888
assert_eq!(values.len(), 3);
8989
assert_eq!(
9090
rest,
91-
"-CABBDg3H7Sr-eES0XWXiO8nvMxW6mD_1LxLeE1nuiZxhGp40BBFHf56jD6v15vWezesWY-RPj2ZiXGC-"
91+
"-MABBDg3H7Sr-eES0XWXiO8nvMxW6mD_1LxLeE1nuiZxhGp40BBFHf56jD6v15vWezesWY-RPj2ZiXGC-"
9292
);
9393
}
9494

9595
#[test]
9696
fn test_parse_and_send() {
97-
let input = r#"{"v":"KERI10JSON000188_","t":"icp","d":"EJ11vJy_lLwv-lWGZnjhuWUh4EjMQyyMHRH1-uDAxiLg","i":"EJ11vJy_lLwv-lWGZnjhuWUh4EjMQyyMHRH1-uDAxiLg","s":"0","kt":"1","k":["DA4cgeFcpglZf6fQ7u1j8fMs7GbkOQBzVHhBJlaHQLC9"],"nt":"1","n":["EJMujtnS0x3RGp_kHC2bh3p6cAz_4nKp6E3Yrj2u-Lsh"],"bt":"2","b":["BJq7UABlttINuWJh1Xl2lkqZG4NTdUdqnbFJDa6ZyxCC","BDg1zxxf8u4Hx5IPraZzmStfSCZFZbDzMHjqVcFW5OfP"],"c":[],"a":[]}-AABAADZCv1YufmwIvFbzC9jNoVZx2ZgOF8hzrxcuP9vlhJ0tNAYIvNEh0yKIGtkk1bIhrLIAEScbBmxxPosX-rGSAsD-CABBDg1zxxf8u4Hx5IPraZzmStfSCZFZbDzMHjqVcFW5OfP0BCQwOrc3LZqdYs8OEKhQlP4LpB9AqCVpwyGHCB1nfjrBjSYiWtlcvSYI5Vugh3H3rh0gfDqGHUfRKEQrIXKTWAC-CABBJq7UABlttINuWJh1Xl2lkqZG4NTdUdqnbFJDa6ZyxCC0BCO8ycCB9reZHhv7wT4yEAy-q_IFbCA29ttaU3IcQ1tZAIGNKYNkZMY9EjGfRsq8shizeURuoxdYoRXGscQFVQM{"v":"KERI10JSON000160_","t":"rot","d":"EO3KriXb_p3p4dWuG87UIILNR5CsqNClvuc08oRWaAl5","i":"EJ11vJy_lLwv-lWGZnjhuWUh4EjMQyyMHRH1-uDAxiLg","s":"1","p":"EJ11vJy_lLwv-lWGZnjhuWUh4EjMQyyMHRH1-uDAxiLg","kt":"1","k":["BMUt1GfFIZXF_2dI1AGBEdmHjMDsSQOGSORU3igbzSvD"],"nt":"1","n":["ELSdoQmwS1FA2p0d1rlabH8nogFS_-ehA1D45kAmYkkJ"],"bt":"1","br":[],"ba":[],"a":[]}-AABAABXD4O4zkPCDSSTUPCVfFy3fFN4ycOKfUoGd-WOXHflJIGaU137PE6ututuwU8xClsES5ByLw8ytvZw4I1mXRgL-CABBDg1zxxf8u4Hx5IPraZzmStfSCZFZbDzMHjqVcFW5OfP0BCVRmDSy-EvjDxhQXJuUgWw_XhKZ2hxQxsDMxcz9K67Lqy3g9kGevXhlP3bAbmRZ6dmWiyoA_3rYG20LJX7CA4K-CABBJq7UABlttINuWJh1Xl2lkqZG4NTdUdqnbFJDa6ZyxCC0BDLp2_wVt_GWUNSm9BDizNWgyGCPnSXdiM5tObP3dze5ah1Me-laex_xFDozxq5beWT3XZf56pYYsdjUYv_iFsA{"v"#;
97+
let input = r#"{"v":"KERI10JSON000188_","t":"icp","d":"EJ11vJy_lLwv-lWGZnjhuWUh4EjMQyyMHRH1-uDAxiLg","i":"EJ11vJy_lLwv-lWGZnjhuWUh4EjMQyyMHRH1-uDAxiLg","s":"0","kt":"1","k":["DA4cgeFcpglZf6fQ7u1j8fMs7GbkOQBzVHhBJlaHQLC9"],"nt":"1","n":["EJMujtnS0x3RGp_kHC2bh3p6cAz_4nKp6E3Yrj2u-Lsh"],"bt":"2","b":["BJq7UABlttINuWJh1Xl2lkqZG4NTdUdqnbFJDa6ZyxCC","BDg1zxxf8u4Hx5IPraZzmStfSCZFZbDzMHjqVcFW5OfP"],"c":[],"a":[]}-KABAADZCv1YufmwIvFbzC9jNoVZx2ZgOF8hzrxcuP9vlhJ0tNAYIvNEh0yKIGtkk1bIhrLIAEScbBmxxPosX-rGSAsD-MABBDg1zxxf8u4Hx5IPraZzmStfSCZFZbDzMHjqVcFW5OfP0BCQwOrc3LZqdYs8OEKhQlP4LpB9AqCVpwyGHCB1nfjrBjSYiWtlcvSYI5Vugh3H3rh0gfDqGHUfRKEQrIXKTWAC-MABBJq7UABlttINuWJh1Xl2lkqZG4NTdUdqnbFJDa6ZyxCC0BCO8ycCB9reZHhv7wT4yEAy-q_IFbCA29ttaU3IcQ1tZAIGNKYNkZMY9EjGfRsq8shizeURuoxdYoRXGscQFVQM{"v":"KERI10JSON000160_","t":"rot","d":"EO3KriXb_p3p4dWuG87UIILNR5CsqNClvuc08oRWaAl5","i":"EJ11vJy_lLwv-lWGZnjhuWUh4EjMQyyMHRH1-uDAxiLg","s":"1","p":"EJ11vJy_lLwv-lWGZnjhuWUh4EjMQyyMHRH1-uDAxiLg","kt":"1","k":["BMUt1GfFIZXF_2dI1AGBEdmHjMDsSQOGSORU3igbzSvD"],"nt":"1","n":["ELSdoQmwS1FA2p0d1rlabH8nogFS_-ehA1D45kAmYkkJ"],"bt":"1","br":[],"ba":[],"a":[]}-KABAABXD4O4zkPCDSSTUPCVfFy3fFN4ycOKfUoGd-WOXHflJIGaU137PE6ututuwU8xClsES5ByLw8ytvZw4I1mXRgL-MABBDg1zxxf8u4Hx5IPraZzmStfSCZFZbDzMHjqVcFW5OfP0BCVRmDSy-EvjDxhQXJuUgWw_XhKZ2hxQxsDMxcz9K67Lqy3g9kGevXhlP3bAbmRZ6dmWiyoA_3rYG20LJX7CA4K-MABBJq7UABlttINuWJh1Xl2lkqZG4NTdUdqnbFJDa6ZyxCC0BDLp2_wVt_GWUNSm9BDizNWgyGCPnSXdiM5tObP3dze5ah1Me-laex_xFDozxq5beWT3XZf56pYYsdjUYv_iFsA{"v"#;
9898

9999
let (tx, rx) = std::sync::mpsc::channel();
100100

0 commit comments

Comments
 (0)