-
Notifications
You must be signed in to change notification settings - Fork 8
/
space.proto
721 lines (522 loc) · 15.3 KB
/
space.proto
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
syntax = "proto3";
import "google/protobuf/empty.proto";
package space;
option go_package = ".;pb";
//See here for more info about the google.api.http spec: https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L46
// SpaceApi service
service SpaceApi {
// Get all folder or files in the default bucket. It fetches all subdirectories too.
rpc ListDirectories(ListDirectoriesRequest) returns (ListDirectoriesResponse) {
}
// Get the folder or files in the path directory.
// Unlike ListDirectories, this only returns immediate children at path.
rpc ListDirectory(ListDirectoryRequest) returns (ListDirectoryResponse) {
}
// Generate Key Pair for current account.
// This will return error if daemon account already has keypairs
rpc GenerateKeyPair(GenerateKeyPairRequest) returns (GenerateKeyPairResponse) {
}
rpc GetStoredMnemonic(GetStoredMnemonicRequest) returns (GetStoredMnemonicResponse) {
}
// Restores a keypair given a mnemonic.
// This will override any existing key pair
rpc RestoreKeyPairViaMnemonic(RestoreKeyPairViaMnemonicRequest) returns (RestoreKeyPairViaMnemonicResponse) {
}
rpc DeleteKeyPair(DeleteKeyPairRequest) returns (DeleteKeyPairResponse) {
}
// Force Generation of KeyPair. This will override existing keys stored in daemon.
rpc GenerateKeyPairWithForce(GenerateKeyPairRequest) returns (GenerateKeyPairResponse) {
}
rpc GetPublicKey(GetPublicKeyRequest) returns (GetPublicKeyResponse) {
}
// Subscribe to file events. This streams responses to the caller
rpc Subscribe(google.protobuf.Empty) returns (stream FileEventResponse) {
}
// Subscribe to textile events. This streams responses to the caller
rpc TxlSubscribe(google.protobuf.Empty) returns (stream TextileEventResponse) {
}
// Open a file in the daemon.
// Daemon keeps track of all open files and closes them if no activity is noticed after a while
rpc OpenFile(OpenFileRequest) returns (OpenFileResponse) {
}
// Removes a file or dir from a bucket
rpc RemoveDirOrFile(RemoveDirOrFileRequest) returns (RemoveDirOrFileResponse) {
}
// Generates a copy of the file that's accessible through IPFS gateways
rpc GeneratePublicFileLink(GeneratePublicFileLinkRequest) returns (GeneratePublicFileLinkResponse) {
}
// Gets the files that are shared with this recipient
rpc GetSharedWithMeFiles(GetSharedWithMeFilesRequest) returns (GetSharedWithMeFilesResponse) {
}
// Gets the files that are shared by the sender
rpc GetSharedByMeFiles(GetSharedByMeFilesRequest) returns (GetSharedByMeFilesResponse) {
}
// Open an encrypted public shared file in the daemon.
// This requires the decryption key and file hash/cid to work
rpc OpenPublicFile(OpenPublicFileRequest) returns (OpenPublicFileResponse) {
}
// Adds items (files/folders) to be uploaded to the bucket.
rpc AddItems(AddItemsRequest) returns (stream AddItemsResponse) {
}
// Creates a folder/directory at the specified path
rpc CreateFolder(CreateFolderRequest) returns (CreateFolderResponse) {
}
// Toggle FUSE drive to be mounted or unmounted
rpc ToggleFuseDrive(ToggleFuseRequest) returns (FuseDriveResponse) {
}
// Get status of FUSE drive. If mounted or unmounted
rpc GetFuseDriveStatus(google.protobuf.Empty) returns (FuseDriveResponse) {
}
// Create a new bucket owned by current user (aka keypair)
rpc CreateBucket(CreateBucketRequest) returns (CreateBucketResponse) {
}
// Backup Key by Passphrase
rpc BackupKeysByPassphrase(BackupKeysByPassphraseRequest) returns (BackupKeysByPassphraseResponse) {
}
// Recover Keys by Passphrase
rpc RecoverKeysByPassphrase(RecoverKeysByPassphraseRequest) returns (RecoverKeysByPassphraseResponse) {
}
// Tests a passphrase to see if it matches the one previously used
rpc TestKeysPassphrase(TestKeysPassphraseRequest) returns (TestKeysPassphraseResponse) {
}
rpc CreateLocalKeysBackup(CreateLocalKeysBackupRequest) returns (CreateLocalKeysBackupResponse) {
}
rpc RecoverKeysByLocalBackup(RecoverKeysByLocalBackupRequest) returns (RecoverKeysByLocalBackupResponse) {
}
// Share bucket
rpc ShareBucket(ShareBucketRequest) returns (ShareBucketResponse) {
}
// Join bucket
rpc JoinBucket(JoinBucketRequest) returns (JoinBucketResponse) {
}
// Share bucket via public key using Textile Hub inboxing
rpc ShareFilesViaPublicKey(ShareFilesViaPublicKeyRequest) returns (ShareFilesViaPublicKeyResponse) {
}
// Remove public keys for shared files in buckets
rpc UnshareFilesViaPublicKey(UnshareFilesViaPublicKeyRequest) returns (UnshareFilesViaPublicKeyResponse) {
}
rpc HandleFilesInvitation(HandleFilesInvitationRequest) returns (HandleFilesInvitationResponse) {
}
rpc NotificationSubscribe(google.protobuf.Empty) returns (stream NotificationEventResponse) {
}
rpc ListBuckets(ListBucketsRequest) returns (ListBucketsResponse) {
}
rpc GetNotifications(GetNotificationsRequest) returns (GetNotificationsResponse) {
}
rpc ReadNotification(ReadNotificationRequest) returns (ReadNotificationResponse) {
}
rpc DeleteAccount(DeleteAccountRequest) returns (DeleteAccountResponse) {
}
rpc ToggleBucketBackup(ToggleBucketBackupRequest) returns (ToggleBucketBackupResponse) {
}
rpc BucketBackupRestore(BucketBackupRestoreRequest) returns (BucketBackupRestoreResponse) {
}
rpc GetUsageInfo(GetUsageInfoRequest) returns (GetUsageInfoResponse) {
}
rpc GetAPISessionTokens(GetAPISessionTokensRequest) returns (GetAPISessionTokensResponse) {
}
// Returns a list of addresses / public keys of clients to which files where shared or received, ordered by date
rpc GetRecentlySharedWith(GetRecentlySharedWithRequest) returns (GetRecentlySharedWithResponse) {
}
// This will set the last read timestamp for the user so that the client
// can check if newer notifications are present for UX
rpc SetNotificationsLastSeenAt(SetNotificationsLastSeenAtRequest) returns (SetNotificationsLastSeenAtResponse) {
}
// Search for files across all users bucket
rpc SearchFiles(SearchFilesRequest) returns (SearchFilesResponse) {
}
// Initialize master app token
// App tokens are used to authorize scoped access to a range of methods
// Master token can only be generated once and has access to all methods
rpc InitializeMasterAppToken(InitializeMasterAppTokenRequest) returns (InitializeMasterAppTokenResponse) {
}
// Generates an app token with scoped access.
rpc GenerateAppToken(GenerateAppTokenRequest) returns (GenerateAppTokenResponse) {
}
}
message SearchFilesRequest {
string query = 1;
}
message SearchFilesResponse {
repeated SearchFilesDirectoryEntry entries = 1;
string query = 2;
}
message SearchFilesDirectoryEntry {
ListDirectoryEntry entry = 1;
string dbId = 2;
string bucket = 3;
}
message SetNotificationsLastSeenAtRequest {
int64 timestamp = 1;
}
message SetNotificationsLastSeenAtResponse {}
message GetSharedWithMeFilesRequest {
string seek = 1;
int64 limit = 2;
}
message GetSharedWithMeFilesResponse {
repeated SharedListDirectoryEntry items = 1;
string nextOffset = 2;
}
message GetSharedByMeFilesRequest {
string seek = 1;
int64 limit = 2;
}
message GetSharedByMeFilesResponse {
repeated SharedListDirectoryEntry items = 1;
string nextOffset = 2;
}
message GetUsageInfoRequest {}
message GetUsageInfoResponse {
uint64 localStarogeUsed = 1;
uint64 localBandwidthUsed = 2;
uint64 spaceStorageUsed = 3;
uint64 spaceBandwidthUsed = 4;
uint64 usageQuota = 5;
}
message ToggleBucketBackupRequest {
string bucket = 1;
bool backup = 2;
}
message ToggleBucketBackupResponse {}
message BucketBackupRestoreRequest {
string bucket = 1;
}
message BucketBackupRestoreResponse {}
message ListDirectoriesRequest {
string bucket = 1;
bool omitMembers = 2;
}
message FileMember {
string publicKey = 1;
string address = 2;
}
message ListDirectoryEntry {
string path = 1;
bool isDir = 2;
string name = 3;
string sizeInBytes = 4;
string created = 5;
string updated = 6;
string fileExtension = 7;
string ipfsHash = 8;
bool isLocallyAvailable = 9;
int64 backupCount = 10;
repeated FileMember members = 11;
bool isBackupInProgress = 12;
bool isRestoreInProgress = 13;
}
message SharedListDirectoryEntry {
ListDirectoryEntry entry = 1;
string dbId = 2;
string bucket = 3;
bool isPublicLink = 4;
string sharedBy = 5;
}
message ListDirectoriesResponse {
repeated ListDirectoryEntry entries = 1;
}
message ListDirectoryRequest {
string path = 1;
string bucket = 2;
bool omitMembers = 3;
}
message ListDirectoryResponse {
repeated ListDirectoryEntry entries = 1;
}
message CreateBucketRequest {
string slug = 1;
}
message BucketMember {
string address = 1;
string publicKey = 2;
bool isOwner = 3;
bool hasJoined = 4;
}
message Bucket {
string key = 1;
string name = 2;
string path = 3;
int64 createdAt = 4;
int64 updatedAt = 5;
repeated BucketMember members = 6;
bool isPersonalBucket = 7;
bool isBackupEnabled = 8;
int32 itemsCount = 9;
}
message CreateBucketResponse {
Bucket bucket = 1;
}
message GenerateKeyPairRequest {}
message GenerateKeyPairResponse {
string mnemonic = 1;
}
message GetStoredMnemonicRequest {}
message GetStoredMnemonicResponse {
string mnemonic = 1;
}
message RestoreKeyPairViaMnemonicRequest {
string mnemonic = 1;
}
message RestoreKeyPairViaMnemonicResponse {}
enum EventType {
ENTRY_ADDED = 0;
ENTRY_DELETED = 1;
ENTRY_UPDATED = 2;
ENTRY_BACKUP_IN_PROGRESS = 3;
ENTRY_BACKUP_READY = 4;
ENTRY_RESTORE_IN_PROGRESS = 5;
ENTRY_RESTORE_READY = 6;
FOLDER_ADDED = 7;
FOLDER_DELETED = 8;
FOLDER_UPDATED = 9;
}
message FileEventResponse {
EventType type = 1;
ListDirectoryEntry entry = 2;
string bucket = 3;
string dbId = 4;
}
message TextileEventResponse {
string bucket = 1;
}
message OpenFileRequest {
string path = 1;
string bucket = 2;
string dbId = 3; // optional field to specify shared with me file
}
message OpenFileResponse {
string location = 1;
}
message OpenPublicFileRequest {
string fileCid = 1;
string password = 2;
string filename = 3;
}
message OpenPublicFileResponse {
string location = 1;
}
message AddItemsRequest {
// full paths to file or Folder on FS. Needs to be a location available to the daemon
repeated string sourcePaths = 1;
// target path in bucket.
string targetPath = 2;
// The bucket in which to save the item
string bucket = 3;
}
message AddItemResult {
string sourcePath= 1;
string bucketPath = 2;
string error = 3;
}
message AddItemsResponse {
AddItemResult result = 1;
int64 totalFiles = 2;
int64 totalBytes = 3;
int64 completedFiles = 4;
int64 completedBytes = 5;
}
message CreateFolderRequest {
// target path in bucket to add new empty folder
string path = 1;
// The bucket in which to add the folder
string bucket = 2;
}
// not sure we need to return anything other than an error if we failed
message CreateFolderResponse {
}
enum KeyBackupType {
PASSWORD = 0;
GOOGLE = 1;
TWITTER = 2;
EMAIL = 3;
}
message BackupKeysByPassphraseRequest {
string uuid = 1;
string passphrase = 2;
KeyBackupType type = 3;
}
message BackupKeysByPassphraseResponse {}
message RecoverKeysByPassphraseRequest {
string uuid = 1;
string passphrase = 2;
KeyBackupType type = 3;
}
message RecoverKeysByPassphraseResponse {}
message TestKeysPassphraseRequest {
string uuid = 1;
string passphrase = 2;
}
message TestKeysPassphraseResponse {}
message ThreadInfo {
repeated string addresses = 1;
string key = 2;
}
message ShareBucketRequest {
string bucket = 1;
}
message ShareBucketResponse {
ThreadInfo threadinfo = 1;
}
message JoinBucketRequest {
ThreadInfo threadinfo = 1;
string bucket = 2;
}
message JoinBucketResponse {
bool result = 1;
}
message ShareFilesViaPublicKeyRequest {
repeated string publicKeys = 1;
repeated FullPath paths = 2;
}
message FullPath {
string dbId = 1; // optional field to specify shared with me file
string bucket = 2;
string path = 3;
}
message ShareFilesViaPublicKeyResponse {}
message UnshareFilesViaPublicKeyRequest {
repeated string publicKeys = 1;
repeated FullPath paths = 2;
}
message UnshareFilesViaPublicKeyResponse {}
message GeneratePublicFileLinkRequest {
string bucket = 1;
repeated string itemPaths = 2;
string password = 3;
// optional field to specify db id
// for shared with me files
string dbId = 4;
}
message GeneratePublicFileLinkResponse {
string link = 1;
string fileCid = 2;
}
message ToggleFuseRequest {
bool mountDrive = 1;
}
enum FuseState {
UNSUPPORTED = 0;
NOT_INSTALLED = 1;
UNMOUNTED = 2;
MOUNTED = 3;
}
message FuseDriveResponse {
FuseState state = 1;
string mountPath = 2;
}
message ListBucketsRequest {}
message ListBucketsResponse {
repeated Bucket buckets = 1;
}
enum NotificationType {
UNKNOWN = 0;
INVITATION = 1;
USAGEALERT = 2;
INVITATION_REPLY = 3;
REVOKED_INVITATION = 4;
}
enum InvitationStatus {
PENDING = 0;
ACCEPTED = 1;
REJECTED = 2;
}
message Invitation {
string inviterPublicKey = 1;
string invitationID = 2;
InvitationStatus status = 4;
repeated FullPath itemPaths = 5;
}
message UsageAlert {
int64 used = 1;
int64 limit = 2;
string message = 3;
}
message InvitationAccept {
string invitationID = 2;
}
message RevokedInvitation {
string inviterPublicKey = 1;
repeated FullPath itemPaths = 5;
}
message Notification {
string ID = 1; // underlying message id from textile
string subject = 2;
string body = 3;
oneof relatedObject {
Invitation invitationValue = 4;
UsageAlert usageAlert = 5;
InvitationAccept invitationAccept = 6;
RevokedInvitation revokedInvitation = 7;
}
NotificationType type = 8;
int64 createdAt = 9;
int64 readAt = 10;
}
message HandleFilesInvitationRequest {
string invitationID = 1;
bool accept = 2;
}
message HandleFilesInvitationResponse {}
message NotificationEventResponse {
Notification notification = 1;
}
message GetNotificationsRequest {
string seek = 1;
int64 limit = 2;
}
message GetNotificationsResponse {
repeated Notification notifications= 1;
string nextOffset = 2;
int64 lastSeenAt = 3;
}
message ReadNotificationRequest {
string ID = 1;
}
message ReadNotificationResponse {
}
message GetPublicKeyRequest {}
message GetPublicKeyResponse {
// Public key encoded in hex
string publicKey = 1;
}
message RecoverKeysByLocalBackupRequest {
string pathToKeyBackup = 1;
}
message RecoverKeysByLocalBackupResponse {}
message CreateLocalKeysBackupRequest {
// The path in which to save the backup
string pathToKeyBackup = 1;
}
message CreateLocalKeysBackupResponse {}
message DeleteAccountRequest {}
message DeleteAccountResponse {}
message DeleteKeyPairRequest {}
message DeleteKeyPairResponse {}
message GetAPISessionTokensRequest {}
message GetAPISessionTokensResponse {
string hubToken = 1;
string servicesToken = 2;
}
message GetRecentlySharedWithRequest {}
message GetRecentlySharedWithResponse {
repeated FileMember members = 1;
}
message InitializeMasterAppTokenRequest {}
message InitializeMasterAppTokenResponse {
string appToken = 1;
}
message AllowedMethod {
string methodName = 1;
}
message GenerateAppTokenRequest {
repeated AllowedMethod allowedMethods = 1;
}
message GenerateAppTokenResponse {
string appToken = 1;
}
message RemoveDirOrFileRequest {
string path = 1;
string bucket = 2;
}
message RemoveDirOrFileResponse {}