


module.exports = {


    friendlyName: '',


    description: '',


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

    exits: {
        success: {
            description: 'Success',
        },
        decryptionFailedError:{
            description:"Decryption of password failed"
        }
    },


    fn: async function (inputs, exits) {

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

            if(err){
                throw 'decryptionFailedError';
            }
            //console.log('decrypted: ' + msg);
            return exits.success(msg)

        });
    }

};

