Files
order-notification-automation/tests/fixtures/isolated-vault-key.cjs
T

16 lines
672 B
JavaScript

'use strict';
// The attachment tests exercise real AES-GCM + SQLite; only the OS key-provider
// boundary is replaced so that unrelated Windows ACL/DPAPI latency cannot mask
// file ownership, request replay and upload validation regressions.
module.exports = function fixtureKeys(t) {
const { BpmVault } = require('../../src/platform/security/vault.cjs'),
crypto = require('node:crypto'),
seed = crypto.randomBytes(32);
t.mock.method(BpmVault.prototype, 'ensureKey', function () {
if (!this.key)
this.key = crypto.createHmac('sha256', seed).update(this.stateDir.toLowerCase()).digest();
return this.key;
});
t.after(() => seed.fill(0));
};