Skip to main content

paas_api/
transcrypt.rs

1use libpep::data::json::EncryptedPEPJSONValue;
2use libpep::data::long::{LongEncryptedAttribute, LongEncryptedPseudonym};
3use libpep::data::records::{EncryptedRecord, LongEncryptedRecord};
4use libpep::data::simple::{EncryptedAttribute, EncryptedPseudonym};
5use libpep::factors::{EncryptionContext, PseudonymizationDomain};
6use serde::{Deserialize, Serialize};
7
8#[derive(Serialize, Deserialize, Debug)]
9/// An API request to transcrypt a single encrypted pseudonym.
10pub struct PseudonymizationRequest {
11    /// The encrypted pseudonym.
12    pub encrypted_pseudonym: EncryptedPseudonym,
13    /// The domain of the encrypted pseudonym.
14    pub domain_from: PseudonymizationDomain,
15    /// The domain to transcrypt the pseudonym to.
16    pub domain_to: PseudonymizationDomain,
17    /// The session the pseudonym was encrypted in associated with this server.
18    pub session_from: EncryptionContext,
19    /// The session the pseudonym should be decryptable in associated with this server.
20    pub session_to: EncryptionContext,
21}
22#[derive(Serialize, Deserialize)]
23pub struct PseudonymizationResponse {
24    /// The transcrypted pseudonym.
25    pub encrypted_pseudonym: EncryptedPseudonym,
26}
27
28#[derive(Serialize, Deserialize, Debug)]
29/// An API request to transcrypt a single encrypted pseudonym.
30pub struct LongPseudonymizationRequest {
31    /// The encrypted pseudonym.
32    pub encrypted_pseudonym: LongEncryptedPseudonym,
33    /// The domain of the encrypted pseudonym.
34    pub domain_from: PseudonymizationDomain,
35    /// The domain to transcrypt the pseudonym to.
36    pub domain_to: PseudonymizationDomain,
37    /// The session the pseudonym was encrypted in associated with this server.
38    pub session_from: EncryptionContext,
39    /// The session the pseudonym should be decryptable in associated with this server.
40    pub session_to: EncryptionContext,
41}
42#[derive(Serialize, Deserialize)]
43pub struct LongPseudonymizationResponse {
44    /// The transcrypted pseudonym.
45    pub encrypted_pseudonym: LongEncryptedPseudonym,
46}
47
48#[derive(Serialize, Deserialize, Debug)]
49/// An API request to transcrypt multiple encrypted pseudonyms.
50pub struct PseudonymizationBatchRequest {
51    /// The encrypted pseudonyms.
52    pub encrypted_pseudonyms: Vec<EncryptedPseudonym>,
53    /// The domain of the encrypted pseudonyms.
54    pub domain_from: PseudonymizationDomain,
55    /// The domain to transcrypt the pseudonyms to.
56    pub domain_to: PseudonymizationDomain,
57    /// The session the pseudonyms were encrypted in associated with this server.
58    pub session_from: EncryptionContext,
59    /// The session the pseudonyms should be decryptable in associated with this server.
60    pub session_to: EncryptionContext,
61}
62
63#[derive(Serialize, Deserialize)]
64pub struct PseudonymizationBatchResponse {
65    /// The transcrypted pseudonyms.
66    /// Watch out: the order of the encrypted pseudonyms will be randomly permuted to break linkability.
67    pub encrypted_pseudonyms: Vec<EncryptedPseudonym>,
68}
69
70#[derive(Serialize, Deserialize, Debug)]
71/// An API request to transcrypt multiple encrypted pseudonyms.
72pub struct LongPseudonymizationBatchRequest {
73    /// The encrypted pseudonyms.
74    pub encrypted_pseudonyms: Vec<LongEncryptedPseudonym>,
75    /// The domain of the encrypted pseudonyms.
76    pub domain_from: PseudonymizationDomain,
77    /// The domain to transcrypt the pseudonyms to.
78    pub domain_to: PseudonymizationDomain,
79    /// The session the pseudonyms were encrypted in associated with this server.
80    pub session_from: EncryptionContext,
81    /// The session the pseudonyms should be decryptable in associated with this server.
82    pub session_to: EncryptionContext,
83}
84
85#[derive(Serialize, Deserialize)]
86pub struct LongPseudonymizationBatchResponse {
87    /// The transcrypted pseudonyms.
88    /// Watch out: the order of the encrypted pseudonyms will be randomly permuted to break linkability.
89    pub encrypted_pseudonyms: Vec<LongEncryptedPseudonym>,
90}
91
92#[derive(Serialize, Deserialize, Debug)]
93/// An API request to transcrypt a single encrypted attribute.
94pub struct RekeyRequest {
95    /// The encrypted data.
96    pub encrypted_attribute: EncryptedAttribute,
97    /// The session the attribute was encrypted in associated with this server.
98    pub session_from: EncryptionContext,
99    /// The session the attribute should be decryptable in associated with this server.
100    pub session_to: EncryptionContext,
101}
102#[derive(Serialize, Deserialize)]
103pub struct RekeyResponse {
104    /// The rekeyed attribute
105    pub encrypted_attribute: EncryptedAttribute,
106}
107
108#[derive(Serialize, Deserialize, Debug)]
109/// An API request to transcrypt a single encrypted attribute.
110pub struct LongRekeyRequest {
111    /// The encrypted data.
112    pub encrypted_attribute: LongEncryptedAttribute,
113    /// The session the attribute was encrypted in associated with this server.
114    pub session_from: EncryptionContext,
115    /// The session the attribute should be decryptable in associated with this server.
116    pub session_to: EncryptionContext,
117}
118#[derive(Serialize, Deserialize)]
119pub struct LongRekeyResponse {
120    /// The rekeyed attribute
121    pub encrypted_attribute: LongEncryptedAttribute,
122}
123
124#[derive(Serialize, Deserialize, Debug)]
125/// An API request to transcrypt a single encrypted attribute.
126pub struct RekeyBatchRequest {
127    /// The encrypted datas.
128    pub encrypted_attributes: Vec<EncryptedAttribute>,
129    /// The session the attributes were encrypted in associated with this server.
130    pub session_from: EncryptionContext,
131    /// The session the attributes should be decryptable in associated with this server.
132    pub session_to: EncryptionContext,
133}
134#[derive(Serialize, Deserialize)]
135pub struct RekeyBatchResponse {
136    /// The rekeyed attribute
137    pub encrypted_attributes: Vec<EncryptedAttribute>,
138}
139
140#[derive(Serialize, Deserialize, Debug)]
141/// An API request to transcrypt a single encrypted attribute.
142pub struct LongRekeyBatchRequest {
143    /// The encrypted datas.
144    pub encrypted_attributes: Vec<LongEncryptedAttribute>,
145    /// The session the attributes were encrypted in associated with this server.
146    pub session_from: EncryptionContext,
147    /// The session the attributes should be decryptable in associated with this server.
148    pub session_to: EncryptionContext,
149}
150#[derive(Serialize, Deserialize)]
151pub struct LongRekeyBatchResponse {
152    /// The rekeyed attribute
153    pub encrypted_attributes: Vec<LongEncryptedAttribute>,
154}
155
156#[derive(Serialize, Deserialize, Debug)]
157/// An API request to transcrypt a single encrypted pseudonym.
158pub struct TranscryptionRequest {
159    /// The encrypted data.
160    pub encrypted: EncryptedRecord,
161    /// The domain of the encrypted pseudonyms.
162    pub domain_from: PseudonymizationDomain,
163    /// The domain to transcrypt the pseudonyms to.
164    pub domain_to: PseudonymizationDomain,
165    /// The session the messages were encrypted in associated with this server.
166    pub session_from: EncryptionContext,
167    /// The session the messages should be decryptable in associated with this server.
168    pub session_to: EncryptionContext,
169}
170#[derive(Serialize, Deserialize)]
171pub struct TranscryptionResponse {
172    /// The transcrypted data.
173    pub encrypted: EncryptedRecord,
174}
175
176#[derive(Serialize, Deserialize, Debug)]
177/// An API request to transcrypt a single encrypted pseudonym.
178pub struct LongTranscryptionRequest {
179    /// The encrypted data.
180    pub encrypted: LongEncryptedRecord,
181    /// The domain of the encrypted pseudonyms.
182    pub domain_from: PseudonymizationDomain,
183    /// The domain to transcrypt the pseudonyms to.
184    pub domain_to: PseudonymizationDomain,
185    /// The session the messages were encrypted in associated with this server.
186    pub session_from: EncryptionContext,
187    /// The session the messages should be decryptable in associated with this server.
188    pub session_to: EncryptionContext,
189}
190#[derive(Serialize, Deserialize)]
191pub struct LongTranscryptionResponse {
192    /// The transcrypted data.
193    pub encrypted: LongEncryptedRecord,
194}
195
196#[derive(Serialize, Deserialize, Debug)]
197/// An API request to transcrypt a batch of encrypted data.
198pub struct TranscryptionBatchRequest {
199    /// The encrypted data.
200    pub encrypted: Vec<EncryptedRecord>,
201    /// The domain of the encrypted pseudonyms.
202    pub domain_from: PseudonymizationDomain,
203    /// The domain to transcrypt the pseudonyms to.
204    pub domain_to: PseudonymizationDomain,
205    /// The session the messages were encrypted in associated with this server.
206    pub session_from: EncryptionContext,
207    /// The session the messages should be decryptable in associated with this server.
208    pub session_to: EncryptionContext,
209}
210#[derive(Serialize, Deserialize)]
211pub struct TranscryptionBatchResponse {
212    /// The transcrypted data (reordered to break linkability).
213    pub encrypted: Vec<EncryptedRecord>,
214}
215
216#[derive(Serialize, Deserialize, Debug)]
217/// An API request to transcrypt a single encrypted pseudonym.
218pub struct LongTranscryptionBatchRequest {
219    /// The encrypted data.
220    pub encrypted: Vec<LongEncryptedRecord>,
221    /// The domain of the encrypted pseudonyms.
222    pub domain_from: PseudonymizationDomain,
223    /// The domain to transcrypt the pseudonyms to.
224    pub domain_to: PseudonymizationDomain,
225    /// The session the messages were encrypted in associated with this server.
226    pub session_from: EncryptionContext,
227    /// The session the messages should be decryptable in associated with this server.
228    pub session_to: EncryptionContext,
229}
230#[derive(Serialize, Deserialize)]
231pub struct LongTranscryptionBatchResponse {
232    /// The transcrypted data (reordered to break linkability).
233    pub encrypted: Vec<LongEncryptedRecord>,
234}
235
236#[derive(Serialize, Deserialize, Debug)]
237/// An API request to transcrypt a single encrypted pseudonym.
238pub struct JsonTranscryptionRequest {
239    /// The encrypted data.
240    pub encrypted: EncryptedPEPJSONValue,
241    /// The domain of the encrypted pseudonyms.
242    pub domain_from: PseudonymizationDomain,
243    /// The domain to transcrypt the pseudonyms to.
244    pub domain_to: PseudonymizationDomain,
245    /// The session the messages were encrypted in associated with this server.
246    pub session_from: EncryptionContext,
247    /// The session the messages should be decryptable in associated with this server.
248    pub session_to: EncryptionContext,
249}
250#[derive(Serialize, Deserialize)]
251pub struct JsonTranscryptionResponse {
252    /// The transcrypted data.
253    pub encrypted: EncryptedPEPJSONValue,
254}
255
256#[derive(Serialize, Deserialize, Debug)]
257/// An API request to transcrypt a batch of encrypted data.
258pub struct JsonTranscryptionBatchRequest {
259    /// The encrypted data.
260    pub encrypted: Vec<EncryptedPEPJSONValue>,
261    /// The domain of the encrypted pseudonyms.
262    pub domain_from: PseudonymizationDomain,
263    /// The domain to transcrypt the pseudonyms to.
264    pub domain_to: PseudonymizationDomain,
265    /// The session the messages were encrypted in associated with this server.
266    pub session_from: EncryptionContext,
267    /// The session the messages should be decryptable in associated with this server.
268    pub session_to: EncryptionContext,
269}
270#[derive(Serialize, Deserialize)]
271pub struct JsonTranscryptionBatchResponse {
272    /// The transcrypted data (reordered to break linkability).
273    pub encrypted: Vec<EncryptedPEPJSONValue>,
274}