import os from 'node:os';
import { containsPlaintextSecret, redactSecrets } from '../secret-redaction.js';
export function sharedRecordHasSecret(value) {
    return containsPlaintextSecret(value);
}
export function redactSharedRecord(value) {
    return redactHomePaths(redactSecrets(value));
}
export function redactHomePaths(value) {
    const home = os.homedir();
    if (!home)
        return value;
    if (typeof value === 'string')
        return value.split(home).join('~');
    if (Array.isArray(value))
        return value.map((item) => redactHomePaths(item));
    if (value && typeof value === 'object') {
        const out = {};
        for (const [key, candidate] of Object.entries(value))
            out[key] = redactHomePaths(candidate);
        return out;
    }
    return value;
}
export function isMockPositiveSharedClaim(record) {
    if (!record || typeof record !== 'object')
        return false;
    const row = record;
    if (String(row.schema || '') !== 'sks.triwiki-claim-record.v1')
        return false;
    const status = String(row.status || 'verified_partial');
    if (status === 'verified_partial' || status === 'negative' || status === 'wrongness')
        return false;
    const text = JSON.stringify(record).toLowerCase();
    return /\b(mock|fixture|fake|stub)\b/.test(text);
}
//# sourceMappingURL=shared-memory-security.js.map