// Package docs Code generated by swaggo/swag. DO NOT EDIT package docs import "github.com/swaggo/swag" const docTemplate = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { "description": "{{escape .Description}}", "title": "{{.Title}}", "contact": { "name": "Repository", "url": "https://github.com/zoriya/kyoo" }, "license": { "name": "GPL-3.0", "url": "https://www.gnu.org/licenses/gpl-3.0.en.html" }, "version": "{{.Version}}" }, "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { "/.well-known/jwks.json": { "get": { "description": "Get the jwks info, used to validate jwts.", "produces": [ "application/json" ], "tags": [ "jwt" ], "summary": "Jwks", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/main.JwkSet" } } } } }, "/jwt": { "get": { "security": [ { "Token": [] } ], "description": "Convert a session token to a short lived JWT.", "produces": [ "application/json" ], "tags": [ "jwt" ], "summary": "Get JWT", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/main.Jwt" }, "headers": { "Authorization": { "type": "string", "description": "Jwt (same value as the returned token)" } } }, "403": { "description": "Invalid session token (or expired)", "schema": { "$ref": "#/definitions/main.KError" } } } } }, "/sessions": { "post": { "description": "Login to your account and open a session", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "sessions" ], "summary": "Login", "parameters": [ { "type": "string", "example": "android tv", "description": "The device the created session will be used on", "name": "device", "in": "query" }, { "description": "Account informations", "name": "login", "in": "body", "schema": { "$ref": "#/definitions/main.LoginDto" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/main.SessionWToken" } }, "403": { "description": "Invalid password", "schema": { "$ref": "#/definitions/main.KError" } }, "404": { "description": "Account does not exists", "schema": { "$ref": "#/definitions/main.KError" } }, "422": { "description": "User does not have a password (registered via oidc, please login via oidc)", "schema": { "$ref": "#/definitions/main.KError" } } } } }, "/sessions/current": { "delete": { "security": [ { "Jwt": [] } ], "description": "Delete a session and logout", "produces": [ "application/json" ], "tags": [ "sessions" ], "summary": "Logout", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/main.Session" } }, "401": { "description": "Missing jwt token", "schema": { "$ref": "#/definitions/main.KError" } }, "403": { "description": "Invalid jwt token (or expired)", "schema": { "$ref": "#/definitions/main.KError" } } } } }, "/sessions/{id}": { "delete": { "security": [ { "Jwt": [] } ], "description": "Delete a session and logout", "produces": [ "application/json" ], "tags": [ "sessions" ], "summary": "Delete other session", "parameters": [ { "type": "string", "format": "uuid", "example": "e05089d6-9179-4b5b-a63e-94dd5fc2a397", "description": "The id of the session to delete", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/main.Session" } }, "404": { "description": "Session not found with specified id (if not using the /current route)", "schema": { "$ref": "#/definitions/main.KError" } }, "422": { "description": "Invalid session id", "schema": { "$ref": "#/definitions/main.KError" } } } } }, "/users": { "get": { "security": [ { "Jwt": [ "users.read" ] } ], "description": "List all users existing in this instance.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "users" ], "summary": "List all users", "parameters": [ { "type": "string", "description": "used for pagination.", "name": "after", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/main.Page-main_User" } }, "422": { "description": "Invalid after id", "schema": { "$ref": "#/definitions/main.KError" } } } }, "post": { "description": "Register as a new user and open a session for it", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "users" ], "summary": "Register", "parameters": [ { "type": "string", "example": "android", "description": "The device the created session will be used on", "name": "device", "in": "query" }, { "description": "Registration informations", "name": "user", "in": "body", "schema": { "$ref": "#/definitions/main.RegisterDto" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/main.SessionWToken" } }, "409": { "description": "Duplicated email or username", "schema": { "$ref": "#/definitions/main.KError" } }, "422": { "description": "Invalid register body", "schema": { "$ref": "#/definitions/main.KError" } } } } }, "/users/me": { "get": { "security": [ { "Jwt": [] } ], "description": "Get informations about the currently connected user", "produces": [ "application/json" ], "tags": [ "users" ], "summary": "Get me", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/main.User" } }, "401": { "description": "Missing jwt token", "schema": { "$ref": "#/definitions/main.KError" } }, "403": { "description": "Invalid jwt token (or expired)", "schema": { "$ref": "#/definitions/main.KError" } } } }, "delete": { "security": [ { "Jwt": [] } ], "description": "Delete your account and all your sessions", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "users" ], "summary": "Delete self", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/main.User" } } } }, "patch": { "security": [ { "Jwt": [] } ], "description": "Edit your account's info", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "users" ], "summary": "Edit self", "parameters": [ { "description": "Edited user info", "name": "user", "in": "body", "schema": { "$ref": "#/definitions/main.EditUserDto" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/main.User" } }, "403": { "description": "You can't edit a protected claim", "schema": { "$ref": "#/definitions/main.KError" } }, "422": { "description": "Invalid body", "schema": { "$ref": "#/definitions/main.KError" } } } } }, "/users/me/password": { "patch": { "security": [ { "Jwt": [] } ], "description": "Edit your password", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "users" ], "summary": "Edit password", "parameters": [ { "type": "boolean", "default": true, "description": "Invalidate other sessions", "name": "invalidate", "in": "query" }, { "description": "New password", "name": "user", "in": "body", "schema": { "$ref": "#/definitions/main.EditPasswordDto" } } ], "responses": { "204": { "description": "No Content" }, "422": { "description": "Invalid body", "schema": { "$ref": "#/definitions/main.KError" } } } } }, "/users/{id}": { "get": { "security": [ { "Jwt": [ "users.read" ] } ], "description": "Get informations about a user from it's id", "produces": [ "application/json" ], "tags": [ "users" ], "summary": "Get user", "parameters": [ { "type": "string", "format": "uuid", "description": "The id of the user", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/main.User" } }, "404": { "description": "No user with the given id found", "schema": { "$ref": "#/definitions/main.KError" } }, "422": { "description": "Invalid id (not a uuid)", "schema": { "$ref": "#/definitions/main.KError" } } } }, "delete": { "security": [ { "Jwt": [ "users.delete" ] } ], "description": "Delete an account and all it's sessions.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "users" ], "summary": "Delete user", "parameters": [ { "type": "string", "format": "uuid", "description": "User id of the user to delete", "name": "id", "in": "path" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/main.User" } }, "404": { "description": "Invalid user id", "schema": { "$ref": "#/definitions/main.KError" } } } }, "patch": { "security": [ { "Jwt": [ "users.write" ] } ], "description": "Edit an account info or permissions", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "users" ], "summary": "Edit user", "parameters": [ { "type": "string", "format": "uuid", "description": "User id of the user to edit", "name": "id", "in": "path" }, { "description": "Edited user info", "name": "user", "in": "body", "schema": { "$ref": "#/definitions/main.EditUserDto" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/main.User" } }, "403": { "description": "You don't have permissions to edit another account", "schema": { "$ref": "#/definitions/main.KError" } }, "422": { "description": "Invalid body", "schema": { "$ref": "#/definitions/main.KError" } } } } } }, "definitions": { "main.EditPasswordDto": { "type": "object", "required": [ "password" ], "properties": { "password": { "type": "string", "example": "password1234" } } }, "main.EditUserDto": { "type": "object", "properties": { "claims": { "type": "object", "additionalProperties": { "type": "string" }, "example": { "preferOriginal": " true" } }, "email": { "type": "string", "example": "kyoo@zoriya.dev" }, "username": { "type": "string", "example": "zoriya" } } }, "main.JwkSet": { "type": "object", "properties": { "keys": { "type": "array", "items": { "type": "object", "properties": { "e": { "type": "string", "example": "AQAB" }, "key_ops": { "type": "array", "items": { "type": "string" }, "example": [ "[verify]" ] }, "kty": { "type": "string", "example": "RSA" }, "n": { "type": "string", "example": "oBcXcJUR-Sb8_b4qIj28LRAPxdF_6odRr52K5-ymiEkR2DOlEuXBtM-biWxPESW-U-zhfHzdVLf6ioy5xL0bJTh8BMIorkrDliN3vb81jCvyOMgZ7ATMJpMAQMmSDN7sL3U45r22FaoQufCJMQHmUsZPecdQSgj2aFBiRXxsLleYlSezdBVT_gKH-coqeYXSC_hk-ezSq4aDZ10BlDnZ-FA7-ES3T7nBmJEAU7KDAGeSvbYAfYimOW0r-Vc0xQNuwGCfzZtSexKXDbYbNwOVo3SjfCabq-gMfap_owcHbKicGBZu1LDlh7CpkmLQf_kv6GihM2LWFFh6Vwg2cltiwF22EIPlUDtYTkUR0qRkdNJaNkwV5Vv_6r3pzSmu5ovRriKtlrvJMjlTnLb4_ltsge3fw5Z34cJrsp094FbUc2O6Or4FGEXUldieJCnVRhs2_h6SDcmeMXs1zfvE5GlDnq8tZV6WMJ5Sb4jNO7rs_hTkr23_E6mVg-DdtozGfqzRzhIjPym6D_jVfR6dZv5W0sKwOHRmT7nYq-C7b2sAwmNNII296M4Rq-jn0b5pgSeMDYbIpbIA4thU8LYU0lBZp_ZVwWKG1RFZDxz3k9O5UVth2kTpTWlwn0hB1aAvgXHo6in1CScITGA72p73RbDieNnLFaCK4xUVstkWAKLqPxs" }, "use": { "type": "string", "example": "sig" } } } } } }, "main.Jwt": { "type": "object", "properties": { "token": { "description": "The jwt token you can use for all authorized call to either keibi or other services.", "type": "string", "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.KMUFsIDTnFmyG3nMiGM6H9FNFUROf3wh7SmqJp-QV30" } } }, "main.KError": { "type": "object", "properties": { "details": {}, "message": { "type": "string", "example": "No user found with this id" }, "status": { "type": "integer", "example": 404 } } }, "main.LoginDto": { "type": "object", "required": [ "login", "password" ], "properties": { "login": { "description": "Either the email or the username.", "type": "string", "example": "zoriya" }, "password": { "description": "Password of the account.", "type": "string", "example": "password1234" } } }, "main.OidcHandle": { "type": "object", "properties": { "id": { "description": "Id of this oidc handle.", "type": "string", "example": "e05089d6-9179-4b5b-a63e-94dd5fc2a397" }, "profileUrl": { "description": "Link to the profile of the user on the external service. Null if unknown or irrelevant.", "type": "string", "format": "url", "example": "https://myanimelist.net/profile/zoriya" }, "username": { "description": "Username of the user on the external service.", "type": "string", "example": "zoriya" } } }, "main.Page-main_User": { "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/definitions/main.User" } }, "next": { "type": "string", "example": "https://kyoo.zoriya.dev/auth/users?after=aoeusth" }, "this": { "type": "string", "example": "https://kyoo.zoriya.dev/auth/users" } } }, "main.RegisterDto": { "type": "object", "required": [ "email", "password", "username" ], "properties": { "email": { "description": "Valid email that could be used for forgotten password requests. Can be used for login.", "type": "string", "format": "email", "example": "kyoo@zoriya.dev" }, "password": { "description": "Password to use.", "type": "string", "example": "password1234" }, "username": { "description": "Username of the new account, can't contain @ signs. Can be used for login.", "type": "string", "example": "zoriya" } } }, "main.Session": { "type": "object", "properties": { "createdDate": { "description": "When was the session first opened", "type": "string", "example": "2025-03-29T18:20:05.267Z" }, "device": { "description": "Device that created the session.", "type": "string", "example": "Web - Firefox" }, "id": { "description": "Unique id of this session. Can be used for calls to DELETE", "type": "string", "example": "e05089d6-9179-4b5b-a63e-94dd5fc2a397" }, "lastUsed": { "description": "Last date this session was used to access a service.", "type": "string", "example": "2025-03-29T18:20:05.267Z" } } }, "main.SessionWToken": { "type": "object", "properties": { "createdDate": { "description": "When was the session first opened", "type": "string", "example": "2025-03-29T18:20:05.267Z" }, "device": { "description": "Device that created the session.", "type": "string", "example": "Web - Firefox" }, "id": { "description": "Unique id of this session. Can be used for calls to DELETE", "type": "string", "example": "e05089d6-9179-4b5b-a63e-94dd5fc2a397" }, "lastUsed": { "description": "Last date this session was used to access a service.", "type": "string", "example": "2025-03-29T18:20:05.267Z" }, "token": { "type": "string", "example": "lyHzTYm9yi+pkEv3m2tamAeeK7Dj7N3QRP7xv7dPU5q9MAe8tU4ySwYczE0RaMr4fijsA==" } } }, "main.User": { "type": "object", "properties": { "claims": { "description": "List of custom claims JWT created via get /jwt will have", "type": "object", "additionalProperties": { "type": "string" }, "example": { "isAdmin": " true" } }, "createdDate": { "description": "When was this account created?", "type": "string", "example": "2025-03-29T18:20:05.267Z" }, "email": { "description": "Email of the user. Can be used as a login.", "type": "string", "format": "email", "example": "kyoo@zoriya.dev" }, "id": { "description": "Id of the user.", "type": "string", "example": "e05089d6-9179-4b5b-a63e-94dd5fc2a397" }, "lastSeen": { "description": "When was the last time this account made any authorized request?", "type": "string", "example": "2025-03-29T18:20:05.267Z" }, "oidc": { "description": "List of other login method available for this user. Access tokens wont be returned here.", "type": "object", "additionalProperties": { "$ref": "#/definitions/main.OidcHandle" } }, "username": { "description": "Username of the user. Can be used as a login.", "type": "string", "example": "zoriya" } } } }, "securityDefinitions": { "Jwt": { "type": "apiKey", "name": "Authorization", "in": "header" }, "Token": { "type": "apiKey", "name": "Authorization", "in": "header" } } }` // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = &swag.Spec{ Version: "1.0", Host: "kyoo.zoriya.dev", BasePath: "/auth", Schemes: []string{}, Title: "Keibi - Kyoo's auth", Description: "Auth system made for kyoo.", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, LeftDelim: "{{", RightDelim: "}}", } func init() { swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) }