import { QueryResolvers } from '../../../models' ; import { ModuleContext } from '@graphql-modules/core' ; import { AccountsModuleContext } from '../../accounts' ; import { AccountsPassword } from '@accounts/password' ; export const Query = { twoFactorSecret : async ( _ , args , ctx ) => { const { user , injector } = ctx ; if ( ! ( user && user . id ) ) { throw new Error ( 'Unauthorized' ) ; } const secret = injector . get ( AccountsPassword ) . twoFactor . getNewAuthSecret ( ) ; return secret ; } , } ;