diff --git a/js/encryption.js b/js/encryption.js index 7df1bb37..029abe9a 100644 --- a/js/encryption.js +++ b/js/encryption.js @@ -19,6 +19,11 @@ function encryptWithKey(text,key) { return encrypted; } +function getKeyFromPasswordSync(password,salt,length) { + var rounds = 500; + return crypto.pbkdf2Sync(password,salt,rounds,length,'sha256'); +} + function getKeyFromPassword(password,salt,length,callback) { var rounds = 500; crypto.pbkdf2(password,salt,rounds,length,'sha256',(error, derivedKey) => { @@ -54,6 +59,7 @@ function decryptWithKeyAndIV(text,key,iv) { exports.encryptWithKeyAndIV = encryptWithKeyAndIV; exports.decryptWithKeyAndIV = decryptWithKeyAndIV; exports.getKeyFromPassword = getKeyFromPassword; +exports.getKeyFromPasswordSync = getKeyFromPasswordSync; exports.encryptWithKey = encryptWithKey; exports.decryptWithKey = decryptWithKey; diff --git a/js/plugin-loader.js b/js/plugin-loader.js index c661cc76..3e30dc0d 100644 --- a/js/plugin-loader.js +++ b/js/plugin-loader.js @@ -326,6 +326,10 @@ Plugin.prototype = { else { throw new Error (`No file name for data service`) } + // Make the relative path clear. process.cwd() is zlux-example-server/bin/ + if (!path.isAbsolute(fileLocation)) { + fileLocation = path.join(process.cwd(),fileLocation); + } const nodeModule = require(fileLocation); dataservice.nodeModule = nodeModule; } @@ -427,7 +431,11 @@ NodeAuthenticationPlugIn.prototype = { }, init(context) { - const filepath = path.join(this.location, 'lib', this.filename); + let filepath = path.join(this.location, 'lib', this.filename); + // Make the relative path clear. process.cwd() is zlux-example-server/bin/ + if (!path.isAbsolute(filepath)) { + filepath = path.join(process.cwd(),filepath); + } bootstrapLogger.log(bootstrapLogger.INFO, `Auth plugin ${this.identifier}: loading auth handler module ${filepath}`) this.authenticationModule = require(filepath);