@simka, чтобы модуль не обновлялся , нужно при его установке указать статичную версию, вместо звёздочки *
9f537e0a-20c5-423d-8e55-66adab21026d-image.png
Как вывести результат функции generateEncPassword в переменную?
Проект - 1.xml
const crypto = require('crypto');
const password = [[REG_PASSWORD]]
const publicKey = [[PUBLICKEY]]
const publicKeyId = [[PUBLICKEYID]]
const encryptionVersion = [[ENCRYPTIONVERSION]]
function encrypt({password, publicKey, publicKeyId}) {
const time = Date.now().toString();
const key = crypto.pseudoRandomBytes(32);
const iv = Buffer.alloc(12, 0);
const cipher = crypto.createCipheriv('aes-256-gcm', key, iv).setAAD(Buffer.from(time));
const aesEncrypted = Buffer.concat([cipher.update(Buffer.from(password)), cipher.final()]);
const authTag = cipher.getAuthTag();
const encryptedKey = seal(key, Buffer.from(publicKey, 'hex'));
return {
encrypted: Buffer.concat([
Buffer.from([
1,
Number(publicKeyId),
encryptedKey.byteLength & 255,
(encryptedKey.byteLength >> 8) & 255,
]),
encryptedKey,
authTag,
aesEncrypted,
]).toString('base64'),
time,
};
}
function generateEncPassword({password, publicKey, publicKeyId, encryptionVersion}) {
const { encrypted, time } = encrypt(password, publicKey, publicKeyId);
return `#PWD_INSTAGRAM_BROWSER:${encryptionVersion}:${time}:${encrypted}`;
}