1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <hello@stalw.art>
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*/
//! Typestate markers for the signer builders.
//!
//! [`DkimSigner`](crate::dkim::DkimSigner), `ArcSealer` (feature `arc`) and
//! [`Dkim2Signer`](crate::dkim2::Dkim2Signer) carry one of these markers as
//! a type parameter. Each builder method consumes the signer and returns it in
//! the next state, so the compiler rejects a signer that is used before every
//! mandatory field is set:
//!
//! - `DkimSigner` and `ArcSealer`: [`NeedDomain`] (after `from_key`), then
//! [`NeedSelector`] (after `domain`), then [`NeedHeaders`] (after
//! `selector`), then [`Ready`] (after `headers`).
//! - `Dkim2Signer`: [`NeedDomain`], then [`NeedSelector`], then [`Ready`]
//! (after `selector`). DKIM2 does not take a list of signed headers.
//!
//! Only a signer in the [`Ready`] state exposes the optional setters and the
//! signing methods. The markers are zero-sized and carry no data.
/// The signer has a key but no signing domain (`d=` tag) yet.
;
/// The signer has a signing domain but no selector (`s=` tag) yet.
;
/// The signer has a domain and selector but no list of headers to sign
/// (`h=` tag) yet. Used by `DkimSigner` and `ArcSealer` only.
;
/// Every mandatory field is set; the signer can sign messages.
;