"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const xrpc_server_1 = require("@atproto/xrpc-server");
const lexicons_1 = require("../../../../lexicon/lexicons");
function default_1(server, ctx) {
    server.com.atproto.server.revokeAppPassword({
        auth: ctx.authVerifier.authorization({
            authorize: () => {
                throw new xrpc_server_1.ForbiddenError('OAuth credentials are not supported for this endpoint');
            },
        }),
        handler: async ({ auth, input, req }) => {
            if (ctx.entrywayAgent) {
                await ctx.entrywayAgent.com.atproto.server.revokeAppPassword(input.body, await ctx.entrywayAuthHeaders(req, auth.credentials.did, lexicons_1.ids.ComAtprotoServerRevokeAppPassword));
                return;
            }
            const requester = auth.credentials.did;
            const { name } = input.body;
            await ctx.accountManager.revokeAppPassword(requester, name);
        },
    });
}
//# sourceMappingURL=revokeAppPassword.js.map