import { operation, requestBodySchema, response200, response500, security, tags, } from '../chunks.ts'; // This is the standalone Captcha module (`/captcha`). Distinct from `/v2/empire/fetch_captcha`, // which is a separate, unauthenticated captcha flow used specifically for account creation. export const captcha = { '/v2/captcha/fetch': { post: { ...tags('captcha'), ...security(), ...operation( 'Fetch a captcha.', "Retrieves a captcha that is required in order to call the solve method. Display the resulting captcha and then call solve with the user's response." ), responses: { ...response200( "Retrieves a captcha required to call solve. Display it, then call solve with the user's response.", { type: 'object', required: ['guid', 'url'], properties: { guid: { type: 'string' }, url: { type: 'string' } }, } ), ...response500(), }, }, }, '/v2/captcha/solve': { post: { ...tags('captcha'), ...security(), ...operation( 'Solve a captcha.', "Validates the user's solution against the known solution for the given guid. On success the captcha stays valid for thirty minutes and this returns 1. A captcha cannot be used more than once; on a mismatch it throws 1014, with fresh captcha data in the error data that must be used for the next attempt." ), ...requestBodySchema({ type: 'object', required: ['guid', 'solution'], properties: { guid: { type: 'string', description: 'Must match the guid field returned by the fetch method.', }, solution: { type: 'string', description: 'The text typed in by the user as the solution of the captcha.', }, }, }), responses: { ...response200( 'Validates the solution against the given guid. On success the captcha remains valid for thirty minutes and this returns 1. Captchas are single-use; throws 1014 on mismatch, with new captcha data in the error data that must be used for the next attempt.', { type: 'integer', enum: [1] } ), ...response500(), }, }, }, };