Skip to main content

securedrop_protocol_minimal/wire/
core.rs

1use crate::FetchResponse;
2use crate::keys::{SignedKeyBundlePublic, SignedLongtermKeyBundle};
3use crate::message::MessagePublicKey;
4use crate::primitives::ristretto255::DHPublicKey;
5use crate::sign::{
6    FpfOnNewsroom, JournalistLongTermKey, NewsroomOnJournalist, Signature, VerifyingKey,
7};
8use alloc::vec::Vec;
9use serde::{Deserialize, Serialize};
10use uuid::Uuid;
11
12/// A journalist's long-term public key material, as carried in the
13/// [`WelcomeBundle`].
14///
15/// Combined with a one-time [`SignedKeyBundlePublic`] (fetched separately
16/// by an ephemeral key request) to reconstruct a `JournalistPublicView` for
17/// encryption.
18#[cfg_attr(not(hax), derive(Serialize, Deserialize))]
19pub struct JournalistLongTermView {
20    pub vk: VerifyingKey,
21    pub signed_longterm_key_bundle: SignedLongtermKeyBundle,
22    pub nr_signature: Signature<NewsroomOnJournalist>,
23}
24
25/// The newsroom "welcome bundle" (step 5): this is everything a sender needs to
26/// begin - the newsroom verifying key, FPF's signature over it, and the roster
27/// of journalists' long-term keys/signatures.
28#[cfg_attr(not(hax), derive(Serialize, Deserialize))]
29pub struct WelcomeBundle {
30    pub newsroom_verifying_key: VerifyingKey,
31    pub fpf_sig: Signature<FpfOnNewsroom>,
32    pub journalists: Vec<JournalistLongTermView>,
33}
34
35/// One journalist's one-time (ephemeral) key bundle. `vk` identifies which
36/// journalist - the server consumes the bundle when it serves it.
37#[cfg_attr(not(hax), derive(Serialize, Deserialize))]
38pub struct JournalistEphemeralKeys {
39    pub vk: VerifyingKey,
40    pub ephemeral: SignedKeyBundlePublic,
41}
42
43/// User (source or journalist) fetches message IDs
44///
45/// This corresponds to step 7 in the spec.
46pub struct MessageChallengeFetchRequest {}
47
48/// Server returns encrypted message IDs
49///
50/// This corresponds to step 7 in the spec.
51#[cfg_attr(not(hax), derive(Serialize, Deserialize))]
52pub struct MessageChallengeFetchResponse {
53    /// Number of message entries returned
54    /// TODO: constant size array
55    pub count: usize,
56    /// Array of FetchResponses, aka (enc_id, pmgdh) pairs, where encid/cid is encrypted message ID and pmgdh (Q) is the group DH share
57    pub messages: Vec<FetchResponse>,
58}
59
60/// User fetches a specific message by ID
61///
62/// This corresponds to step 8 and 10 in the spec.
63pub struct MessageFetchRequest {
64    /// Message ID to fetch
65    pub message_id: Uuid,
66}