(record: DecisionRecord)
| 589 | } |
| 590 | |
| 591 | export function writeDecision(record: DecisionRecord): void { |
| 592 | try { |
| 593 | mkdirSecure(DECISIONS_DIR); |
| 594 | const file = decisionFileForTab(record.tabId); |
| 595 | const tmp = `${file}.tmp.${process.pid}`; |
| 596 | writeSecureFile(tmp, JSON.stringify(record)); |
| 597 | fs.renameSync(tmp, file); |
| 598 | } catch (err) { |
| 599 | console.error('[security] writeDecision failed:', (err as Error).message); |
| 600 | } |
| 601 | } |
| 602 | |
| 603 | export function readDecision(tabId: number): DecisionRecord | null { |
| 604 | try { |
no test coverage detected