-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yaml
810 lines (810 loc) · 25.4 KB
/
openapi.yaml
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
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
openapi: 3.0.0
info:
description: Smart Vault API
version: 0.1.0
title: Smart Vault API
termsOfService: 'http://www.lightstreams.network/terms'
license:
name: GPLv3
url: 'https://www.gnu.org/licenses/gpl.html'
paths:
/user/signup:
post:
tags:
- User
summary: signup
description: Create a new user on the gateway
operationId: userSignup
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
account:
type: string
example: '0xE41b5C21671C22f1f054F1896d18b4773Dd9deC0'
description: the account address that was created on the gateway
requestBody:
content:
application/json:
schema:
type: object
required:
- password
properties:
password:
type: string
example: yourpassword
description: request body
required: true
/user/signin:
post:
tags:
- User
summary: signin
description: Sign in a user into the system
operationId: userSignin
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
token:
type: string
example: eyJibG9ja2NoYWluIjoiRVRIIiwiZXRoX2FkZHJlc3MiOiIweDRGNWFERWRDYTZkODY5RTlGNUY3ZENmNEI3QTlkRmE4MjMxYTA5NWYiLCJpYXQiOjI1LCJlYXQiOjEwMjV9.78mSE4Z9SiHO9fcY5vtCZpK-rdDGuJXpW4qEOzyH9-Zy5HySKGVH9aB-j_ixUb0q91S-I9_Cktj_OVl0LcRvmgE
description: the account address that was created on the gateway
requestBody:
content:
application/json:
schema:
type: object
required:
- account
- password
properties:
account:
type: string
example: '0xE41b5C21671C22f1f054F1896d18b4773Dd9deC0'
description: account address
password:
type: string
example: yourpassword
description: the password that unlocks the account
description: Password to sign in the user
required: true
/wallet/balance:
get:
tags:
- Wallet
summary: balance
description: Get wallet balance from an account
operationId: walletBalance
parameters:
- in: query
name: account
description: account
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
balance:
type: string
example: '100'
description: current balance in wei
/wallet/transfer:
post:
tags:
- Wallet
summary: transfer
description: Transfer funds to an account
operationId: walletTransfer
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
balance:
type: string
example: '100'
description: current balance in wei
requestBody:
content:
application/json:
schema:
type: object
required:
- from
- password
- to
- amount_wei
properties:
from:
type: string
example: '0xE41b5C21671C22f1f054F1896d18b4773Dd9deC0'
description: account address to transfer funds from
password:
type: string
example: yourpassword
description: the password that unlocks the account
to:
type: string
example: '0x50c9406f0942711b6e2e28301CE86bFbF42eBE3F'
description: account address to transfer funds to
amount_wei:
type: string
example: '1200000000000000000'
description: amount in wei
description: Password to sign in the user
required: true
/storage/add:
post:
tags:
- Storage
summary: add
description: Add a new file
operationId: storageAdd
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
meta:
type: string
example: 'QmbVtvd1rD9pDHpx7AUqrsh3CoCMW3Na3g4fAwXJxyaawz'
description: address of the file metadata
acl:
type: string
example: '0x7000f85C4065643435E8A350655F3153c7dd030E'
description: address of the ACL for the file
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
file:
description: file to add
type: string
format: binary
owner:
description: file owner address
type: string
password:
description: the password that unlocks the owner
type: string
required:
- file
- owner
- password
/storage/add-with-acl:
post:
tags:
- Storage
summary: add-with-acl
description: Add a new file using an already deployed acl
operationId: storageAddWithAcl
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
meta:
type: string
example: 'QmbVtvd1rD9pDHpx7AUqrsh3CoCMW3Na3g4fAwXJxyaawz'
description: address of the file metadata
acl:
type: string
example: '0x7000f85C4065643435E8A350655F3153c7dd030E'
description: address of the ACL for the file
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
file:
description: file to add
type: string
format: binary
owner:
description: address of the owner of the file
type: string
acl:
description: address of acl smart contract
type: string
required:
- file
- owner
- acl
/storage/add-raw:
post:
tags:
- Storage
summary: add-raw
description: Add a new raw file (text, json, etc.)
operationId: storageAddRaw
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
meta:
type: string
example: 'QmbVtvd1rD9pDHpx7AUqrsh3CoCMW3Na3g4fAwXJxyaawz'
description: address of the file metadata
acl:
type: string
example: '0x7000f85C4065643435E8A350655F3153c7dd030E'
description: address of the ACL for the file
requestBody:
content:
application/json:
schema:
type: object
properties:
data:
description: raw string to add
type: string
format: binary
ext:
description: extension describing the raw content (txt, json, etc.)
type: string
format: binary
owner:
description: address of the owner of the raw content
type: string
password:
description: the password that unlocks the owner
type: string
required:
- data
- ext
- owner
- password
/storage/add-raw-with-acl:
post:
tags:
- Storage
summary: add-raw-with-acl
description: Add a new raw file (text, json, etc.) linked to an existing ACL
operationId: storageAddRawWithAcl
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
meta:
type: string
example: 'QmbVtvd1rD9pDHpx7AUqrsh3CoCMW3Na3g4fAwXJxyaawz'
description: address of the file metadata
acl:
type: string
example: '0x7000f85C4065643435E8A350655F3153c7dd030E'
description: address of the ACL for the file
requestBody:
content:
application/json:
schema:
type: object
properties:
data:
description: raw string to add
type: string
format: binary
ext:
description: extension describing the raw content (txt, json, etc.)
type: string
format: binary
owner:
description: address of the owner of the raw content
type: string
acl:
description: address of acl smart contract
type: string
required:
- data
- ext
- owner
- acl
/storage/update:
post:
tags:
- Storage
summary: update
description: Create a new version of the file, linking to previous file meta and reusing its ACL
operationId: storageUpdate
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
meta:
type: string
example: 'QmbVtvd1rD9pDHpx7AUqrsh3CoCMW3Na3g4fAwXJxyaawz'
description: address of the file metadata
acl:
type: string
example: '0x7000f85C4065643435E8A350655F3153c7dd030E'
description: address of the ACL for the file
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
file:
description: file to add
type: string
format: binary
owner:
description: address of the owner of the new file
type: string
meta:
description: address of the file meta data
type: string
required:
- file
- owner
- meta
/storage/update-raw:
post:
tags:
- Storage
summary: update-raw
description: Create a new version of the file, linking to previous file meta and reusing its ACL
operationId: storageUpdateRaw
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
meta:
type: string
example: 'QmbVtvd1rD9pDHpx7AUqrsh3CoCMW3Na3g4fAwXJxyaawz'
description: address of the file metadata
acl:
type: string
example: '0x7000f85C4065643435E8A350655F3153c7dd030E'
description: address of the ACL for the file
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
data:
description: raw string to add
type: string
format: binary
ext:
description: extension describing the raw content (.txt, .json, etc.)
type: string
format: binary
owner:
description: address of the current file owner
type: string
meta:
description: address of the file meta data
type: string
required:
- data
- ext
- owner
- meta
/storage/meta:
get:
tags:
- Storage
summary: meta
description: Fetch meta data information about file
operationId: storageMeta
parameters:
- in: query
name: meta
description: address of the file meta data
required: true
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
filename:
type: string
example: smart_vault_rocks.txt
description: Original file name
ext:
type: string
example: txt
description: File extension
owner:
type: string
example:
description: File owner address
hash:
type: string
example: 'QmXT5yfwk9zpVHZZ9WYzAFiSV3N2YAx8nFqd5w3t2jrsvo'
description: Hash of the protected file
acl:
type: string
example: '0x7000f85C4065643435E8A350655F3153c7dd030E'
description: Address of the ACL for the file
prev_meta_hash:
type: string
example: ''
description: Address of previous metadata content (in case of update)
/storage/stream:
get:
tags:
- Storage
summary: stream
description: Stream a file
operationId: storageStream
parameters:
- in: query
name: meta
description: address of the file meta data
required: true
schema:
type: string
- in: query
name: token
description: token received after succesfull authentication (/user/signin)
required: true
schema:
type: string
responses:
'200':
description: OK
content:
application/octet-stream:
examples:
response:
value: Smart Vault Rocks!
'500':
description: Internal Server Error
content:
application/json:
schema:
type: object
properties:
error:
type: string
example: {"message":"token 'eyJibG9xxx.yyyGBw' is not valid. token has expired by 56888 blocks. Expiry block 796257, Current block: 853145","code":"ERROR_UNKNOWN"}
description: The reason of the failure
/acl/grant:
post:
tags:
- ACL
summary: grant
description: Grant certain file permissions to an account
operationId: aclGrant
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
is_granted:
type: string
example: 'true'
description: a boolean that is true when the grant was executed succesfully
requestBody:
content:
application/json:
schema:
type: object
required:
- acl
- owner
- password
- to
- permission
properties:
acl:
type: string
example: '0x7251e7005dba3abb0aee4e772a5ff378a8eea885'
description: ACL address obtained after storing a file
owner:
type: string
example: '0xE41b5C21671C22f1f054F1896d18b4773Dd9deC0'
description: account address of file's owner
password:
type: string
example: yourpassword
description: the password that unlocks the account
to:
type: string
example: '0x50c9406f0942711b6e2e28301CE86bFbF42eBE3F'
description: account address that will receive the permissions
permission:
type: string
enum:
- read
- write
- admin
- noaccess
example: read
description: permission type to grant
description: request body
required: true
/acl/grant-public:
post:
tags:
- ACL
summary: grantPublic
description: Grant public access to a file
operationId: aclGrantPublic
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
is_granted:
type: string
example: 'true'
description: a boolean that is true when the grant was executed succesfully
requestBody:
content:
application/json:
schema:
type: object
required:
- acl
- owner
- password
properties:
acl:
type: string
example: '0x7251e7005dba3abb0aee4e772a5ff378a8eea885'
description: ACL address obtained after storing a file
owner:
type: string
example: '0xE41b5C21671C22f1f054F1896d18b4773Dd9deC0'
description: account address of file's owner
password:
type: string
example: yourpassword
description: the password that unlocks the account
description: request body
required: true
/acl/revoke-public:
post:
tags:
- ACL
summary: revokePublic
description: Revoke public access to a file
operationId: aclRevoke
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
is_revoked:
type: string
example: 'true'
description: a boolean that is true when the revoke was executed succesfully
requestBody:
content:
application/json:
schema:
type: object
required:
- acl
- owner
- password
properties:
acl:
type: string
example: '0x7251e7005dba3abb0aee4e772a5ff378a8eea885'
description: ACL address obtained after storing a file
owner:
type: string
example: '0xE41b5C21671C22f1f054F1896d18b4773Dd9deC0'
description: account address of file's owner
password:
type: string
example: yourpassword
description: the password that unlocks the account
description: request body
required: true
/shop/create:
post:
tags:
- Shop
summary: create
description: 'Creates an online shop, smart contract, for selling/buying digital content'
operationId: shopCreate
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
shop:
type: string
example: 0xshopIDF16F003897fb927e22438cb1b820f79879
description: the shop smart contract address
requestBody:
content:
application/json:
schema:
type: object
required:
- from
- password
properties:
from:
type: string
example: '0xE41b5C21671C22f1f054F1896d18b4773Dd9deC0'
description: shop owner account address
password:
type: string
example: yourpassword
description: the password that unlocks the from account
description: request body
required: true
/shop/sell:
post:
tags:
- Shop
summary: sell
description: Puts an ACL permission to digital content for sale in owner's online shop
operationId: shopSell
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
success:
type: string
example: 'true'
description: whenever the ACL is successfully on sale now
requestBody:
content:
application/json:
schema:
type: object
required:
- shop
- from
- password
- acl
- price_wei
properties:
shop:
type: string
example: 0xshopIDF16F003897fb927e22438cb1b820f79879
description: shop contract address
from:
type: string
example: '0xE41b5C21671C22f1f054F1896d18b4773Dd9deC0'
description: shop owner account address
password:
type: string
example: yourpassword
description: the password that unlocks the from account
acl:
type: string
example: '0x32b480cCf1f6ccc6ABd3C1bfEecCd8D12b2Db3f8'
description: the ACL to sell
price_wei:
type: string
example: '1000000000000000000'
description: the ACL price possible buyers must pay to get ACL Read Permission
description: request body
required: true
/shop/buy:
post:
tags:
- Shop
summary: buy
description: Buys the ACL Read Permission to digital content from owner's online shop
operationId: shopBuy
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
success:
type: string
example: 'true'
description: whenever the ACL Read Permission is successfully bought now
requestBody:
content:
application/json:
schema:
type: object
required:
- shop
- from
- password
- acl
properties:
shop:
type: string
example: 0xshopIDF16F003897fb927e22438cb1b820f79879
description: shop contract address
from:
type: string
example: '0xE41b5C21671C22f1f054F1896d18b4773Dd9deC0'
description: account address buying ACL
password:
type: string
example: yourpassword
description: the password that unlocks the from account
acl:
type: string
example: '0x32b480cCf1f6ccc6ABd3C1bfEecCd8D12b2Db3f8'
description: the ACL to buy
description: request body
required: true
externalDocs:
description: Read more about Lightstreams
url: 'https://docs.lightstreams.network'
servers:
- url: 'http://localhost:9091'
components:
schemas:
Meta:
type: object
required:
- meta
properties:
meta:
type: string
example: '0x50c9406f0942711b6e2e28301CE86bFbF42eBE3F'
description: address of the file meta data