Change Buffer to Buffer.alloc on Node v12. Try to fix Snap.

This commit is contained in:
Lauri Ojansivu 2020-01-11 13:08:29 +02:00
parent 5bece0dd1e
commit e01f4dbf13
8 changed files with 29 additions and 24 deletions

View file

@ -286,14 +286,14 @@ export default class LDAP {
if (attribute) {
filter = new this.ldapjs.filters.EqualityFilter({
attribute,
value: new Buffer(id, 'hex'),
value: new Buffer.alloc(id, 'hex'),
});
} else {
const filters = [];
Unique_Identifier_Field.forEach((item) => {
filters.push(new this.ldapjs.filters.EqualityFilter({
attribute: item,
value : new Buffer(id, 'hex'),
value : new Buffer.alloc(id, 'hex'),
}));
});

View file

@ -131,9 +131,9 @@ var getTokenContent = function (token) {
if (token) {
try {
var parts = token.split('.');
var header = JSON.parse(new Buffer(parts[0], 'base64').toString());
content = JSON.parse(new Buffer(parts[1], 'base64').toString());
var signature = new Buffer(parts[2], 'base64');
var header = JSON.parse(new Buffer.alloc(parts[0], 'base64').toString());
content = JSON.parse(new Buffer.alloc(parts[1], 'base64').toString());
var signature = new Buffer.alloc(parts[2], 'base64');
var signed = parts[0] + '.' + parts[1];
} catch (err) {
this.content = {