You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
492 B

4 years ago
const ref = require('ref-napi');
4 years ago
4 years ago
/// Create a new salt from the string `buffer`.
4 years ago
function Salt(buffer, tag)
{
this.tag = tag || '__SPECIFIC';
if (buffer) {
this.buffer = ref.allocCString(buffer);
} else {
this.buffer = null;
4 years ago
this.tag = '__NONE';
4 years ago
}
}
4 years ago
/// No salt.
4 years ago
Salt.None = new Salt(null, '__NONE');
4 years ago
/// A randomly generated salt.
4 years ago
Salt.Random = new Salt(null, '__RANDOM');
4 years ago
/// The static default salt.
4 years ago
Salt.Default = new Salt(null, '__DEFAULT');
module.exports = Salt;