MCPcopy Create free account
hub / github.com/lightdash/lightdash / encrypt

Function encrypt

scripts/dev-github-reconcile.cjs:44–51  ·  view source on GitHub ↗
(message, secret)

Source from the content-addressed store, hash-verified

42}
43
44function encrypt(message, secret) {
45 const iv = crypto.randomBytes(IV);
46 const salt = crypto.randomBytes(SALT);
47 const key = crypto.pbkdf2Sync(secret, salt, ITER, KEYLEN, DIGEST);
48 const cipher = crypto.createCipheriv('aes-256-gcm', key, iv, { authTagLength: TAG });
49 const enc = Buffer.concat([cipher.update(String(message), 'utf-8'), cipher.final()]);
50 return Buffer.concat([salt, cipher.getAuthTag(), iv, enc]);
51}
52function decrypt(buf, secret) {
53 const salt = buf.subarray(0, SALT);
54 const tag = buf.subarray(SALT, SALT + TAG);

Callers 3

stepInstallationFunction · 0.70
stepDbtRepoRepointFunction · 0.70
stepWarehousePortFixFunction · 0.70

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected