digifirma/
lib.rs

1/*!
2Easily verify Italian CIE signed files.
3*/
4mod ca;
5mod http_client;
6mod nid_mapping;
7mod verify;
8
9use codice_fiscale::CodiceFiscale;
10pub use verify::verify;
11
12/// A person, i.e. the entity that signs a file
13#[derive(Debug)]
14pub struct Person {
15    /// Name
16    pub name: String,
17    /// Surname
18    pub surname: String,
19    /// Italian fiscal code, useful to get date and place of birth
20    pub fiscal_code: CodiceFiscale,
21    /// The serial number of the ID card
22    pub document_id: String,
23}
24
25/// The result of the verification
26#[derive(Debug)]
27pub struct SignedMessage {
28    /// The file which has been signed.
29    /// This is the unsigned file.
30    pub file: Vec<u8>,
31    /// A list of people who signed this file.
32    pub signers: Vec<Person>,
33}
34
35#[cfg(test)]
36mod tests {
37    /*#[test]
38    fn it_works() {
39        assert_eq!(2 + 2, 4);
40        let file = std::fs::read("prova.p7s").unwrap();
41        println!("{:?}", super::verify(&file).unwrap().signers);
42    }*/
43}