1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-05 10:22:31 +01:00

oapi: add missing 2fa types to login

This commit is contained in:
Puyodead1 2023-03-25 20:36:54 -04:00
parent 0d666732c6
commit e68819d97a
No known key found for this signature in database
GPG Key ID: A4FA4FEC0DD353FC
4 changed files with 21901 additions and 17 deletions

View File

@ -3997,6 +3997,83 @@
"username"
]
},
"TokenResponse": {
"type": "object",
"properties": {
"token": {
"type": "string"
},
"settings": {
"$ref": "#/components/schemas/UserSettings"
}
},
"required": [
"settings",
"token"
]
},
"MFAResponse": {
"type": "object",
"properties": {
"ticket": {
"type": "string"
},
"mfa": {
"type": "boolean",
"enum": [
true
]
},
"sms": {
"type": "boolean",
"enum": [
false
]
},
"token": {
"type": "null"
}
},
"required": [
"mfa",
"sms",
"ticket",
"token"
]
},
"WebAuthnResponse": {
"type": "object",
"properties": {
"webauthn": {
"type": "string"
},
"ticket": {
"type": "string"
},
"mfa": {
"type": "boolean",
"enum": [
true
]
},
"sms": {
"type": "boolean",
"enum": [
false
]
},
"token": {
"type": "null"
}
},
"required": [
"mfa",
"sms",
"ticket",
"token",
"webauthn"
]
},
"ChannelPermissionOverwriteSchema": {
"type": "object",
"properties": {
@ -6727,21 +6804,6 @@
"$ref": "#/components/schemas/TenorGifResponse"
}
},
"TokenResponse": {
"type": "object",
"properties": {
"token": {
"type": "string"
},
"settings": {
"$ref": "#/components/schemas/UserSettings"
}
},
"required": [
"settings",
"token"
]
},
"TokenOnlyResponse": {
"type": "object",
"properties": {
@ -7163,6 +7225,19 @@
"messages"
]
},
"LoginResponse": {
"anyOf": [
{
"$ref": "#/components/schemas/TokenResponse"
},
{
"$ref": "#/components/schemas/MFAResponse"
},
{
"$ref": "#/components/schemas/WebAuthnResponse"
}
]
},
"MemberNickChangeSchema": {
"type": "object",
"properties": {
@ -12855,7 +12930,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TokenResponse"
"$ref": "#/components/schemas/LoginResponse"
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,7 @@ router.post(
requestBody: "LoginSchema",
responses: {
200: {
body: "TokenResponse",
body: "LoginResponse",
},
400: {
body: "APIErrorOrCaptchaResponse",

View File

@ -0,0 +1,14 @@
import { TokenResponse } from "./responses";
export interface MFAResponse {
ticket: string;
mfa: true;
sms: false; // TODO
token: null;
}
export interface WebAuthnResponse extends MFAResponse {
webauthn: string;
}
export type LoginResponse = TokenResponse | MFAResponse | WebAuthnResponse;