Skip to main content

argone_signing/
lib.rs

1// TODO(logo): restore `#![doc(html_logo_url = ".../argone-symbol.svg")]` once argone.dev serves the symbol at a public image URL.
2//! Package signing + two-level trust. Built on ed25519 + blake3.
3pub mod chain;
4pub mod keys;
5pub mod release;
6
7pub use chain::{countersign, verify_chain, Envelope};
8
9/// Package/artifact format version (independently semver'd contract).
10pub const FORMAT_VERSION: u32 = 1;
11
12#[derive(Debug, PartialEq, Eq)]
13pub enum SigError {
14    Json(String),
15    BadLength,
16    BadSignature,
17    UntrustedKey,
18    FormatIncompatible { found: u32 },
19}
20impl std::fmt::Display for SigError {
21    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22        write!(f, "{self:?}")
23    }
24}
25impl std::error::Error for SigError {}
26
27/// blake3(app.wasm ‖ manifest.mpack ‖ release.json) — the signable digest.
28pub fn digest(app_wasm: &[u8], manifest_mpack: &[u8], release_json: &[u8]) -> [u8; 32] {
29    let mut h = blake3::Hasher::new();
30    h.update(app_wasm);
31    h.update(manifest_mpack);
32    h.update(release_json);
33    *h.finalize().as_bytes()
34}