1031 lines
47 KiB
JSON
1031 lines
47 KiB
JSON
{
|
|
"openapi": "3.1.0",
|
|
"info": {
|
|
"version": "9.6.1",
|
|
"title": "@fastify/swagger"
|
|
},
|
|
"components": {
|
|
"schemas": {}
|
|
},
|
|
"paths": {
|
|
"/api/auth/disableOtp": {
|
|
"put": {
|
|
"operationId": "disableOtp",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"success"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"disableOtp.success"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"failure"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"disableOtp.failure.guest"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"notLoggedIn"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"auth.noCookie",
|
|
"auth.invalidKind",
|
|
"auth.noUser",
|
|
"auth.invalid"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"failure"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"disableOtp.failure.generic"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/auth/enableOtp": {
|
|
"put": {
|
|
"operationId": "enableOtp",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg",
|
|
"payload"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"success"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"enableOtp.success"
|
|
]
|
|
},
|
|
"payload": {
|
|
"type": "object",
|
|
"required": [
|
|
"url"
|
|
],
|
|
"properties": {
|
|
"url": {
|
|
"type": "string",
|
|
"description": "The otp url to feed into a 2fa app"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"failure"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"enableOtp.failure.guest"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"failure"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"enableOtp.failure.noUser",
|
|
"enableOtp.failure.noSecret"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"notLoggedIn"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"auth.noCookie",
|
|
"auth.invalidKind",
|
|
"auth.noUser",
|
|
"auth.invalid"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/auth/providerList": {
|
|
"get": {
|
|
"operationId": "providerList",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg",
|
|
"payload"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"success"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"providerList.success"
|
|
]
|
|
},
|
|
"payload": {
|
|
"type": "object",
|
|
"required": [
|
|
"list"
|
|
],
|
|
"properties": {
|
|
"list": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"display_name",
|
|
"name",
|
|
"colors"
|
|
],
|
|
"properties": {
|
|
"display_name": {
|
|
"type": "string",
|
|
"description": "Name to display to the user"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"description": "internal Name of the provider"
|
|
},
|
|
"colors": {
|
|
"type": "object",
|
|
"required": [
|
|
"normal",
|
|
"hover"
|
|
],
|
|
"properties": {
|
|
"normal": {
|
|
"type": "string",
|
|
"description": "Default color for the provider"
|
|
},
|
|
"hover": {
|
|
"type": "string",
|
|
"description": "Hover color for the provider"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/auth/guest": {
|
|
"post": {
|
|
"operationId": "guestLogin",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg",
|
|
"payload"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"success"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"guestLogin.success"
|
|
]
|
|
},
|
|
"payload": {
|
|
"type": "object",
|
|
"required": [
|
|
"token"
|
|
],
|
|
"properties": {
|
|
"token": {
|
|
"type": "string",
|
|
"description": "JWT that represent a logged in user"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"failed"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"guestLogin.failed.generic.unknown",
|
|
"guestLogin.failed.generic.error"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/auth/login": {
|
|
"post": {
|
|
"operationId": "login",
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"name",
|
|
"password"
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"password": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg",
|
|
"payload"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"success"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"login.success"
|
|
]
|
|
},
|
|
"payload": {
|
|
"type": "object",
|
|
"required": [
|
|
"token"
|
|
],
|
|
"properties": {
|
|
"token": {
|
|
"type": "string",
|
|
"description": "JWT that represent a logged in user"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"202": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg",
|
|
"payload"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"otpRequired"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"login.otpRequired"
|
|
]
|
|
},
|
|
"payload": {
|
|
"type": "object",
|
|
"required": [
|
|
"token"
|
|
],
|
|
"properties": {
|
|
"token": {
|
|
"type": "string",
|
|
"description": "JWT to send with the OTP to finish login"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"failed"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"login.failed.generic",
|
|
"login.failed.invalid"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/auth/logout": {
|
|
"post": {
|
|
"operationId": "logout",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"success"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"logout.success"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/auth/otp": {
|
|
"post": {
|
|
"operationId": "loginOtp",
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"token",
|
|
"code"
|
|
],
|
|
"properties": {
|
|
"token": {
|
|
"type": "string",
|
|
"description": "The token given at the login phase"
|
|
},
|
|
"code": {
|
|
"type": "string",
|
|
"description": "The OTP given by the user"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg",
|
|
"payload"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"success"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"otp.success"
|
|
]
|
|
},
|
|
"payload": {
|
|
"type": "object",
|
|
"required": [
|
|
"token"
|
|
],
|
|
"properties": {
|
|
"token": {
|
|
"type": "string",
|
|
"description": "the JWT Token"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"failed"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"otp.failed.invalid"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"failed"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"otp.failed.noSecret"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"408": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"failed"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"otp.failed.timeout"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"failed"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"otp.failed.generic"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/auth/signin": {
|
|
"post": {
|
|
"operationId": "signin",
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"name",
|
|
"password"
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"password": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg",
|
|
"payload"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"success"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"signin.success"
|
|
]
|
|
},
|
|
"payload": {
|
|
"type": "object",
|
|
"required": [
|
|
"token"
|
|
],
|
|
"properties": {
|
|
"token": {
|
|
"type": "string",
|
|
"description": "the JWT token"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"failed"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"signin.failed.username.existing",
|
|
"signin.failed.username.toolong",
|
|
"signin.failed.username.tooshort",
|
|
"signin.failed.username.invalid",
|
|
"signin.failed.password.toolong",
|
|
"signin.failed.password.tooshort",
|
|
"signin.failed.password.invalid"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"failed"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"signin.failed.generic"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/auth/statusOtp": {
|
|
"get": {
|
|
"operationId": "statusOtp",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg",
|
|
"payload"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"success"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"statusOtp.success.enabled"
|
|
]
|
|
},
|
|
"payload": {
|
|
"type": "object",
|
|
"required": [
|
|
"secret"
|
|
],
|
|
"properties": {
|
|
"secret": {
|
|
"type": "string",
|
|
"description": "The otp secret"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"success"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"statusOtp.success.disabled"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"notLoggedIn"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"auth.noCookie",
|
|
"auth.invalidKind",
|
|
"auth.noUser",
|
|
"auth.invalid"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"notLoggedIn"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"auth.noCookie",
|
|
"auth.invalidKind",
|
|
"auth.noUser",
|
|
"auth.invalid"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Default Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"msg"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"failure"
|
|
]
|
|
},
|
|
"msg": {
|
|
"enum": [
|
|
"statusOtp.failure.generic"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"servers": [
|
|
{
|
|
"url": "https://local.maix.me:8888",
|
|
"description": "direct from docker"
|
|
},
|
|
{
|
|
"url": "https://local.maix.me:8000",
|
|
"description": "using fnginx"
|
|
}
|
|
]
|
|
}
|