v0.1.6 Add api check for the server - zhentian-wan/MEANAppsFiles GitHub Wiki
Api-check:
var apiCheckFactory = require('api-check'),
apiCheck = apiCheckFactory();
module.exports = apiCheck;
For example: encryption.js
var crypto = require('crypto'),
apiCheck = require('./apiCheck');
exports.createSalt = function() {
return crypto.randomBytes(128).toString('base64');
};
var hashPwd_api = [
apiCheck.string,
apiCheck.string
];
exports.hashPwd = function(salt, pwd) {
apiCheck.throw(hashPwd_api, arguments);
var hmac = crypto.createHmac('sha1', salt);
return hmac.update(pwd).digest('hex');
};