import { AuthHelpers } from "../helpers/auth.js";
import { MiAuth } from "../middleware/auth.js";
export function setupEndpointsAuth(router) {
    router.post("/v1/apps", async (ctx)=>{
        ctx.body = await AuthHelpers.registerApp(ctx);
    });
    router.get("/v1/apps/verify_credentials", async (ctx)=>{
        ctx.body = await AuthHelpers.verifyAppCredentials(ctx);
    });
    router.post("/v1/iceshrimp/apps/info", MiAuth(true), async (ctx)=>{
        ctx.body = await AuthHelpers.getAppInfo(ctx);
    });
    router.post("/v1/iceshrimp/auth/code", MiAuth(true), async (ctx)=>{
        ctx.body = await AuthHelpers.getAuthCode(ctx);
    });
}
export function setupEndpointsAuthRoot(router) {
    router.post("/oauth/token", async (ctx)=>{
        ctx.body = await AuthHelpers.getAuthToken(ctx);
    });
    router.post("/oauth/revoke", async (ctx)=>{
        ctx.body = await AuthHelpers.revokeAuthToken(ctx);
    });
}
