imports/vx/server/code/vxapp.js
/**
     * Generate and return a secret for 2FA.
     *
     * @return {object} Standard result object bearing secret.
     */
Generate and return a secret for 2FA.
@return {object} Standard result object bearing secret.
Generate and return a secret for 2FA . @return { object } Standard result object bearing secret .
generateSecret() {
        try {
            const userId = Meteor.userId()
            if (!userId) {
                OLog.error("vxapp.js generateSecret security check failed user is not logged in")
                return { success : false, icon : "EYE", key : "common.alert_security_check_failed" }
            }
            const secret = authenticator.generateSecret()
            OLog.debug(`vxapp.js generateSecret successfully generated secret for ${Util.getUserEmail(userId)}`)
            return { success : true, icon : "ENVELOPE", key : "common.alert_transaction_success", secret }
        }
        catch (error) {
            OLog.error(`vxapp.js generateSecret unexpected error=${error}`)
            return { success : false, icon : "BUG", key : "common.alert_unexpected_error", variables : { error : error.toString() } }
        }
    }
generateSecret ( ) { try { const userId = Meteor . userId ( ) if ( ! userId ) { OLog . error ( "vxapp.js generateSecret security check failed user is not logged in" ) return { success : false , icon : "EYE" , key : "common.alert_security_check_failed" } } const secret = authenticator . generateSecret ( ) OLog . debug ( ` ${ Util . getUserEmail ( userId ) } ` ) return { success : true , icon : "ENVELOPE" , key : "common.alert_transaction_success" , secret } } catch ( error ) { OLog . error ( ` ${ error } ` ) return { success : false , icon : "BUG" , key : "common.alert_unexpected_error" , variables : { error : error . toString ( ) } } } }
Generate and return a secret for 2FA.
Generate and return a secret for 2FA .