51 lines
1.5 KiB
Rust
51 lines
1.5 KiB
Rust
//! What goes back to Fabrica, sealed to the request's `pub` (docs/TEAM.md, "The reply").
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use crate::proof::Proof;
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(deny_unknown_fields)]
|
|
pub struct ReplyKey {
|
|
pub id: String,
|
|
/// `minisign.pub` text, `cosign.pub` PEM, or a certificate PEM.
|
|
pub public: String,
|
|
}
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(deny_unknown_fields)]
|
|
pub struct ReplySigner {
|
|
pub member: String,
|
|
pub name: String,
|
|
}
|
|
|
|
/// `sign.reply` v1.
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(deny_unknown_fields)]
|
|
pub struct SignReply {
|
|
pub v: u32,
|
|
pub op: String,
|
|
/// The request hash (hex).
|
|
pub request: String,
|
|
pub format: String,
|
|
/// The envelope (docs/TEAM.md, "Signature envelopes").
|
|
pub signature: String,
|
|
/// cosign only: the payload that was signed.
|
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
pub payload: Option<String>,
|
|
pub key: ReplyKey,
|
|
pub signer: ReplySigner,
|
|
pub proof: Proof,
|
|
/// The deployment ticket (core 0.18.1): 32 random bytes, base64, for the `mac` of this deployment's
|
|
/// `target.request`s. Secret: it travels only inside the sealed reply; never log it.
|
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
pub ticket: Option<String>,
|
|
}
|
|
|
|
impl SignReply {
|
|
/// The bytes the proof's `signature` hashes: the envelope as text.
|
|
pub fn envelope(&self) -> &[u8] {
|
|
self.signature.as_bytes()
|
|
}
|
|
}
|