Files
Shadowbroker/desktop-shell/src/nativeControlAudit.ts
T
anoracleofra-code 668ce16dc7 v0.9.6: InfoNet hashchain, Wormhole gate encryption, mesh reputation, 16 community contributors
Gate messages now propagate via the Infonet hashchain as encrypted blobs — every node syncs them
through normal chain sync while only Gate members with MLS keys can decrypt. Added mesh reputation
system, peer push workers, voluntary Wormhole opt-in for node participation, fork recovery,
killwormhole scripts, obfuscated terminology, and hardened the self-updater to protect encryption
keys and chain state during updates.

New features: Shodan search, train tracking, Sentinel Hub imagery, 8 new intelligence layers,
CCTV expansion to 11,000+ cameras across 6 countries, Mesh Terminal CLI, prediction markets,
desktop-shell scaffold, and comprehensive mesh test suite (215 frontend + backend tests passing).

Community contributors: @wa1id, @AlborzNazari, @adust09, @Xpirix, @imqdcr, @csysp, @suranyami,
@chr0n1x, @johan-martensson, @singularfailure, @smithbh, @OrfeoTerkuci, @deuza, @tm-const,
@Elhard1, @ttulttul
2026-03-26 05:58:04 -06:00

61 lines
1.8 KiB
TypeScript

import type {
DesktopControlAuditOutcome,
DesktopControlAuditRecord,
DesktopControlAuditReport,
} from '../../frontend/src/lib/desktopControlContract';
import type { NativeControlAuditEvent, NativeControlAuditTrail } from './types';
const DEFAULT_LIMIT = 100;
function incrementOutcome(
counts: Partial<Record<DesktopControlAuditOutcome, number>>,
outcome: DesktopControlAuditOutcome,
) {
counts[outcome] = (counts[outcome] || 0) + 1;
}
export function createNativeControlAuditTrail(maxEntries: number = DEFAULT_LIMIT): NativeControlAuditTrail {
const entries: DesktopControlAuditRecord[] = [];
let totalRecorded = 0;
return {
record(event: NativeControlAuditEvent) {
totalRecorded += 1;
entries.push({
...event,
recordedAt: Date.now(),
});
if (entries.length > maxEntries) {
entries.splice(0, entries.length - maxEntries);
}
},
snapshot(limit: number = 25): DesktopControlAuditReport {
const recent = entries.slice(-Math.max(1, limit)).reverse();
const byOutcome: Partial<Record<DesktopControlAuditOutcome, number>> = {};
let lastProfileMismatch: DesktopControlAuditRecord | undefined;
let lastDenied: DesktopControlAuditRecord | undefined;
for (const entry of entries) {
incrementOutcome(byOutcome, entry.outcome);
if (entry.outcome === 'profile_warn' || entry.outcome === 'profile_denied') {
lastProfileMismatch = entry;
}
if (entry.outcome === 'profile_denied' || entry.outcome === 'capability_denied') {
lastDenied = entry;
}
}
return {
totalEvents: entries.length,
totalRecorded,
recent,
byOutcome,
lastProfileMismatch,
lastDenied,
};
},
clear() {
totalRecorded = 0;
entries.splice(0, entries.length);
},
};
}