-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathswagger.yml
256 lines (229 loc) · 7.59 KB
/
swagger.yml
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
swagger: "2.0"
info:
description: "YAxC - Yet Another Cross Clipboard"
version: "1.1.0"
title: "YAxC"
host: "yaxc.d2a.io"
basePath: "/"
tags:
- name: "anywhere"
description: "Public Clipboard Name"
- name: "hash"
description: "Hash"
schemes:
- "https"
- "http"
paths:
#
# POST /{anywhere}
#
'/{anywhere}':
post:
tags:
- "anywhere"
summary: Post new clipboard data
consumes:
- 'text/plain'
produces:
- 'text/plain'
parameters:
- in: "path"
name: "anywhere"
description: |
Path under which the data is to be saved.
⚠️ Since the path is **publicly accessible** to **everyone**
* no sensitive data should be sent to this path
* use a long, random path
* encrypt the data
(best on client-side, but it is possible on server-side by using the `secret` parameter, **which is not recommended!**)
required: true
type: string
- in: "body"
name: "contents"
description: "The content which should be uploaded"
required: true
schema:
type: string
default: "Hello World!"
- in: "query"
name: "secret"
description: |
Encrypts the content with the password (server-side!)
By default, the data is not encrypted.
**It is not recommended to encrypt the data on server side. The data should always be encrypted on the client side.**
However, if this is not possible, the `secret`-parameter can be used to specify a password with which the data should be encrypted.
required: false
type: string
- in: "query"
name: "ttl"
description: "Waiting time after which the content is deleted"
required: false
type: strin
- in: "query"
name: "b64"
description: "`encode` or `decode` response to/from Base64"
required: false
type: stringg
responses:
"200":
description: "OK"
"401":
description: "Invalid Auth-Type in Authorization-Header. Only accepts JWT"
"406":
description: "Invalid Path"
"413":
description: "Body too large"
"416":
description: "TTL out of range"
"422":
description: "Invalid TTL. (Examples: 10s, 5m, 1h)"
"423":
description: "Encryption password was specified, but encryption is not enabled on the server"
"500":
description: "Internal server error; e.g. Encryption failed (server-side)"
"504":
description: "Error decoding Base64"
"506":
description: "Invalid Base64-Mode. Available: encode, decode"
"509":
description: "The whitelist is currently not enabled on the server"
"510":
description: "Error validating token"
#
# GET /{anywhere}
#
get:
tags:
- "anywhere"
summary: Get clipboard data
produces:
- 'text/plain'
parameters:
- in: "path"
name: "anywhere"
description: |
Path under which the data is to be saved.
⚠️ Since the path is **publicly accessible** to **everyone**
* no sensitive data should be sent to this path
* use a long, random path
* encrypt the data
(best on client-side, but it is possible on server-side by using the `secret` parameter, **which is not recommended!**)
required: true
type: string
- in: "query"
name: "secret"
description: |
If the data has been encrypted and should be decrypted on the server side (**which is btw. not recommended**),
the "password" can be passed via the `secret`-parameter.
required: false
type: string
- in: "query"
name: "b64"
description: "`encode` or `decode` response to/from Base64"
required: false
type: string
responses:
"200":
description: "OK"
"404":
description: "Data not found"
"406":
description: "Invalid Path"
"423":
description: "Encryption password was specified, but encryption is not enabled on the server"
"504":
description: "Error decoding Base64"
"506":
description: "Invalid Base64-Mode. Available: encode, decode"
#
# POST /{anywhere}/{hash}
#
'/{anywhere}/{hash}':
post:
tags:
- "hash"
summary: "Post new clipboard data with custom hash"
consumes:
- 'text/plain'
produces:
- 'text/plain'
parameters:
- in: "path"
name: "anywhere"
description: |
Path under which the data is to be saved.
⚠️ Since the path is **publicly accessible** to **everyone**
* no sensitive data should be sent to this path
* use a long, random path
* encrypt the data
(best on client-side, but it is possible on server-side by using the `secret` parameter, **which is not recommended!**)
required: true
type: string
- in: "path"
name: "hash"
description: "Custom hash for data (must be in **hex**)"
required: true
type: string
- in: "body"
name: "contents"
description: "The content which should be uploaded"
required: true
schema:
type: string
default: "Hello World!"
- in: "query"
name: "secret"
description: |
Encrypts the content with the password (server-side!)
By default, the data is not encrypted.
**It is not recommended to encrypt the data on server side. The data should always be encrypted on the client side.**
However, if this is not possible, the `secret`-parameter can be used to specify a password with which the data should be encrypted.
required: false
type: string
- in: "query"
name: "ttl"
description: "Waiting time after which the content is deleted"
required: false
type: string
responses:
"200":
description: "OK"
"406":
description: "Invalid Path"
"413":
description: "Body too large"
"416":
description: "TTL out of range"
"422":
description: "Invalid TTL. (Examples: 10s, 5m, 1h)"
"423":
description: "Encryption password was specified, but encryption is not enabled on the server"
"500":
description: "Internal server error; e.g. Encryption failed (server-side)"
#
# GET /hash/{anywhere}
#
'/hash/{anywhere}':
get:
tags:
- "hash"
summary: Get hash of clipboard data
produces:
- 'text/plain'
parameters:
- in: "path"
name: "anywhere"
description: |
Path under which the data is to be saved.
⚠️ Since the path is **publicly accessible** to **everyone**
* no sensitive data should be sent to this path
* use a long, random path
* encrypt the data
(best on client-side, but it is possible on server-side by using the `secret` parameter, **which is not recommended!**)
required: true
type: string
responses:
"200":
description: "OK"
"404":
description: "Hash not found"