mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-04-25 12:19:10 +00:00
16 lines
444 B
JavaScript
16 lines
444 B
JavaScript
// @flow
|
|
import { type AppContext } from '../Roleypoly'
|
|
import { type Context } from 'koa'
|
|
|
|
export default ($: AppContext) => ({
|
|
async checkAuthChallenge (ctx: Context, text: string): Promise<boolean> {
|
|
const chall = await $.auth.fetchDMChallenge({ human: text.toLowerCase() })
|
|
if (chall == null) {
|
|
return false
|
|
}
|
|
|
|
$.auth.injectSessionFromChallenge(ctx, chall)
|
|
$.auth.deleteDMChallenge(chall)
|
|
return true
|
|
}
|
|
})
|