Run generateKeyPair on next tick

This commit is contained in:
Jarred Sumner
2024-07-15 14:10:24 -07:00
parent caaeae123a
commit cff85fd948

View File

@@ -11938,9 +11938,9 @@ crypto_exports.generateKeyPairSync = _generateKeyPairSync;
crypto_exports.generateKeyPair = function (algorithm, options, callback) {
try {
const result = _generateKeyPairSync(algorithm, options);
typeof callback === "function" && callback(null, result.publicKey, result.privateKey);
typeof callback === "function" && process.nextTick(callback, null, result.publicKey, result.privateKey);
} catch (err) {
typeof callback === "function" && callback(err);
typeof callback === "function" && process.nextTick(callback, err);
}
};