1use std::collections::BTreeMap;
4use std::path::Path;
5
6use async_trait::async_trait;
7
8use crate::{
9 batch, Layout, PreparedSecretError, PreparedSecretStore, Secret, SecretBatch,
10 SecretProposalDigest, SecretTransactionGeneration, SecretTransactionId, SecretTransactionState,
11 MAX_TERMINAL_TRANSACTIONS,
12};
13
14use super::{
15 fixed_sibling, hex_decode, hex_encode, read_bounded, remove_fixed, FileStore, StoreError,
16 MAX_ENTRIES, MAX_FILE_BYTES, MAX_VALUE_BYTES,
17};
18
19pub(super) const HEADER_V2: &str = "# codewandler-connector-secrets file store, v2";
20const RETIRED_PREFIX: &str = "# retired-through ";
21const TRANSACTION_PREFIX: &str = "# transaction ";
22
23#[derive(Clone, PartialEq, Eq)]
24pub(super) enum FileRecord {
25 Prepared(SecretProposalDigest),
26 Committed(SecretProposalDigest),
27 Aborted,
28}
29
30pub(super) struct Candidate {
31 pub(super) id: SecretTransactionId,
32 pub(super) digest: SecretProposalDigest,
33 pub(super) entries: BTreeMap<String, Secret>,
34}
35
36#[derive(Default)]
37pub(super) struct FileTransactions {
38 pub(super) version_two: bool,
39 pub(super) retired_through: u64,
40 pub(super) records: BTreeMap<[u8; 32], FileRecord>,
41 pub(super) candidate: Option<Candidate>,
42}
43
44impl FileTransactions {
45 pub(super) fn prepared(&self) -> Option<(SecretTransactionId, SecretProposalDigest)> {
46 self.records.iter().find_map(|(id, record)| match record {
47 FileRecord::Prepared(digest) => Some((
48 SecretTransactionId::from_protocol_bytes(*id)
49 .expect("v2 parsing rejects zero-generation ids"),
50 *digest,
51 )),
52 FileRecord::Committed(_) | FileRecord::Aborted => None,
53 })
54 }
55
56 pub(super) fn terminal_count(&self) -> usize {
57 self.records
58 .values()
59 .filter(|record| !matches!(record, FileRecord::Prepared(_)))
60 .count()
61 }
62}
63
64pub(super) fn encode_v2(
65 entries: &BTreeMap<String, Secret>,
66 transactions: &FileTransactions,
67) -> Result<String, String> {
68 if transactions.terminal_count() > MAX_TERMINAL_TRANSACTIONS {
69 return Err("the terminal transaction ledger exceeds its fixed capacity".to_owned());
70 }
71 if transactions
72 .records
73 .values()
74 .filter(|record| matches!(record, FileRecord::Prepared(_)))
75 .count()
76 > 1
77 {
78 return Err("the transaction ledger contains more than one prepared record".to_owned());
79 }
80 validate_entries(entries)?;
81
82 let mut rendered = String::new();
83 rendered.push_str(HEADER_V2);
84 rendered.push('\n');
85 rendered.push_str(RETIRED_PREFIX);
86 rendered.push_str(&format!("{:016x}", transactions.retired_through));
87 rendered.push('\n');
88 for (id, record) in &transactions.records {
89 if generation_of(*id) <= transactions.retired_through {
90 return Err(
91 "the transaction ledger contains a record at or below the inclusive retirement fence"
92 .to_owned(),
93 );
94 }
95 rendered.push_str(TRANSACTION_PREFIX);
96 rendered.push_str(&hex_encode(id));
97 match record {
98 FileRecord::Prepared(digest) => {
99 rendered.push_str(" prepared ");
100 rendered.push_str(&hex_encode(&digest.protocol_bytes()));
101 }
102 FileRecord::Committed(digest) => {
103 rendered.push_str(" committed ");
104 rendered.push_str(&hex_encode(&digest.protocol_bytes()));
105 }
106 FileRecord::Aborted => rendered.push_str(" aborted"),
107 }
108 rendered.push('\n');
109 }
110 for (address, secret) in entries {
111 rendered.push_str(address);
112 rendered.push(' ');
113 rendered.push_str(&hex_encode(secret.expose_secret().as_bytes()));
114 rendered.push('\n');
115 }
116 if rendered.len() > MAX_FILE_BYTES {
117 return Err(format!(
118 "the encoded store would exceed the {MAX_FILE_BYTES}-byte limit"
119 ));
120 }
121 Ok(rendered)
122}
123
124pub(super) fn parse_v2<L: Layout>(
125 contents: &str,
126 layout: &L,
127 file: &Path,
128) -> Result<(BTreeMap<String, Secret>, FileTransactions), StoreError> {
129 let mut lines = contents.lines().enumerate();
130 let Some((_, header)) = lines.next() else {
131 return Err(backend(file, "the v2 store is empty"));
132 };
133 if header != HEADER_V2 {
134 return Err(backend(file, "the v2 header is not canonical"));
135 }
136 let Some((_, retired)) = lines.next() else {
137 return Err(backend(file, "the v2 store has no retirement fence"));
138 };
139 let Some(encoded_fence) = retired.strip_prefix(RETIRED_PREFIX) else {
140 return Err(backend(file, "line 2 is not the retirement fence"));
141 };
142 if encoded_fence.len() != 16
143 || encoded_fence
144 .bytes()
145 .any(|byte| !byte.is_ascii_hexdigit() || byte.is_ascii_uppercase())
146 {
147 return Err(backend(
148 file,
149 "line 2 carries a non-canonical retirement fence",
150 ));
151 }
152 let retired_through = u64::from_str_radix(encoded_fence, 16)
153 .map_err(|_| backend(file, "line 2 carries an invalid retirement fence"))?;
154
155 let mut entries = BTreeMap::new();
156 let mut records = BTreeMap::new();
157 let mut saw_entry = false;
158 let mut prior_id: Option<[u8; 32]> = None;
159 let mut prior_address: Option<String> = None;
160 let mut prepared_count = 0usize;
161
162 for (index, raw) in lines {
163 let number = index + 1;
164 if raw.is_empty() {
165 return Err(backend(
166 file,
167 &format!("line {number} is unexpectedly blank"),
168 ));
169 }
170 if let Some(transaction) = raw.strip_prefix(TRANSACTION_PREFIX) {
171 if saw_entry {
172 return Err(backend(
173 file,
174 &format!("line {number} places a transaction after credential entries"),
175 ));
176 }
177 let mut fields = transaction.split(' ');
178 let encoded_id = fields.next().unwrap_or_default();
179 let state = fields.next().unwrap_or_default();
180 let digest = fields.next();
181 if fields.next().is_some() || encoded_id.len() != 64 {
182 return Err(backend(
183 file,
184 &format!("line {number} has an invalid transaction record"),
185 ));
186 }
187 let id_bytes = decode_array::<32>(encoded_id)
188 .ok_or_else(|| backend(file, &format!("line {number} has a non-canonical id")))?;
189 SecretTransactionId::from_protocol_bytes(id_bytes).ok_or_else(|| {
190 backend(
191 file,
192 &format!("line {number} uses the reserved zero generation"),
193 )
194 })?;
195 if generation_of(id_bytes) <= retired_through {
196 return Err(backend(
197 file,
198 &format!(
199 "line {number} contradicts the inclusive retirement fence with an already-retired transaction record"
200 ),
201 ));
202 }
203 if prior_id.is_some_and(|prior| prior >= id_bytes) {
204 return Err(backend(
205 file,
206 &format!("line {number} is not in raw-id order"),
207 ));
208 }
209 prior_id = Some(id_bytes);
210 let record = match (state, digest) {
211 ("prepared", Some(encoded)) => {
212 prepared_count += 1;
213 FileRecord::Prepared(SecretProposalDigest::from_protocol_bytes(
214 decode_array::<32>(encoded).ok_or_else(|| {
215 backend(file, &format!("line {number} has an invalid digest"))
216 })?,
217 ))
218 }
219 ("committed", Some(encoded)) => {
220 FileRecord::Committed(SecretProposalDigest::from_protocol_bytes(
221 decode_array::<32>(encoded).ok_or_else(|| {
222 backend(file, &format!("line {number} has an invalid digest"))
223 })?,
224 ))
225 }
226 ("aborted", None) => FileRecord::Aborted,
227 _ => {
228 return Err(backend(
229 file,
230 &format!("line {number} has an invalid transaction state grammar"),
231 ))
232 }
233 };
234 if records.insert(id_bytes, record).is_some() {
235 return Err(backend(
236 file,
237 &format!("line {number} repeats a transaction id"),
238 ));
239 }
240 continue;
241 }
242
243 saw_entry = true;
244 if raw.starts_with('#') {
245 return Err(backend(
246 file,
247 &format!("line {number} is an unknown v2 record"),
248 ));
249 }
250 let (address, encoded) = raw
251 .split_once(' ')
252 .ok_or_else(|| backend(file, &format!("line {number} expected `<address> <hex>`")))?;
253 if prior_address
254 .as_deref()
255 .is_some_and(|prior| prior >= address)
256 {
257 return Err(backend(
258 file,
259 &format!("line {number} is not in address order"),
260 ));
261 }
262 prior_address = Some(address.to_owned());
263 let reference = layout
264 .parse(address)
265 .map_err(|_| backend(file, &format!("line {number} carries an invalid address")))?;
266 if layout.render(&reference) != address {
267 return Err(backend(
268 file,
269 &format!("line {number} carries a non-canonical address"),
270 ));
271 }
272 if encoded.len() > MAX_VALUE_BYTES * 2 {
273 return Err(backend(
274 file,
275 &format!("line {number} exceeds the value bound"),
276 ));
277 }
278 let value = hex_decode(encoded)
279 .and_then(|bytes| String::from_utf8(bytes).ok())
280 .ok_or_else(|| {
281 backend(
282 file,
283 &format!("line {number} carries an invalid value encoding"),
284 )
285 })?;
286 entries.insert(address.to_owned(), Secret::new(value));
287 }
288
289 if prepared_count > 1 {
290 return Err(backend(
291 file,
292 "the v2 ledger contains more than one prepared record",
293 ));
294 }
295 let terminal_count = records.len().saturating_sub(prepared_count);
296 if terminal_count > MAX_TERMINAL_TRANSACTIONS {
297 return Err(backend(
298 file,
299 "the terminal transaction ledger exceeds capacity",
300 ));
301 }
302 validate_entries(&entries).map_err(|reason| backend(file, &reason))?;
303 let transactions = FileTransactions {
304 version_two: true,
305 retired_through,
306 records,
307 candidate: None,
308 };
309 let canonical = encode_v2(&entries, &transactions).map_err(|reason| backend(file, &reason))?;
310 if canonical != contents {
311 return Err(backend(file, "the v2 store is not in canonical byte form"));
312 }
313 Ok((entries, transactions))
314}
315
316fn validate_entries(entries: &BTreeMap<String, Secret>) -> Result<(), String> {
317 if entries.len() > MAX_ENTRIES {
318 return Err(format!("the store exceeds the {MAX_ENTRIES}-entry limit"));
319 }
320 if entries
321 .values()
322 .any(|secret| secret.expose_secret().len() > MAX_VALUE_BYTES)
323 {
324 return Err(format!(
325 "a credential exceeds the {MAX_VALUE_BYTES}-byte value limit"
326 ));
327 }
328 Ok(())
329}
330
331fn decode_array<const N: usize>(encoded: &str) -> Option<[u8; N]> {
332 if encoded
333 .bytes()
334 .any(|byte| !byte.is_ascii_hexdigit() || byte.is_ascii_uppercase())
335 {
336 return None;
337 }
338 let decoded = hex_decode(encoded)?;
339 decoded.try_into().ok()
340}
341
342fn generation_of(id: [u8; 32]) -> u64 {
343 let mut generation = [0; 8];
344 generation.copy_from_slice(&id[..8]);
345 u64::from_be_bytes(generation)
346}
347
348fn backend(file: &Path, reason: &str) -> StoreError {
349 StoreError::Backend {
350 path: file.display().to_string(),
351 reason: reason.to_owned(),
352 }
353}
354
355#[async_trait]
356impl<L: Layout + Send + Sync> PreparedSecretStore for FileStore<L> {
357 async fn prepare(
358 &self,
359 id: SecretTransactionId,
360 digest: SecretProposalDigest,
361 mutations: &SecretBatch,
362 ) -> Result<SecretTransactionState, PreparedSecretError> {
363 let mut transactions = self.locked_transactions();
364 if retired(&transactions, id) {
365 return Err(PreparedSecretError::Retired);
366 }
367 if let Some((prepared_id, prepared_digest)) = transactions.prepared() {
368 if prepared_id != id {
369 return Err(PreparedSecretError::Busy);
370 }
371 return if prepared_digest == digest {
372 Ok(SecretTransactionState::Prepared)
373 } else {
374 Err(PreparedSecretError::DigestMismatch)
375 };
376 }
377 if let Some(record) = transactions.records.get(&id.key()) {
378 return match record {
379 FileRecord::Committed(existing) if *existing == digest => {
380 Ok(SecretTransactionState::Committed)
381 }
382 FileRecord::Committed(_) => Err(PreparedSecretError::DigestMismatch),
383 FileRecord::Aborted => Err(PreparedSecretError::TransactionIdReused),
384 FileRecord::Prepared(_) => unreachable!("prepared() handled this record"),
385 };
386 }
387 if transactions.terminal_count() >= MAX_TERMINAL_TRANSACTIONS {
388 return Err(PreparedSecretError::Capacity);
389 }
390
391 let entries = self.locked();
392 let mut candidate = entries.clone();
393 batch::apply_to(&mut candidate, &self.layout, mutations)
394 .map_err(|_| PreparedSecretError::InvalidBatch)?;
395 super::validate_transactional_bounds(&candidate, transactions.terminal_count() + 1)
396 .map_err(|_| PreparedSecretError::Capacity)?;
397
398 let mut live_records = transactions.records.clone();
399 live_records.insert(id.key(), FileRecord::Prepared(digest));
400 let live = ledger(transactions.retired_through, live_records.clone());
401 let live_rendered = encode_v2(&entries, &live).map_err(capacity_or_invalid)?;
402
403 let mut stage_records = live_records;
404 stage_records.insert(id.key(), FileRecord::Committed(digest));
405 let stage = ledger(transactions.retired_through, stage_records);
406 let stage_rendered = encode_v2(&candidate, &stage).map_err(capacity_or_invalid)?;
407 let stage_path = fixed_sibling(&self.path, "prepared");
408
409 self.write_rendered_to(&stage_path, &stage_rendered, true)
410 .map_err(|_| PreparedSecretError::Backend)?;
411 self.write_rendered_to(&self.path, &live_rendered, true)
412 .map_err(|_| PreparedSecretError::Backend)?;
413
414 transactions.version_two = true;
415 transactions.records = live.records;
416 transactions.candidate = Some(Candidate {
417 id,
418 digest,
419 entries: candidate,
420 });
421 Ok(SecretTransactionState::Prepared)
422 }
423
424 async fn state(
425 &self,
426 id: SecretTransactionId,
427 ) -> Result<SecretTransactionState, PreparedSecretError> {
428 let mut transactions = self.locked_transactions();
429 let mut entries = self.locked();
430 let mut file = super::platform::open_existing(&self.path)
431 .map_err(|_| PreparedSecretError::Backend)?
432 .ok_or(PreparedSecretError::Backend)?;
433 let contents =
434 read_bounded(&mut file, &self.path).map_err(|_| PreparedSecretError::Backend)?;
435 let (durable_entries, mut durable_transactions) =
436 if contents.lines().next() == Some(HEADER_V2) {
437 parse_v2(&contents, &self.layout, &self.path)
438 .map_err(|_| PreparedSecretError::Backend)?
439 } else {
440 (
441 super::parse(&contents, &self.layout, &self.path)
442 .map_err(|_| PreparedSecretError::Backend)?,
443 FileTransactions::default(),
444 )
445 };
446 super::recover_stage(&self.path, &self.layout, &mut durable_transactions)
447 .map_err(|_| PreparedSecretError::Backend)?;
448 *entries = durable_entries;
449 *transactions = durable_transactions;
450 if retired(&transactions, id) {
451 return Err(PreparedSecretError::Retired);
452 }
453 Ok(match transactions.records.get(&id.key()) {
454 Some(FileRecord::Prepared(_)) => SecretTransactionState::Prepared,
455 Some(FileRecord::Committed(_)) => SecretTransactionState::Committed,
456 Some(FileRecord::Aborted) | None => SecretTransactionState::Absent,
457 })
458 }
459
460 async fn commit(
461 &self,
462 id: SecretTransactionId,
463 ) -> Result<SecretTransactionState, PreparedSecretError> {
464 let mut transactions = self.locked_transactions();
465 if retired(&transactions, id) {
466 return Err(PreparedSecretError::Retired);
467 }
468 if let Some(record) = transactions.records.get(&id.key()) {
469 match record {
470 FileRecord::Committed(_) => return Ok(SecretTransactionState::Committed),
471 FileRecord::Aborted => return Err(PreparedSecretError::TransactionIdReused),
472 FileRecord::Prepared(_) => {}
473 }
474 } else {
475 return Err(PreparedSecretError::NotPrepared);
476 }
477 if transactions
478 .prepared()
479 .is_some_and(|(prepared, _)| prepared != id)
480 {
481 return Err(PreparedSecretError::NotPrepared);
482 }
483 let Some(candidate) = transactions.candidate.as_ref() else {
484 return Err(PreparedSecretError::Backend);
485 };
486 if candidate.id != id {
487 return Err(PreparedSecretError::Backend);
488 }
489
490 let mut entries = self.locked();
491 verify_live(self, &entries, &transactions)?;
492 let mut committed_records = transactions.records.clone();
493 committed_records.insert(id.key(), FileRecord::Committed(candidate.digest));
494 let committed = ledger(transactions.retired_through, committed_records.clone());
495 let expected_stage =
496 encode_v2(&candidate.entries, &committed).map_err(|_| PreparedSecretError::Backend)?;
497 let stage_path = fixed_sibling(&self.path, "prepared");
498 let stage_bytes = read_exact_stage(&stage_path, &self.path)?;
499 if stage_bytes != expected_stage {
500 return Err(PreparedSecretError::Backend);
501 }
502 self.write_rendered_to(&self.path, &stage_bytes, true)
503 .map_err(|_| PreparedSecretError::Backend)?;
504
505 let candidate = transactions.candidate.take().expect("checked above");
506 *entries = candidate.entries;
507 transactions.records = committed_records;
508 transactions.version_two = true;
509 if remove_fixed(&stage_path, &self.path).is_err() {
510 return Err(PreparedSecretError::Backend);
511 }
512 Ok(SecretTransactionState::Committed)
513 }
514
515 async fn abort(
516 &self,
517 id: SecretTransactionId,
518 ) -> Result<SecretTransactionState, PreparedSecretError> {
519 let mut transactions = self.locked_transactions();
520 if retired(&transactions, id) {
521 return Err(PreparedSecretError::Retired);
522 }
523 if let Some(record) = transactions.records.get(&id.key()) {
524 match record {
525 FileRecord::Committed(_) => return Err(PreparedSecretError::AlreadyCommitted),
526 FileRecord::Aborted => return Ok(SecretTransactionState::Absent),
527 FileRecord::Prepared(_) => {}
528 }
529 }
530 if let Some((prepared, _)) = transactions.prepared() {
531 if prepared != id {
532 return Err(PreparedSecretError::Busy);
533 }
534 }
535 if transactions.terminal_count() >= MAX_TERMINAL_TRANSACTIONS {
536 return Err(PreparedSecretError::Capacity);
537 }
538
539 let entries = self.locked();
540 let was_prepared = matches!(
541 transactions.records.get(&id.key()),
542 Some(FileRecord::Prepared(_))
543 );
544 let mut records = transactions.records.clone();
545 records.insert(id.key(), FileRecord::Aborted);
546 let next = ledger(transactions.retired_through, records.clone());
547 let rendered = encode_v2(&entries, &next).map_err(capacity_or_invalid)?;
548 self.write_rendered_to(&self.path, &rendered, true)
549 .map_err(|_| PreparedSecretError::Backend)?;
550
551 transactions.version_two = true;
552 transactions.records = records;
553 transactions.candidate = None;
554 if was_prepared && remove_fixed(&fixed_sibling(&self.path, "prepared"), &self.path).is_err()
555 {
556 return Err(PreparedSecretError::Backend);
557 }
558 Ok(SecretTransactionState::Absent)
559 }
560
561 async fn reclaim(
562 &self,
563 through: SecretTransactionGeneration,
564 ) -> Result<(), PreparedSecretError> {
565 let mut transactions = self.locked_transactions();
566 if transactions.prepared().is_some() {
567 return Err(PreparedSecretError::Busy);
568 }
569 let next_fence = transactions.retired_through.max(through.value());
570 if next_fence == transactions.retired_through {
571 return Ok(());
572 }
573 let mut records = transactions.records.clone();
574 records.retain(|id, _| generation_of(*id) > next_fence);
575 let next = ledger(next_fence, records.clone());
576 let entries = self.locked();
577 let rendered = encode_v2(&entries, &next).map_err(capacity_or_invalid)?;
578 self.write_rendered_to(&self.path, &rendered, true)
579 .map_err(|_| PreparedSecretError::Backend)?;
580 transactions.version_two = true;
581 transactions.retired_through = next_fence;
582 transactions.records = records;
583 Ok(())
584 }
585}
586
587fn ledger(retired_through: u64, records: BTreeMap<[u8; 32], FileRecord>) -> FileTransactions {
588 FileTransactions {
589 version_two: true,
590 retired_through,
591 records,
592 candidate: None,
593 }
594}
595
596fn retired(transactions: &FileTransactions, id: SecretTransactionId) -> bool {
597 id.generation().value() <= transactions.retired_through
598}
599
600fn capacity_or_invalid(reason: String) -> PreparedSecretError {
601 if reason.contains("terminal transaction ledger") || reason.contains("encoded store") {
602 PreparedSecretError::Capacity
603 } else {
604 PreparedSecretError::InvalidBatch
605 }
606}
607
608fn verify_live<L: Layout>(
609 store: &FileStore<L>,
610 entries: &BTreeMap<String, Secret>,
611 transactions: &FileTransactions,
612) -> Result<(), PreparedSecretError> {
613 let expected = encode_v2(entries, transactions).map_err(|_| PreparedSecretError::Backend)?;
614 let mut file = super::platform::open_existing(&store.path)
615 .map_err(|_| PreparedSecretError::Backend)?
616 .ok_or(PreparedSecretError::Backend)?;
617 let found = read_bounded(&mut file, &store.path).map_err(|_| PreparedSecretError::Backend)?;
618 if found == expected {
619 Ok(())
620 } else {
621 Err(PreparedSecretError::Backend)
622 }
623}
624
625fn read_exact_stage(stage: &Path, store: &Path) -> Result<String, PreparedSecretError> {
626 let mut file = super::platform::open_existing(stage)
627 .map_err(|_| PreparedSecretError::Backend)?
628 .ok_or(PreparedSecretError::Backend)?;
629 read_bounded(&mut file, store).map_err(|_| PreparedSecretError::Backend)
630}
631
632#[cfg(test)]
633mod tests {
634 use super::*;
635 use crate::{SecretTransactionGeneration, TenantLayout};
636
637 #[test]
638 fn retired_prepared_and_terminal_records_are_refused_by_parser_and_encoder() {
639 let id = format!("{}{}", "0000000000000001", "aa".repeat(24));
640 let digest = "bb".repeat(32);
641 for record in [
642 format!("# transaction {id} prepared {digest}"),
643 format!("# transaction {id} committed {digest}"),
644 format!("# transaction {id} aborted"),
645 ] {
646 let fixture = format!("{HEADER_V2}\n# retired-through 0000000000000001\n{record}\n");
647 let error = parse_v2(&fixture, &TenantLayout, Path::new("retired.fixture"))
648 .err()
649 .expect("retired record must contradict the inclusive fence");
650 assert!(error.to_string().contains("retirement fence"), "{error}");
651 }
652
653 let generation = SecretTransactionGeneration::from_protocol_bytes([0, 0, 0, 0, 0, 0, 0, 1])
654 .expect("non-zero");
655 let transaction = SecretTransactionId::new(generation, [0xaa; 24]);
656 let proposal = SecretProposalDigest::from_protocol_bytes([0xbb; 32]);
657 for record in [
658 FileRecord::Prepared(proposal),
659 FileRecord::Committed(proposal),
660 FileRecord::Aborted,
661 ] {
662 let mut records = BTreeMap::new();
663 records.insert(transaction.key(), record);
664 let ledger = FileTransactions {
665 version_two: true,
666 retired_through: 1,
667 records,
668 candidate: None,
669 };
670 assert!(encode_v2(&BTreeMap::new(), &ledger)
671 .expect_err("encoder must refuse every retired record state")
672 .contains("inclusive retirement fence"));
673 }
674 }
675}