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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// TODO restore #![deny(missing_docs)]

use serde_big_array::big_array;

big_array! { BigArray; }

/// Alias for an array of 32 bytes.
pub type SigningKey = [u8; 32];

/// Alias for an array of 32 bytes.
pub type PresentationIdBytes = [u8; 32];

/// Alias for an array of 96 bytes.
pub type SigningPublicKey = [u8; 96];

/// Serializable wrapper around a credential public key.
#[derive(Copy, Clone, Serialize, Deserialize, Debug)]
pub struct CredentialPublicKey(#[serde(with = "BigArray")] pub SigningPublicKey);

/// Alias for an array of 48 bytes.
pub type ProofBytes = [u8; 48];

/// Serializable wrapper around a proof.
#[derive(Copy, Clone, Serialize, Deserialize, Debug)]
pub struct CredentialProof(#[serde(with = "BigArray")] pub ProofBytes);

/// Alias for an array of Nonce::BYTES length.
pub type ProofRequestId = [u8; Nonce::BYTES];

/// Alias for an array of Nonce::BYTES length.
pub type OfferId = [u8; Nonce::BYTES];

mod attribute;
mod attribute_schema;
mod attribute_type;
mod error;
mod ext;
mod fragment1;
mod fragment2;
mod offer;
mod presentation;
mod presentation_manifest;
mod request;
mod schema;
mod traits;
mod util;

pub use attribute::*;
pub use attribute_schema::*;
pub use attribute_type::*;
pub use error::*;
pub use ext::*;
pub use fragment1::*;
pub use fragment2::*;
pub use offer::*;
pub use presentation::*;
pub use presentation_manifest::*;
pub use request::*;
pub use schema::*;
use serde::{Deserialize, Serialize};
use signature_bbs_plus::Signature;
use signature_core::nonce::Nonce;
pub use traits::*;
use util::*;

/// A credential that can be presented
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Credential {
    /// The signed attributes in the credential
    pub attributes: Vec<CredentialAttribute>,
    /// The cryptographic signature
    pub signature: Signature,
}

/// A credential and fragment 1 pair
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CredentialRequestFragment(pub CredentialRequest, pub CredentialFragment1);