// @flow import { type AppContext } from '../Roleypoly' import { type Context } from 'koa' export default ($: AppContext) => ({ async checkAuthChallenge (ctx: Context, text: string): Promise { const chall = await $.auth.fetchDMChallenge({ human: text }) if (chall == null) { return false } $.auth.injectSessionFromChallenge(ctx, chall) $.auth.deleteDMChallenge(chall) return true } })