paas_api/
transcrypt.rs

1use libpep::high_level::contexts::{EncryptionContext, PseudonymizationDomain};
2use libpep::high_level::data_types::{EncryptedAttribute, EncryptedPseudonym};
3use libpep::high_level::ops::EncryptedData;
4use serde::{Deserialize, Serialize};
5#[derive(Serialize, Deserialize, Debug)]
6/// An API request to transcrypt a single encrypted pseudonym.
7pub struct PseudonymizationRequest {
8    /// The encrypted pseudonym.
9    pub encrypted_pseudonym: EncryptedPseudonym,
10    /// The domain of the encrypted pseudonym.
11    pub domain_from: PseudonymizationDomain,
12    /// The domain to transcrypt the pseudonym to.
13    pub domain_to: PseudonymizationDomain,
14    /// The session the pseudonym was encrypted in associated with this server.
15    pub session_from: EncryptionContext,
16    /// The session the pseudonym should be decryptable in associated with this server.
17    pub session_to: EncryptionContext,
18}
19#[derive(Serialize, Deserialize)]
20pub struct PseudonymizationResponse {
21    /// The transcrypted pseudonym.
22    pub encrypted_pseudonym: EncryptedPseudonym,
23}
24
25#[derive(Serialize, Deserialize, Debug)]
26/// An API request to transcrypt multiple encrypted pseudonyms.
27pub struct PseudonymizationBatchRequest {
28    /// The encrypted pseudonyms.
29    pub encrypted_pseudonyms: Vec<EncryptedPseudonym>,
30    /// The domain of the encrypted pseudonyms.
31    pub domain_from: PseudonymizationDomain,
32    /// The domain to transcrypt the pseudonyms to.
33    pub domain_to: PseudonymizationDomain,
34    /// The session the pseudonyms were encrypted in associated with this server.
35    pub session_from: EncryptionContext,
36    /// The session the pseudonyms should be decryptable in associated with this server.
37    pub session_to: EncryptionContext,
38}
39
40#[derive(Serialize, Deserialize)]
41pub struct PseudonymizationBatchResponse {
42    /// The transcrypted pseudonyms.
43    /// Watch out: the order of the encrypted pseudonyms will be randomly permuted to break linkability.
44    pub encrypted_pseudonyms: Vec<EncryptedPseudonym>,
45}
46
47#[derive(Serialize, Deserialize, Debug)]
48/// An API request to transcrypt a single encrypted attribute.
49pub struct RekeyRequest {
50    /// The encrypted data.
51    pub encrypted_attribute: EncryptedAttribute,
52    /// The session the attribute was encrypted in associated with this server.
53    pub session_from: EncryptionContext,
54    /// The session the attribute should be decryptable in associated with this server.
55    pub session_to: EncryptionContext,
56}
57#[derive(Serialize, Deserialize)]
58pub struct RekeyResponse {
59    /// The rekeyed attribute
60    pub encrypted_attribute: EncryptedAttribute,
61}
62
63#[derive(Serialize, Deserialize, Debug)]
64/// An API request to transcrypt a single encrypted attribute.
65pub struct RekeyBatchRequest {
66    /// The encrypted datas.
67    pub encrypted_attributes: Vec<EncryptedAttribute>,
68    /// The session the attributes were encrypted in associated with this server.
69    pub session_from: EncryptionContext,
70    /// The session the attributes should be decryptable in associated with this server.
71    pub session_to: EncryptionContext,
72}
73#[derive(Serialize, Deserialize)]
74pub struct RekeyBatchResponse {
75    /// The rekeyed attribute
76    pub encrypted_attributes: Vec<EncryptedAttribute>,
77}
78
79#[derive(Serialize, Deserialize, Debug)]
80/// An API request to transcrypt a single encrypted pseudonym.
81pub struct TranscryptionRequest {
82    /// The encrypted data.
83    pub encrypted: Vec<EncryptedData>,
84    /// The domain of the encrypted pseudonyms.
85    pub domain_from: PseudonymizationDomain,
86    /// The domain to transcrypt the pseudonyms to.
87    pub domain_to: PseudonymizationDomain,
88    /// The session the messages were encrypted in associated with this server.
89    pub session_from: EncryptionContext,
90    /// The session the messages should be decryptable in associated with this server.
91    pub session_to: EncryptionContext,
92}
93#[derive(Serialize, Deserialize)]
94pub struct TranscryptionResponse {
95    /// The transcrypted data (reordered to break linkability).
96    pub encrypted: Vec<EncryptedData>,
97}