source/encryption.js
function generateSalt(length) {
    if (length <= 0) {
        return Promise.reject(
            new Error(`Failed generating salt: Invalid length supplied: ${length}`)
        );
    }
    let output = "";
    while (output.length < length) {
        output += crypto.randomBytes(3).toString("base64");
        if (output.length > length) {
            output = output.substr(0, length);
        }
    }
    return Promise.resolve(output);
}
function generateSalt(length) {
    if (length <= 0) {
        return Promise.reject(
            new Error(`Failed generating salt: Invalid length supplied: ${length}`)
        );
    }
    let output = "";
    while (output.length < length) {
        output += crypto.randomBytes(3).toString("base64");
        if (output.length > length) {
            output = output.substr(0, length);
        }
    }
    return Promise.resolve(output);
}
Salt generator
@param {Number} length The length of the string to generate
@returns {Promise.<String>} A promise that resolves with a salt (hex)
@throws {Error} Rejects if length is invalid