
let jwt = require('jsonwebtoken');


module.exports = {


    friendlyName: 'JWT Sign',


    description: '',


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

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


    fn: async function (inputs, exits) {
        return exits.success(jwt.sign(
            { data: inputs.payload },
            sails.config.custom.secret,
            { expiresIn: sails.config.custom.token_expire_in})
        );
    }
};

