-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabox.did
245 lines (245 loc) · 4.99 KB
/
databox.did
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
type ThumbNail =
record {
file_extension: text;
image: blob;
};
type StreamingToken__1 =
record {
index: nat;
key: text;
};
type StreamingToken =
record {
index: nat;
key: text;
};
type StreamingStrategy = variant {
Callback:
record {
callback:
func (StreamingToken__1) ->
(StreamingCallbackHttpResponse__1) query;
token: StreamingToken__1;
};};
type StreamingCallbackHttpResponse__1 =
record {
body: blob;
token: opt StreamingToken__1;
};
type StreamingCallbackHttpResponse =
record {
body: blob;
token: opt StreamingToken__1;
};
type State =
record {
balance: nat;
memory_size: nat;
stable_memory_size: nat64;
};
type Result_9 =
variant {
err: DataErr;
ok: record {
vec FileExt;
vec FileExt;
vec FileExt;
};
};
type Result_8 =
variant {
err: DataErr;
ok: vec blob;
};
type Result_7 =
variant {
err: DataErr;
ok: vec nat;
};
type Result_6 =
variant {
err: DataErr;
ok: vec principal;
};
type Result_5 =
variant {
err: DataErr;
ok: blob;
};
type Result_4 =
variant {
err: DataErr;
ok: vec FileExt;
};
type Result_3 =
variant {
err: DataErr;
ok: ThumbNail;
};
type Result_2 =
variant {
err: DataErr;
ok: FileExt;
};
type Result_12 =
variant {
err: DataErr;
ok: nat64;
};
type Result_11 =
variant {
err: DataErr;
ok: State;
};
type Result_10 =
variant {
err: DataErr;
ok: nat;
};
type Result_1 =
variant {
err: DataErr;
ok: text;
};
type Result =
variant {
err: DataErr;
ok;
};
type PUT =
variant {
segment:
record {
aes_pub_key: opt text;
chunk: Chunk;
chunk_number: nat;
file_extension: text;
file_key: text;
file_name: text;
order: nat;
total_size: nat64;
};
thumb_nail:
record {
aes_pub_key: opt text;
file_extension: text;
file_key: text;
file_name: text;
image: blob;
};
};
type HttpResponse =
record {
body: blob;
headers: vec HeaderField;
status_code: nat16;
streaming_strategy: opt StreamingStrategy;
};
type HttpRequest =
record {
body: vec nat8;
headers: vec HeaderField;
method: text;
url: text;
};
type HeaderField =
record {
text;
text;
};
type GET =
record {
file_key: text;
flag: nat;
};
type FilePut =
variant {
EncryptFilePut: PUT;
PlainFilePut: PUT;
SharedFilePut:
record {
aes_pub_key: opt text;
description: text;
file_extension: text;
file_key: text;
file_name: text;
isPublic: bool;
other: principal;
};
};
type FileExt =
variant {
EncryptFileExt: AssetExt;
PlainFileExt: AssetExt;
SharedFileExt:
record {
description: text;
file_extension: text;
file_key: text;
file_name: text;
isPublic: bool;
other: principal;
};
};
type DataErr =
variant {
BlobSizeError;
DeviceNotExist;
FileAesPubKeyNotExist;
FileKeyErr;
FilePublic;
FlagErr;
MemoryInsufficient;
PermissionDenied;
ShareRepeat;
SharedNotSet;
SharedRepeat;
UserAccessErr;
};
type DataBox =
service {
avlSM: () -> (Result_12) query;
canisterState: () -> (Result_11) query;
clearall: () -> (Result_1);
cycleBalance: () -> (Result_10) query;
deleteShareFile: (text, principal) -> (Result_1);
deleteSharedFile: (text) -> (Result_1);
deletekey: (text) -> (Result_1);
getAssetextkey: (text) -> (Result_2) query;
getAssetexts: () -> (Result_9) query;
getCipher: (GET) -> (Result_8) query;
getDefaultDeviceShareDap: (text) -> (Result_1) query;
getFailBuffer: (text) -> (Result_7) query;
getFileShareOther: (text) -> (Result_6) query;
getOwner: () -> (principal) query;
getPlain: (GET) -> (Result_5) query;
getShareFiles: () -> (Result_4) query;
getSharedAesPublic: (text) -> (Result_1) query;
getThumbnail: (text) -> (Result_3) query;
getVersion: () -> (nat) query;
http_request: (HttpRequest) -> (HttpResponse) query;
put: (FilePut) -> (Result_2);
setShareFile: (text, principal, text) -> (Result_1);
streamingCallback: (StreamingToken) ->
(StreamingCallbackHttpResponse) query;
upload: (Avatar) -> (Result);
wallet_receive: () -> (nat);
};
type Chunk = record {data: blob;};
type Avatar =
record {
data: blob;
data_type: text;
};
type AssetExt =
record {
aes_pub_key: opt text;
bucket_id: principal;
file_extension: text;
file_key: text;
file_name: text;
need_query_times: nat;
total_size: nat64;
upload_status: bool;
};
service : (principal) -> DataBox