UNPKG

15.1 kBJSONView Raw
1{
2 "$id": "config",
3 "type": "object",
4 "required": [
5 "amqp",
6 "redis",
7 "deleteInactiveAccounts",
8 "jwt",
9 "validation",
10 "passwordValidator",
11 "server",
12 "mailer",
13 "pwdReset",
14 "hooks",
15 "token",
16 "phone",
17 "rateLimiters"
18 ],
19 "properties": {
20 "deleteInactiveAccounts": {
21 "type": "integer",
22 "minimum": 0
23 },
24 "admins": {
25 "type": "array",
26 "items": {
27 "type": "object",
28 "properties": {
29 "username": {
30 "type": "string",
31 "format": "email"
32 },
33 "password": {
34 "type": "string",
35 "minLength": 18
36 },
37 "firstName": {
38 "type": "string",
39 "minLength": 1
40 },
41 "lastName": {
42 "type": "string",
43 "minLength": 1
44 }
45 }
46 }
47 },
48 "registrationLimits": {
49 "type": "object",
50 "properties": {
51 "ip": {
52 "type": "object",
53 "properties": {
54 "time": {
55 "type": "integer",
56 "minimum": 0
57 },
58 "times": {
59 "type": "integer",
60 "minimum": 1
61 }
62 }
63 },
64 "noDisposable": {
65 "type": "boolean"
66 },
67 "checkMX": {
68 "type": "boolean"
69 }
70 }
71 },
72 "pwdReset": {
73 "type": "object",
74 "properties": {
75 "length": {
76 "type": "integer",
77 "minimum": 6,
78 "maximum": 30
79 },
80 "memorable": {
81 "type": "boolean"
82 }
83 }
84 },
85 "redis": {
86 "type": "object",
87 "required": [
88 "options"
89 ],
90 "properties": {
91 "options": {
92 "type": "object",
93 "required": [
94 "keyPrefix"
95 ],
96 "properties": {
97 "keyPrefix": {
98 "type": "string",
99 "minLength": 1,
100 "pattern": ".*{.*}.*"
101 },
102 "redisOptions": {
103 "type": "object",
104 "properties": {
105 "keyPrefix": {
106 "type": "string",
107 "minLength": 1,
108 "pattern": ".*{.*}.*"
109 }
110 }
111 }
112 }
113 }
114 }
115 },
116 "logger": {
117 "type": "object"
118 },
119 "captcha": {
120 "required": [
121 "secret",
122 "uri",
123 "ttl"
124 ],
125 "type": "object",
126 "properties": {
127 "secret": {
128 "type": "string",
129 "minLength": 1
130 },
131 "ttl": {
132 "type": "integer",
133 "minimum": 1
134 },
135 "uri": {
136 "type": "string",
137 "minLength": 1
138 }
139 }
140 },
141 "jwt": {
142 "type": "object",
143 "required": [
144 "hashingFunction",
145 "secret",
146 "ttl",
147 "defaultAudience",
148 "issuer"
149 ],
150 "properties": {
151 "hashingFunction": {
152 "type": "string"
153 },
154 "secret": {
155 "type": "string",
156 "minLength": 32
157 },
158 "ttl": {
159 "type": "integer",
160 "minimum": 0
161 },
162 "defaultAudience": {
163 "type": "string",
164 "minLength": 1
165 },
166 "issuer": {
167 "type": "string",
168 "minLength": 1
169 }
170 }
171 },
172 "validation": {
173 "type": "object",
174 "required": [
175 "paths",
176 "subjects",
177 "email",
178 "senders",
179 "templates"
180 ],
181 "properties": {
182 "paths": {
183 "type": "object",
184 "required": [
185 "activate",
186 "reset"
187 ],
188 "properties": {
189 "activate": {
190 "type": "string"
191 },
192 "reset": {
193 "type": "string"
194 }
195 }
196 },
197 "senders": {
198 "required": [
199 "activate",
200 "reset",
201 "password"
202 ],
203 "type": "object",
204 "properties": {
205 "activate": {
206 "type": "string"
207 },
208 "reset": {
209 "type": "string"
210 },
211 "password": {
212 "type": "string"
213 }
214 }
215 },
216 "subjects": {
217 "required": [
218 "activate",
219 "reset",
220 "password"
221 ],
222 "type": "object",
223 "properties": {
224 "activate": {
225 "type": "string"
226 },
227 "reset": {
228 "type": "string"
229 },
230 "password": {
231 "type": "string"
232 }
233 }
234 },
235 "templates": {
236 "type": "object",
237 "properties": {
238 "activate": {
239 "type": "string"
240 },
241 "reset": {
242 "type": "string"
243 },
244 "password": {
245 "type": "string"
246 }
247 }
248 },
249 "email": {
250 "oneOf": [{
251 "type": "string",
252 "minLength": 1
253 },
254 {
255 "type": "object"
256 }
257 ]
258 }
259 }
260 },
261 "passwordValidator": {
262 "type": "object",
263 "required": [
264 "enabled",
265 "minStrength",
266 "inputFieldNames"
267 ],
268 "properties": {
269 "enabled": {
270 "type": "boolean",
271 "default": "false"
272 },
273 "minStrength": {
274 "type": "integer",
275 "default" : 4,
276 "minimum": 0,
277 "maximum": 4
278 },
279 "forceCheckFieldNames": {
280 "type": "array",
281 "items": {
282 "type": "string",
283 "minLength": 1
284 },
285 "default": []
286 },
287 "skipCheckFieldNames": {
288 "type": "array",
289 "items": {
290 "type": "string",
291 "minLength": 1
292 },
293 "default": []
294 },
295 "inputFieldNames": {
296 "type": "array",
297 "items": {
298 "type": "string",
299 "minLength": 1
300 },
301 "default": []
302 }
303 }
304 },
305 "server": {
306 "required": [
307 "proto",
308 "host",
309 "port"
310 ],
311 "type": "object",
312 "properties": {
313 "proto": {
314 "type": "string",
315 "enum": [
316 "http",
317 "https"
318 ]
319 },
320 "host": {
321 "type": "string"
322 },
323 "port": {
324 "oneOf": [{
325 "type": "string"
326 },
327 {
328 "type": "integer"
329 }
330 ]
331 }
332 }
333 },
334 "mailer": {
335 "type": "object",
336 "required": [
337 "prefix",
338 "routes"
339 ],
340 "properties": {
341 "prefix": {
342 "type": "string",
343 "minLength": 1
344 },
345 "routes": {
346 "type": "object",
347 "properties": {
348 "adhoc": {
349 "type": "string",
350 "minLength": 1
351 },
352 "predefined": {
353 "type": "string",
354 "minLength": 1
355 }
356 }
357 }
358 }
359 },
360 "hooks": {
361 "type": "object"
362 },
363 "payments": {
364 "type": "object"
365 },
366 "token": {
367 "type": "object",
368 "required": [
369 "erase",
370 "email",
371 "phone"
372 ],
373 "properties": {
374 "erase": {
375 "type": "boolean",
376 "default": false
377 },
378 "email": {
379 "type": "object",
380 "required": [
381 "secret",
382 "throttle",
383 "ttl"
384 ],
385 "properties": {
386 "secret": {
387 "type": "object",
388 "required": [
389 "type"
390 ],
391 "properties": {
392 "type": {
393 "type": "string"
394 },
395 "length": {
396 "type": "integer",
397 "minimum": 0
398 },
399 "encrypt": {
400 "type": "boolean"
401 }
402 }
403 },
404 "ttl": {
405 "type": "integer",
406 "minimum": 0
407 },
408 "throttle": {
409 "type": "integer",
410 "minimum": 0
411 }
412 }
413 },
414 "phone": {
415 "type": "object",
416 "required": [
417 "secret",
418 "throttle",
419 "ttl"
420 ],
421 "properties": {
422 "secret": {
423 "type": "object",
424 "required": [
425 "type"
426 ],
427 "properties": {
428 "type": {
429 "type": "string"
430 },
431 "length": {
432 "type": "integer",
433 "minimum": 0
434 },
435 "encrypt": {
436 "type": "boolean"
437 }
438 }
439 },
440 "ttl": {
441 "type": "integer",
442 "minimum": 0
443 },
444 "throttle": {
445 "type": "integer",
446 "minimum": 0
447 }
448 }
449 }
450 }
451 },
452 "phone": {
453 "type": "object",
454 "required": [
455 "account",
456 "messages",
457 "prefix"
458 ],
459 "properties": {
460 "account": {
461 "type": "string"
462 },
463 "messages": {
464 "type": "object",
465 "patternProperties": {
466 "^.+$": {
467 "type": "string"
468 }
469 }
470 },
471 "prefix": {
472 "type": "string"
473 }
474 }
475 },
476 "oauth": {
477 "type": "object",
478 "properties": {
479 "enabled": {
480 "type": "boolean",
481 "default": false
482 },
483 "token": {
484 "type": "object",
485 "required": [
486 "hashingFunction",
487 "secret",
488 "issuer"
489 ],
490 "properties": {
491 "hashingFunction": {
492 "type": "string"
493 },
494 "secret": {
495 "type": "string"
496 },
497 "issuer": {
498 "type": "string",
499 "minLength": 1,
500 "maxLength": 128
501 }
502 }
503 },
504 "providers": {
505 "type": "object",
506 "additionalProperties": {
507 "type": "object",
508 "required": ["clientId", "clientSecret"],
509 "additionalProperties": true,
510 "properties": {
511 "enabled": {
512 "type": "boolean",
513 "default": false
514 },
515 "retryOnMissingPermissions": {
516 "type": "boolean"
517 },
518 "clientId": {
519 "type": "string",
520 "minLength": 1
521 },
522 "clientSecret": {
523 "type": "string",
524 "minLength": 1
525 },
526 "location": {
527 "type": "string",
528 "minLength": 1
529 },
530 "domain": {
531 "type": "string",
532 "minLength": 1
533 },
534 "scope": {
535 "anyOf": [{
536 "type": "array",
537 "items": {
538 "type": "string",
539 "minLength": 1
540 },
541 "minItems": 1
542 }, {
543 "type": "string",
544 "pattern": "^(?:[._,]?[a-zA-Z]+)+$"
545 }],
546 "default": "email"
547 },
548 "scopeSeparator": {
549 "type": "string",
550 "minLength": 1
551 },
552 "password": {
553 "type": "string"
554 },
555 "forceHttps": {
556 "type": "boolean",
557 "default": false
558 },
559 "isSecure": {
560 "type": "boolean",
561 "default": false
562 },
563 "isSameSite": {
564 "oneOf": [{
565 "type": "string",
566 "enum": ["Lax", "Strict"]
567 }, {
568 "type": "boolean",
569 "const": false
570 }]
571 },
572 "apiVersion": {
573 "type": "string"
574 },
575 "fields": {
576 "type": "array",
577 "items": {
578 "type": "string",
579 "minLength": 1
580 }
581 },
582 "profileHandler": {
583 "type": "object"
584 }
585 }
586 }
587 }
588 },
589 "if": {
590 "properties": { "enabled": { "const": true } }
591 },
592 "then": {
593 "required": ["token", "providers"],
594 "properties": {
595 "token": {
596 "properties": {
597 "secret": {
598 "minLength": 32
599 },
600 "providers": {
601 "minProperties": 1,
602 "additionalProperties": {
603 "if": {
604 "properties": { "enabled": { "const": true } }
605 },
606 "then": {
607 "properties": {
608 "password": {
609 "minLength": 32
610 }
611 }
612 }
613 }
614 }
615 }
616 }
617 }
618 }
619 },
620 "rateLimiters": {
621 "type": "object",
622 "required": [
623 "userLogin"
624 ],
625 "properties": {
626 "userLogin" : {
627 "$ref": "#/definitions/userLoginRateLimiter"
628 }
629 }
630 }
631 },
632 "definitions": {
633 "slidingWindowRateLimiter": {
634 "type": "object",
635 "required": [
636 "windowInterval",
637 "windowLimit",
638 "blockInterval"
639 ],
640 "properties": {
641 "windowInterval": {
642 "type": "integer",
643 "minimum": 0
644 },
645 "windowLimit": {
646 "type": "integer",
647 "minimum": 1
648 },
649 "blockInterval": {
650 "type": "integer",
651 "minimum": 0
652 }
653 },
654 "if" : {
655 "properties": {
656 "windowInterval": {
657 "const": 0
658 }
659 }
660 },
661 "then": {
662 "properties": {
663 "blockInterval": {
664 "const": 0
665 }
666 }
667 },
668 "else": {
669 "properties": {
670 "blockInterval": {
671 "minimum": 1
672 }
673 }
674 }
675 },
676 "userLoginRateLimiter": {
677 "type": "object",
678 "required": [
679 "enabled",
680 "limitIp",
681 "limitUserIp"
682 ],
683 "properties":{
684 "enabled": {
685 "type": "boolean"
686 },
687 "limitIp": {
688 "$ref": "#/definitions/slidingWindowRateLimiter"
689 },
690 "limitUserIp": {
691 "$ref": "#/definitions/slidingWindowRateLimiter"
692 }
693 }
694 }
695 }
696}