wamu_core/payloads.rs
1//! Types and abstractions for request payloads.
2
3use crate::crypto::{Random32Bytes, Signature, VerifyingKey};
4
5/// An identity authenticated request payload.
6#[derive(Debug, Clone)]
7pub struct IdentityAuthedRequestPayload {
8 /// The command to execute.
9 pub command: &'static str,
10 /// The verifying key of the initiating party.
11 pub verifying_key: VerifyingKey,
12 /// The UTC timestamp at which the request was initiated.
13 pub timestamp: u64,
14 /// A signature of the command and timestamp by the initiating party.
15 pub signature: Signature,
16}
17
18/// An identity rotation challenge response payload.
19#[derive(Debug, Clone)]
20pub struct IdentityRotationChallengeResponsePayload {
21 /// The new verifying key of the initiating party.
22 pub new_verifying_key: VerifyingKey,
23 /// A signature of the identity challenge using the initiating party's current decentralized identity.
24 pub current_signature: Signature,
25 /// A signature of the identity challenge using the initiating party's new decentralized identity.
26 pub new_signature: Signature,
27}
28
29/// A command approval payload.
30#[derive(Debug, Clone)]
31pub struct CommandApprovalPayload {
32 /// An identity challenge fragment from an approving party.
33 pub challenge_fragment: Random32Bytes,
34 /// The verifying key of the approving party.
35 pub verifying_key: VerifyingKey,
36 /// A signature of the identity challenge fragment by the approving party.
37 pub signature: Signature,
38}
39
40/// A command approval payload.
41#[derive(Debug, Clone)]
42pub struct QuorumApprovedChallengeResponsePayload {
43 /// A signature of the identity challenge from a quorum of approving parties by the initiating party.
44 pub signature: Signature,
45 /// The verifying keys of the approving parties that jointly form a quorum with the initiating party.
46 pub approving_quorum: Vec<VerifyingKey>,
47}
48
49/// An encrypted share backup (i.e an encrypted "signing share" and "sub-share", and a random nonce).
50pub struct EncryptedShareBackup {
51 /// An encrypted "signing share".
52 pub signing_share: Vec<u8>,
53 /// An encrypted "sub-share".
54 pub sub_share: (Vec<u8>, Vec<u8>),
55 /// The encryption/decryption nonce.
56 pub nonce: Vec<u8>,
57}