Fixed bun runtime.

This commit is contained in:
SamTV12345 2024-01-17 21:31:02 +01:00
parent f5db077355
commit 3435e8cfb9
2 changed files with 10 additions and 4 deletions

View file

@ -1,7 +1,8 @@
'use strict';
const {Buffer} = require('buffer');
const crypto = require('./crypto');
const crypto = require('node:crypto')
const cryptoHelper = require('./crypto')
const db = require('../db/DB');
const log4js = require('log4js');
@ -30,8 +31,7 @@ class Hkdf extends Kdf {
}
async derive(p, info) {
return Buffer.from(
await crypto.hkdf(p.digest, p.secret, p.salt, info, p.keyLen)).toString('hex');
return Buffer.from(await cryptoHelper.hkdf(p.digest, p.secret, p.salt, info, p.keyLen)).toString('hex');
}
}

View file

@ -2,7 +2,13 @@
const crypto = require('crypto');
const newMethod = async (...args) => new Promise((resolve) => crypto.hkdf(...args, resolve));
const newMethod = async (...args) => new Promise((resolve, reject) => crypto.hkdf(...args, (err, result)=>{
if(err){
return reject(err)
} else {
return resolve(result)
}
}));
/**
* Promisified version of Node.js's crypto.hkdf.