Files
Baileys/WASignalGroup/keyhelper.js
2021-09-27 12:48:57 +05:30

22 lines
453 B
JavaScript

const curve = require('libsignal/src/curve');
const nodeCrypto = require('crypto');
exports.generateSenderKey = function() {
return nodeCrypto.randomBytes(32);
}
exports.generateSenderKeyId = function() {
return nodeCrypto.randomInt(2147483647);
}
exports.generateSenderSigningKey = function(key) {
if (!key) {
key = curve.generateKeyPair();
}
return {
public: key.pubKey,
private: key.privKey,
};
}