Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateIdFromPublicKeyFile = exports.passwordKeyDerivation = void 0;
const crypto_1 = require("crypto");
const fs_1 = require("fs");
const bs58_1 = require("bs58");
function passwordKeyDerivation(password) {
const iterations_s = process.env.FLUXCHAT_KEY_DERIVATION_ITERATIONS || '600000';
const iterations_i = parseInt(iterations_s, 10);
const pkd_b = (0, crypto_1.pbkdf2Sync)(password, 'FluxChat_Static_Salt', iterations_i, 64, 'sha256');
const pkd_s = pkd_b.toString('base64');
return pkd_s;
}
exports.passwordKeyDerivation = passwordKeyDerivation;
function generateIdFromPublicKeyFile(path) {
const publicKey = (0, crypto_1.createPublicKey)((0, fs_1.readFileSync)(path));
const pkExport = publicKey.export({ type: 'spki', format: 'der' });
const publicKeyHash = (0, crypto_1.createHash)('sha256').update(pkExport).digest();
const publicKeyHash_bs58 = (0, bs58_1.encode)(publicKeyHash);
return `FC_${publicKeyHash_bs58}`;
}
exports.generateIdFromPublicKeyFile = generateIdFromPublicKeyFile;
|