MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / run

Method run

atomic-cli/src/commands/provenance/verify_dsse.rs:23–47  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

21
22impl Command for VerifyDsse {
23 fn run(&self) -> CliResult<()> {
24 let key =
25 PublicKey::from_base32(&self.public_key).map_err(|e| CliError::InvalidArgument {
26 message: e.to_string(),
27 })?;
28 let reader: Box<dyn Read> = match &self.file {
29 Some(path) => Box::new(std::fs::File::open(path).map_err(CliError::Io)?),
30 None => Box::new(std::io::stdin()),
31 };
32 let mut bytes = Vec::new();
33 reader
34 .take(MAX_EXPORT_BYTES as u64 + 1)
35 .read_to_end(&mut bytes)
36 .map_err(CliError::Io)?;
37 let verified =
38 verify_provenance_export(&bytes, &key).map_err(|e| CliError::InvalidArgument {
39 message: e.to_string(),
40 })?;
41 // Deliberately write the authenticated bytes without reserialization,
42 // or a second decode of the original envelope.
43 std::io::stdout()
44 .lock()
45 .write_all(&verified.payload)
46 .map_err(CliError::Io)
47 }
48}

Callers

nothing calls this directly

Calls 4

openFunction · 0.85
verify_provenance_exportFunction · 0.85
stdoutFunction · 0.85
lockMethod · 0.80

Tested by

no test coverage detected