sentc_crypto_common/
file.rs1use alloc::string::String;
2use alloc::vec::Vec;
3
4use serde::{Deserialize, Serialize};
5
6use crate::crypto::SignHead;
7use crate::{FileId, FileSessionId, GeneralIdFormat, PartId, UserId};
8
9#[derive(Serialize, Deserialize)]
19pub enum BelongsToType
20{
21 Group,
22 User,
23 None,
24}
25
26#[derive(Serialize, Deserialize)]
27pub struct FilePartListItem
28{
29 pub part_id: PartId,
30 pub sequence: i32,
31 pub extern_storage: bool,
32}
33
34#[derive(Serialize, Deserialize)]
35pub struct FileData
36{
37 pub file_id: FileId,
38 pub master_key_id: String,
39 pub owner: UserId,
40 pub belongs_to: Option<GeneralIdFormat>, pub belongs_to_type: BelongsToType,
42 pub encrypted_key: String,
43 pub encrypted_key_alg: String,
44 pub encrypted_file_name: Option<String>,
45 pub part_list: Vec<FilePartListItem>,
46}
47
48#[derive(Serialize, Deserialize)]
51pub struct FileRegisterInput
52{
53 pub encrypted_key: String,
54 pub encrypted_key_alg: String,
55 pub master_key_id: String, pub belongs_to_id: Option<GeneralIdFormat>,
57 pub belongs_to_type: BelongsToType,
58 pub encrypted_file_name: Option<String>,
59}
60
61#[derive(Serialize, Deserialize)]
62pub struct FileRegisterOutput
63{
64 pub file_id: FileId,
65 pub session_id: FileSessionId,
66}
67
68#[derive(Serialize, Deserialize)]
69pub struct FileNameUpdate
70{
71 pub encrypted_file_name: Option<String>,
72}
73
74#[derive(Serialize, Deserialize)]
75pub struct FilePartRegisterOutput
76{
77 pub part_id: PartId,
78}
79
80#[derive(Serialize, Deserialize)]
83pub struct FileHead
84{
85 pub key: String,
86 pub sign: Option<SignHead>,
87 pub sym_key_alg: String,
88}