This commit is contained in:
2025-07-27 01:10:54 +03:00
parent 1dc7c4fd87
commit deab475eab
6 changed files with 138 additions and 0 deletions

113
api/auth/api.yaml Normal file
View File

@ -0,0 +1,113 @@
openapi: 3.0.0
info:
title: Authentication API
version: 1.0.0
servers:
- url: https://id.logidex.ru/api/auth
paths:
/otp/request:
post:
summary: Request OTP
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RequestOTPRequest'
responses:
'200':
description: OTP requested successfully
content:
application/json:
schema:
$ref: '#/components/schemas/RequestOTPResponse'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/RequestOTPResponse'
/otp/verify:
post:
summary: Verify OTP
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/VerifyOTPRequest'
responses:
'200':
description: OTP verified successfully
content:
application/json:
schema:
$ref: '#/components/schemas/VerifyOTPResponse'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/VerifyOTPResponse'
components:
schemas:
RequestOTPRequest:
type: object
properties:
phone_number:
type: string
description: Phone number to send OTP to
example: "+79999999999"
maxLength: 15
required:
- phone_number
RequestOTPResponse:
type: object
properties:
message:
type: string
description: Confirmation message
example: "OTP sent successfully"
ok:
type: boolean
description: Status of the request
example: true
required:
- message
- ok
VerifyOTPRequest:
type: object
properties:
phone_number:
type: string
description: Phone number to verify OTP for
example: "+79999999999"
maxLength: 15
otp:
type: string
description: One-time password to verify
example: "123456"
maxLength: 6
login_challenge:
type: string
description: Login challenge for verification
example: "challenge123"
required:
- phone_number
- otp
- login_challenge
VerifyOTPResponse:
type: object
properties:
redirect_url:
type: string
description: URL to redirect to after successful verification
example: "https://example.com/redirect"
ok:
type: boolean
description: Status of the verification
example: true
required:
- redirect_url
- ok

6
api/auth/cfg.yaml Normal file
View File

@ -0,0 +1,6 @@
package: handler
generate:
fiber-server: true
strict-server: true
models: true
output: gen.go

10
config.yaml Normal file
View File

@ -0,0 +1,10 @@
app:
port: 8080
redis:
host: localhost
port: 6379
db: 0
hydra:
host: https://oauth2.logidex.ru/admin

9
openapi.yaml Normal file
View File

@ -0,0 +1,9 @@
openapi: 3.0.0
info:
title: Logidex ID API
version: 1.0.0
paths:
/auth:
$ref: './api/auth/api.yaml#/paths'