


module.exports = {


    friendlyName: '',


    description: '',


    inputs: {
        payload: {
            type: 'ref',
            required:true
        }
    },

    exits: {
        success: {
            description: 'Success',

        },
        encryptionFailedError:{
            description:"Encryption of password failed"
        }
    },


    fn: async function (inputs, exits) {

        sails.config.cryptoUtils.encrypt(inputs.payload, function (err, msg) {

            if(err){
                throw 'encryptionFailedError';
            }

            //console.log('encrypted: ' + msg);

            return exits.success(msg)
        })
    }

};

