@kya-os/checkpoint-shared 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/beacon-types/index.d.mts +10 -1
- package/dist/beacon-types/index.d.ts +10 -1
- package/dist/beacon-types/index.js +20 -1
- package/dist/beacon-types/index.mjs +20 -2
- package/dist/browser.d.mts +6 -1
- package/dist/browser.d.ts +6 -1
- package/dist/browser.js +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/canonical-signer/index.js +31 -2
- package/dist/canonical-signer/index.mjs +31 -2
- package/dist/deploy/index.d.mts +827 -0
- package/dist/deploy/index.d.ts +827 -0
- package/dist/deploy/index.js +458 -0
- package/dist/deploy/index.mjs +433 -0
- package/dist/gateway/index.d.mts +575 -0
- package/dist/gateway/index.d.ts +575 -0
- package/dist/gateway/index.js +98 -0
- package/dist/gateway/index.mjs +88 -0
- package/dist/index.d.mts +3071 -871
- package/dist/index.d.ts +3071 -871
- package/dist/index.js +3344 -1308
- package/dist/index.mjs +4593 -2667
- package/dist/mcpi/agentshield-api/index.d.mts +47 -0
- package/dist/mcpi/agentshield-api/index.d.ts +47 -0
- package/dist/mcpi/agentshield-api/index.js +2 -0
- package/dist/mcpi/agentshield-api/index.mjs +1 -0
- package/dist/mcpi/approval-grant/index.d.mts +79 -0
- package/dist/mcpi/approval-grant/index.d.ts +79 -0
- package/dist/mcpi/approval-grant/index.js +157 -0
- package/dist/mcpi/approval-grant/index.mjs +150 -0
- package/dist/mcpi/dashboard-config/index.d.mts +14075 -0
- package/dist/mcpi/dashboard-config/index.d.ts +14075 -0
- package/dist/mcpi/dashboard-config/index.js +517 -0
- package/dist/mcpi/dashboard-config/index.mjs +492 -0
- package/dist/mcpi/multibase-ed25519.d.mts +8 -0
- package/dist/mcpi/multibase-ed25519.d.ts +8 -0
- package/dist/mcpi/multibase-ed25519.js +125 -0
- package/dist/mcpi/multibase-ed25519.mjs +119 -0
- package/dist/signals/index.d.mts +158 -0
- package/dist/signals/index.d.ts +158 -0
- package/dist/signals/index.js +1574 -0
- package/dist/signals/index.mjs +1544 -0
- package/dist/test-fixtures/index.d.mts +53 -8
- package/dist/test-fixtures/index.d.ts +53 -8
- package/dist/test-fixtures/index.js +164 -7
- package/dist/test-fixtures/index.mjs +158 -8
- package/dist/tool-protection/index.d.mts +1120 -0
- package/dist/tool-protection/index.d.ts +1120 -0
- package/dist/tool-protection/index.js +370 -0
- package/dist/tool-protection/index.mjs +338 -0
- package/package.json +54 -8
- package/src/data/compiled/merged-rules.json +8 -2
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// src/mcpi/did-key.ts
|
|
2
|
+
var BASE58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
3
|
+
var BASE58_INDEX = (() => {
|
|
4
|
+
const idx = {};
|
|
5
|
+
for (let i = 0; i < BASE58_ALPHABET.length; i++) idx[BASE58_ALPHABET[i]] = i;
|
|
6
|
+
return idx;
|
|
7
|
+
})();
|
|
8
|
+
function base58btcDecode(str) {
|
|
9
|
+
if (str.length === 0) return new Uint8Array(0);
|
|
10
|
+
let zeros = 0;
|
|
11
|
+
while (zeros < str.length && str[zeros] === BASE58_ALPHABET[0]) zeros++;
|
|
12
|
+
const bytes = [0];
|
|
13
|
+
for (let i = 0; i < str.length; i++) {
|
|
14
|
+
const value = BASE58_INDEX[str[i]];
|
|
15
|
+
if (value === void 0) return null;
|
|
16
|
+
let carry = value;
|
|
17
|
+
for (let j = 0; j < bytes.length; j++) {
|
|
18
|
+
carry += bytes[j] * 58;
|
|
19
|
+
bytes[j] = carry & 255;
|
|
20
|
+
carry >>= 8;
|
|
21
|
+
}
|
|
22
|
+
while (carry > 0) {
|
|
23
|
+
bytes.push(carry & 255);
|
|
24
|
+
carry >>= 8;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
let high = bytes.length;
|
|
28
|
+
while (high > 0 && bytes[high - 1] === 0) high--;
|
|
29
|
+
const out = new Uint8Array(zeros + high);
|
|
30
|
+
for (let i = 0; i < high; i++) {
|
|
31
|
+
out[zeros + high - 1 - i] = bytes[i];
|
|
32
|
+
}
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
function base58btcEncode(bytes) {
|
|
36
|
+
if (bytes.length === 0) return "";
|
|
37
|
+
let zeros = 0;
|
|
38
|
+
while (zeros < bytes.length && bytes[zeros] === 0) zeros++;
|
|
39
|
+
const digits = [0];
|
|
40
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
41
|
+
let carry = bytes[i];
|
|
42
|
+
for (let j = 0; j < digits.length; j++) {
|
|
43
|
+
carry += digits[j] * 256;
|
|
44
|
+
digits[j] = carry % 58;
|
|
45
|
+
carry = Math.floor(carry / 58);
|
|
46
|
+
}
|
|
47
|
+
while (carry > 0) {
|
|
48
|
+
digits.push(carry % 58);
|
|
49
|
+
carry = Math.floor(carry / 58);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
let high = digits.length;
|
|
53
|
+
while (high > 0 && digits[high - 1] === 0) high--;
|
|
54
|
+
let out = BASE58_ALPHABET[0].repeat(zeros);
|
|
55
|
+
for (let i = high - 1; i >= 0; i--) {
|
|
56
|
+
out += BASE58_ALPHABET[digits[i]];
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// src/mcpi/multibase-ed25519.ts
|
|
62
|
+
var ED25519_PUB_MULTICODEC = [237, 1];
|
|
63
|
+
var ED25519_PUBKEY_LENGTH2 = 32;
|
|
64
|
+
var ED25519_MULTIKEY_LENGTH2 = ED25519_PUB_MULTICODEC.length + ED25519_PUBKEY_LENGTH2;
|
|
65
|
+
var MAX_ED25519_KEY_BODY_LENGTH = 64;
|
|
66
|
+
function base64AnyToBytes(body) {
|
|
67
|
+
if (body.length === 0) return null;
|
|
68
|
+
let normalized = body.replace(/-/g, "+").replace(/_/g, "/");
|
|
69
|
+
const remainder = normalized.length % 4;
|
|
70
|
+
if (remainder === 1) return null;
|
|
71
|
+
if (remainder === 2) normalized += "==";
|
|
72
|
+
else if (remainder === 3) normalized += "=";
|
|
73
|
+
if (!/^[A-Za-z0-9+/]+={0,2}$/.test(normalized)) return null;
|
|
74
|
+
try {
|
|
75
|
+
const bin = atob(normalized);
|
|
76
|
+
const out = new Uint8Array(bin.length);
|
|
77
|
+
for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);
|
|
78
|
+
return out;
|
|
79
|
+
} catch {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function toRawEd25519Key(decoded) {
|
|
84
|
+
if (decoded.length === ED25519_PUBKEY_LENGTH2) return decoded;
|
|
85
|
+
if (decoded.length === ED25519_MULTIKEY_LENGTH2 && decoded[0] === ED25519_PUB_MULTICODEC[0] && decoded[1] === ED25519_PUB_MULTICODEC[1]) {
|
|
86
|
+
return decoded.slice(ED25519_PUB_MULTICODEC.length);
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
function decodeEd25519PublicKeyMultibaseTolerant(mb) {
|
|
91
|
+
if (typeof mb !== "string" || mb.length < 2) return null;
|
|
92
|
+
const prefix = mb[0];
|
|
93
|
+
const body = mb.slice(1);
|
|
94
|
+
if (body.length > MAX_ED25519_KEY_BODY_LENGTH) return null;
|
|
95
|
+
let decoded;
|
|
96
|
+
if (prefix === "z") {
|
|
97
|
+
decoded = base58btcDecode(body);
|
|
98
|
+
} else if (prefix === "m" || prefix === "u") {
|
|
99
|
+
decoded = base64AnyToBytes(body);
|
|
100
|
+
} else {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
if (!decoded) return null;
|
|
104
|
+
return toRawEd25519Key(decoded);
|
|
105
|
+
}
|
|
106
|
+
function encodeEd25519PublicKeyMultibase(rawPubKey) {
|
|
107
|
+
if (rawPubKey.length !== ED25519_PUBKEY_LENGTH2) {
|
|
108
|
+
throw new Error(
|
|
109
|
+
`Ed25519 public key must be ${ED25519_PUBKEY_LENGTH2} bytes, got ${rawPubKey.length}`
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
const prefixed = new Uint8Array(ED25519_MULTIKEY_LENGTH2);
|
|
113
|
+
prefixed[0] = ED25519_PUB_MULTICODEC[0];
|
|
114
|
+
prefixed[1] = ED25519_PUB_MULTICODEC[1];
|
|
115
|
+
prefixed.set(rawPubKey, ED25519_PUB_MULTICODEC.length);
|
|
116
|
+
return "z" + base58btcEncode(prefixed);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export { MAX_ED25519_KEY_BODY_LENGTH, base58btcDecode, base58btcEncode, decodeEd25519PublicKeyMultibaseTolerant, encodeEd25519PublicKeyMultibase };
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
declare const SENSITIVE_REJECTION_LIST_VERSIONS: readonly ["v1"];
|
|
2
|
+
type SensitiveRejectionListVersion = (typeof SENSITIVE_REJECTION_LIST_VERSIONS)[number];
|
|
3
|
+
declare const CURRENT_SENSITIVE_REJECTION_LIST_VERSION: SensitiveRejectionListVersion;
|
|
4
|
+
type SensitiveAttributeCategory = 'racial-or-ethnic-origin' | 'religious-or-philosophical-beliefs' | 'mental-or-physical-health-condition-or-diagnosis' | 'sex-life-or-sexual-orientation' | 'citizenship-or-immigration-status' | 'biometric-identifier-or-derivative' | 'government-identification-number';
|
|
5
|
+
interface SensitiveAttributeRule {
|
|
6
|
+
category: SensitiveAttributeCategory;
|
|
7
|
+
description: string;
|
|
8
|
+
regimes: string[];
|
|
9
|
+
keywords: string[];
|
|
10
|
+
}
|
|
11
|
+
declare const SENSITIVE_ATTRIBUTE_REJECTION_LIST: Record<SensitiveRejectionListVersion, SensitiveAttributeRule[]>;
|
|
12
|
+
interface CompositionRiskRule {
|
|
13
|
+
id: string;
|
|
14
|
+
category: SensitiveAttributeCategory;
|
|
15
|
+
signalIds: string[];
|
|
16
|
+
minMatches: number;
|
|
17
|
+
regimes: string[];
|
|
18
|
+
rationale: string;
|
|
19
|
+
}
|
|
20
|
+
declare const COMPOSITION_RISK_RULES: CompositionRiskRule[];
|
|
21
|
+
interface SensitiveAttributeReview {
|
|
22
|
+
listVersion: SensitiveRejectionListVersion;
|
|
23
|
+
reviewedBy: string;
|
|
24
|
+
reviewedAt: string;
|
|
25
|
+
combinesWith: string[];
|
|
26
|
+
derivesCategory: SensitiveAttributeCategory | null;
|
|
27
|
+
rationale: string;
|
|
28
|
+
}
|
|
29
|
+
type SensitiveAttributeViolationKind = 'direct' | 'composition' | 'declared' | 'stale-review';
|
|
30
|
+
interface SensitiveAttributeViolation {
|
|
31
|
+
kind: SensitiveAttributeViolationKind;
|
|
32
|
+
category: SensitiveAttributeCategory | null;
|
|
33
|
+
ruleId: string;
|
|
34
|
+
regimes: string[];
|
|
35
|
+
message: string;
|
|
36
|
+
}
|
|
37
|
+
declare function checkDirectMatch(signal: Pick<SignalDefinition, 'id' | 'description' | 'group'>, version?: SensitiveRejectionListVersion): SensitiveAttributeViolation[];
|
|
38
|
+
declare function checkCompositionRisk(signalId: string, combinesWith: string[]): SensitiveAttributeViolation[];
|
|
39
|
+
declare function checkDeclaredCategory(review: Pick<SensitiveAttributeReview, 'derivesCategory'>, version?: SensitiveRejectionListVersion): SensitiveAttributeViolation[];
|
|
40
|
+
declare function checkReviewRecordIntegrity(review: SignalDefinition['review'] | undefined, currentVersion?: SensitiveRejectionListVersion): SensitiveAttributeViolation[];
|
|
41
|
+
declare function evaluateSensitiveAttributeCompliance(signal: SignalDefinition): SensitiveAttributeViolation[];
|
|
42
|
+
declare class SensitiveAttributeRejectionError extends Error {
|
|
43
|
+
readonly signalId: string;
|
|
44
|
+
readonly violations: SensitiveAttributeViolation[];
|
|
45
|
+
constructor(signalId: string, violations: SensitiveAttributeViolation[]);
|
|
46
|
+
}
|
|
47
|
+
declare function registerSignal(definition: SignalDefinition): SignalDefinition;
|
|
48
|
+
declare function checkSensitiveAttributeCompliance(signal: SignalDefinition): {
|
|
49
|
+
ok: boolean;
|
|
50
|
+
violations: SensitiveAttributeViolation[];
|
|
51
|
+
};
|
|
52
|
+
declare function findSignalsNeedingReevaluation(signals: SignalDefinition[], currentVersion?: SensitiveRejectionListVersion): SignalDefinition[];
|
|
53
|
+
|
|
54
|
+
declare const REGISTRY_VERSIONS: readonly ["v1", "v2"];
|
|
55
|
+
type RegistryVersion = (typeof REGISTRY_VERSIONS)[number];
|
|
56
|
+
declare const CURRENT_REGISTRY_VERSION: RegistryVersion;
|
|
57
|
+
type StabilityTier = 'high' | 'medium' | 'low';
|
|
58
|
+
type SignalMode = 'open' | 'consent' | 'never';
|
|
59
|
+
type SignalPlane = 'rendering' | 'platform' | 'transport' | 'behavioural';
|
|
60
|
+
type DenoisePolicy = {
|
|
61
|
+
kind: 'none';
|
|
62
|
+
} | {
|
|
63
|
+
kind: 'modal';
|
|
64
|
+
runs: number;
|
|
65
|
+
};
|
|
66
|
+
interface TierMeasurement {
|
|
67
|
+
agreementRate: number | null;
|
|
68
|
+
sampleSize: number;
|
|
69
|
+
browsers: string[];
|
|
70
|
+
measuredAt: string | null;
|
|
71
|
+
provisional: boolean;
|
|
72
|
+
notes: string;
|
|
73
|
+
}
|
|
74
|
+
interface SignalDefinition {
|
|
75
|
+
id: string;
|
|
76
|
+
addedVersion: RegistryVersion;
|
|
77
|
+
removedVersion: RegistryVersion | null;
|
|
78
|
+
tier: StabilityTier;
|
|
79
|
+
measurement: TierMeasurement;
|
|
80
|
+
denoise: DenoisePolicy;
|
|
81
|
+
mode: SignalMode;
|
|
82
|
+
plane: SignalPlane;
|
|
83
|
+
group: string;
|
|
84
|
+
u: number | null;
|
|
85
|
+
supersedes: string | null;
|
|
86
|
+
description: string;
|
|
87
|
+
review: SensitiveAttributeReview;
|
|
88
|
+
}
|
|
89
|
+
declare const FROZEN_FIELDS: readonly ["id", "addedVersion", "denoise", "mode", "plane", "group"];
|
|
90
|
+
declare const TIER_LOCKED_FIELDS: readonly ["tier"];
|
|
91
|
+
interface SnapshotRecord {
|
|
92
|
+
id: string;
|
|
93
|
+
addedVersion: RegistryVersion;
|
|
94
|
+
removedVersion: RegistryVersion | null;
|
|
95
|
+
denoise: DenoisePolicy;
|
|
96
|
+
mode: SignalMode;
|
|
97
|
+
plane: SignalPlane;
|
|
98
|
+
group: string;
|
|
99
|
+
finalizedTier: StabilityTier | null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
declare const SIGNAL_REGISTRY: SignalDefinition[];
|
|
103
|
+
|
|
104
|
+
declare function resolveSignalsAt(registry: SignalDefinition[], version?: RegistryVersion): SignalDefinition[];
|
|
105
|
+
declare function getSignal(registry: SignalDefinition[], id: string, version?: RegistryVersion): SignalDefinition | undefined;
|
|
106
|
+
declare function listShippedSignals(registry: SignalDefinition[]): SignalDefinition[];
|
|
107
|
+
type GroupedSignals = Record<SignalPlane, Record<string, SignalDefinition[]>>;
|
|
108
|
+
declare function groupSignals(signals: SignalDefinition[]): GroupedSignals;
|
|
109
|
+
|
|
110
|
+
type SignalReading = {
|
|
111
|
+
kind: 'present';
|
|
112
|
+
value: unknown;
|
|
113
|
+
} | {
|
|
114
|
+
kind: 'absent';
|
|
115
|
+
} | {
|
|
116
|
+
kind: 'error';
|
|
117
|
+
message?: string;
|
|
118
|
+
};
|
|
119
|
+
interface GroupFingerprint {
|
|
120
|
+
digest: string;
|
|
121
|
+
leaves: Record<string, string>;
|
|
122
|
+
}
|
|
123
|
+
interface PlaneFingerprint {
|
|
124
|
+
digest: string;
|
|
125
|
+
includedInRoot: boolean;
|
|
126
|
+
groups: Record<string, GroupFingerprint>;
|
|
127
|
+
}
|
|
128
|
+
interface FingerprintTree {
|
|
129
|
+
registryVersion: RegistryVersion;
|
|
130
|
+
root: string;
|
|
131
|
+
planes: Partial<Record<SignalPlane, PlaneFingerprint>>;
|
|
132
|
+
}
|
|
133
|
+
declare function buildFingerprintTree(registry: SignalDefinition[], readings: Record<string, SignalReading>, registryVersion?: RegistryVersion): FingerprintTree;
|
|
134
|
+
|
|
135
|
+
declare function computeSessionFingerprintHash(clientAttributes: Record<string, string> | null | undefined): string | null;
|
|
136
|
+
|
|
137
|
+
interface RegistryValidationResult {
|
|
138
|
+
valid: boolean;
|
|
139
|
+
errors: string[];
|
|
140
|
+
}
|
|
141
|
+
declare function validateRegistry(signals: SignalDefinition[]): RegistryValidationResult;
|
|
142
|
+
|
|
143
|
+
interface SnapshotViolation {
|
|
144
|
+
id: string;
|
|
145
|
+
kind: 'edited' | 'deleted' | 'unrecorded';
|
|
146
|
+
message: string;
|
|
147
|
+
}
|
|
148
|
+
interface SnapshotConsistencyResult {
|
|
149
|
+
ok: boolean;
|
|
150
|
+
violations: SnapshotViolation[];
|
|
151
|
+
}
|
|
152
|
+
declare function computeImmutableSnapshot(signal: SignalDefinition): SnapshotRecord;
|
|
153
|
+
declare function checkSnapshotConsistency(committed: SnapshotRecord[], live: SignalDefinition[]): SnapshotConsistencyResult;
|
|
154
|
+
declare function recordSnapshot(committed: SnapshotRecord[], live: SignalDefinition[]): SnapshotRecord[];
|
|
155
|
+
|
|
156
|
+
declare function generateRegistryMarkdown(registry: SignalDefinition[]): string;
|
|
157
|
+
|
|
158
|
+
export { COMPOSITION_RISK_RULES, CURRENT_REGISTRY_VERSION, CURRENT_SENSITIVE_REJECTION_LIST_VERSION, type CompositionRiskRule, type DenoisePolicy, FROZEN_FIELDS, type FingerprintTree, type GroupFingerprint, type GroupedSignals, type PlaneFingerprint, REGISTRY_VERSIONS, type RegistryValidationResult, type RegistryVersion, SENSITIVE_ATTRIBUTE_REJECTION_LIST, SENSITIVE_REJECTION_LIST_VERSIONS, SIGNAL_REGISTRY, type SensitiveAttributeCategory, SensitiveAttributeRejectionError, type SensitiveAttributeReview, type SensitiveAttributeRule, type SensitiveAttributeViolation, type SensitiveAttributeViolationKind, type SensitiveRejectionListVersion, type SignalDefinition, type SignalMode, type SignalPlane, type SignalReading, type SnapshotConsistencyResult, type SnapshotRecord, type SnapshotViolation, type StabilityTier, TIER_LOCKED_FIELDS, type TierMeasurement, buildFingerprintTree, checkCompositionRisk, checkDeclaredCategory, checkDirectMatch, checkReviewRecordIntegrity, checkSensitiveAttributeCompliance, checkSnapshotConsistency, computeImmutableSnapshot, computeSessionFingerprintHash, evaluateSensitiveAttributeCompliance, findSignalsNeedingReevaluation, generateRegistryMarkdown, getSignal, groupSignals, listShippedSignals, recordSnapshot, registerSignal, resolveSignalsAt, validateRegistry };
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
declare const SENSITIVE_REJECTION_LIST_VERSIONS: readonly ["v1"];
|
|
2
|
+
type SensitiveRejectionListVersion = (typeof SENSITIVE_REJECTION_LIST_VERSIONS)[number];
|
|
3
|
+
declare const CURRENT_SENSITIVE_REJECTION_LIST_VERSION: SensitiveRejectionListVersion;
|
|
4
|
+
type SensitiveAttributeCategory = 'racial-or-ethnic-origin' | 'religious-or-philosophical-beliefs' | 'mental-or-physical-health-condition-or-diagnosis' | 'sex-life-or-sexual-orientation' | 'citizenship-or-immigration-status' | 'biometric-identifier-or-derivative' | 'government-identification-number';
|
|
5
|
+
interface SensitiveAttributeRule {
|
|
6
|
+
category: SensitiveAttributeCategory;
|
|
7
|
+
description: string;
|
|
8
|
+
regimes: string[];
|
|
9
|
+
keywords: string[];
|
|
10
|
+
}
|
|
11
|
+
declare const SENSITIVE_ATTRIBUTE_REJECTION_LIST: Record<SensitiveRejectionListVersion, SensitiveAttributeRule[]>;
|
|
12
|
+
interface CompositionRiskRule {
|
|
13
|
+
id: string;
|
|
14
|
+
category: SensitiveAttributeCategory;
|
|
15
|
+
signalIds: string[];
|
|
16
|
+
minMatches: number;
|
|
17
|
+
regimes: string[];
|
|
18
|
+
rationale: string;
|
|
19
|
+
}
|
|
20
|
+
declare const COMPOSITION_RISK_RULES: CompositionRiskRule[];
|
|
21
|
+
interface SensitiveAttributeReview {
|
|
22
|
+
listVersion: SensitiveRejectionListVersion;
|
|
23
|
+
reviewedBy: string;
|
|
24
|
+
reviewedAt: string;
|
|
25
|
+
combinesWith: string[];
|
|
26
|
+
derivesCategory: SensitiveAttributeCategory | null;
|
|
27
|
+
rationale: string;
|
|
28
|
+
}
|
|
29
|
+
type SensitiveAttributeViolationKind = 'direct' | 'composition' | 'declared' | 'stale-review';
|
|
30
|
+
interface SensitiveAttributeViolation {
|
|
31
|
+
kind: SensitiveAttributeViolationKind;
|
|
32
|
+
category: SensitiveAttributeCategory | null;
|
|
33
|
+
ruleId: string;
|
|
34
|
+
regimes: string[];
|
|
35
|
+
message: string;
|
|
36
|
+
}
|
|
37
|
+
declare function checkDirectMatch(signal: Pick<SignalDefinition, 'id' | 'description' | 'group'>, version?: SensitiveRejectionListVersion): SensitiveAttributeViolation[];
|
|
38
|
+
declare function checkCompositionRisk(signalId: string, combinesWith: string[]): SensitiveAttributeViolation[];
|
|
39
|
+
declare function checkDeclaredCategory(review: Pick<SensitiveAttributeReview, 'derivesCategory'>, version?: SensitiveRejectionListVersion): SensitiveAttributeViolation[];
|
|
40
|
+
declare function checkReviewRecordIntegrity(review: SignalDefinition['review'] | undefined, currentVersion?: SensitiveRejectionListVersion): SensitiveAttributeViolation[];
|
|
41
|
+
declare function evaluateSensitiveAttributeCompliance(signal: SignalDefinition): SensitiveAttributeViolation[];
|
|
42
|
+
declare class SensitiveAttributeRejectionError extends Error {
|
|
43
|
+
readonly signalId: string;
|
|
44
|
+
readonly violations: SensitiveAttributeViolation[];
|
|
45
|
+
constructor(signalId: string, violations: SensitiveAttributeViolation[]);
|
|
46
|
+
}
|
|
47
|
+
declare function registerSignal(definition: SignalDefinition): SignalDefinition;
|
|
48
|
+
declare function checkSensitiveAttributeCompliance(signal: SignalDefinition): {
|
|
49
|
+
ok: boolean;
|
|
50
|
+
violations: SensitiveAttributeViolation[];
|
|
51
|
+
};
|
|
52
|
+
declare function findSignalsNeedingReevaluation(signals: SignalDefinition[], currentVersion?: SensitiveRejectionListVersion): SignalDefinition[];
|
|
53
|
+
|
|
54
|
+
declare const REGISTRY_VERSIONS: readonly ["v1", "v2"];
|
|
55
|
+
type RegistryVersion = (typeof REGISTRY_VERSIONS)[number];
|
|
56
|
+
declare const CURRENT_REGISTRY_VERSION: RegistryVersion;
|
|
57
|
+
type StabilityTier = 'high' | 'medium' | 'low';
|
|
58
|
+
type SignalMode = 'open' | 'consent' | 'never';
|
|
59
|
+
type SignalPlane = 'rendering' | 'platform' | 'transport' | 'behavioural';
|
|
60
|
+
type DenoisePolicy = {
|
|
61
|
+
kind: 'none';
|
|
62
|
+
} | {
|
|
63
|
+
kind: 'modal';
|
|
64
|
+
runs: number;
|
|
65
|
+
};
|
|
66
|
+
interface TierMeasurement {
|
|
67
|
+
agreementRate: number | null;
|
|
68
|
+
sampleSize: number;
|
|
69
|
+
browsers: string[];
|
|
70
|
+
measuredAt: string | null;
|
|
71
|
+
provisional: boolean;
|
|
72
|
+
notes: string;
|
|
73
|
+
}
|
|
74
|
+
interface SignalDefinition {
|
|
75
|
+
id: string;
|
|
76
|
+
addedVersion: RegistryVersion;
|
|
77
|
+
removedVersion: RegistryVersion | null;
|
|
78
|
+
tier: StabilityTier;
|
|
79
|
+
measurement: TierMeasurement;
|
|
80
|
+
denoise: DenoisePolicy;
|
|
81
|
+
mode: SignalMode;
|
|
82
|
+
plane: SignalPlane;
|
|
83
|
+
group: string;
|
|
84
|
+
u: number | null;
|
|
85
|
+
supersedes: string | null;
|
|
86
|
+
description: string;
|
|
87
|
+
review: SensitiveAttributeReview;
|
|
88
|
+
}
|
|
89
|
+
declare const FROZEN_FIELDS: readonly ["id", "addedVersion", "denoise", "mode", "plane", "group"];
|
|
90
|
+
declare const TIER_LOCKED_FIELDS: readonly ["tier"];
|
|
91
|
+
interface SnapshotRecord {
|
|
92
|
+
id: string;
|
|
93
|
+
addedVersion: RegistryVersion;
|
|
94
|
+
removedVersion: RegistryVersion | null;
|
|
95
|
+
denoise: DenoisePolicy;
|
|
96
|
+
mode: SignalMode;
|
|
97
|
+
plane: SignalPlane;
|
|
98
|
+
group: string;
|
|
99
|
+
finalizedTier: StabilityTier | null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
declare const SIGNAL_REGISTRY: SignalDefinition[];
|
|
103
|
+
|
|
104
|
+
declare function resolveSignalsAt(registry: SignalDefinition[], version?: RegistryVersion): SignalDefinition[];
|
|
105
|
+
declare function getSignal(registry: SignalDefinition[], id: string, version?: RegistryVersion): SignalDefinition | undefined;
|
|
106
|
+
declare function listShippedSignals(registry: SignalDefinition[]): SignalDefinition[];
|
|
107
|
+
type GroupedSignals = Record<SignalPlane, Record<string, SignalDefinition[]>>;
|
|
108
|
+
declare function groupSignals(signals: SignalDefinition[]): GroupedSignals;
|
|
109
|
+
|
|
110
|
+
type SignalReading = {
|
|
111
|
+
kind: 'present';
|
|
112
|
+
value: unknown;
|
|
113
|
+
} | {
|
|
114
|
+
kind: 'absent';
|
|
115
|
+
} | {
|
|
116
|
+
kind: 'error';
|
|
117
|
+
message?: string;
|
|
118
|
+
};
|
|
119
|
+
interface GroupFingerprint {
|
|
120
|
+
digest: string;
|
|
121
|
+
leaves: Record<string, string>;
|
|
122
|
+
}
|
|
123
|
+
interface PlaneFingerprint {
|
|
124
|
+
digest: string;
|
|
125
|
+
includedInRoot: boolean;
|
|
126
|
+
groups: Record<string, GroupFingerprint>;
|
|
127
|
+
}
|
|
128
|
+
interface FingerprintTree {
|
|
129
|
+
registryVersion: RegistryVersion;
|
|
130
|
+
root: string;
|
|
131
|
+
planes: Partial<Record<SignalPlane, PlaneFingerprint>>;
|
|
132
|
+
}
|
|
133
|
+
declare function buildFingerprintTree(registry: SignalDefinition[], readings: Record<string, SignalReading>, registryVersion?: RegistryVersion): FingerprintTree;
|
|
134
|
+
|
|
135
|
+
declare function computeSessionFingerprintHash(clientAttributes: Record<string, string> | null | undefined): string | null;
|
|
136
|
+
|
|
137
|
+
interface RegistryValidationResult {
|
|
138
|
+
valid: boolean;
|
|
139
|
+
errors: string[];
|
|
140
|
+
}
|
|
141
|
+
declare function validateRegistry(signals: SignalDefinition[]): RegistryValidationResult;
|
|
142
|
+
|
|
143
|
+
interface SnapshotViolation {
|
|
144
|
+
id: string;
|
|
145
|
+
kind: 'edited' | 'deleted' | 'unrecorded';
|
|
146
|
+
message: string;
|
|
147
|
+
}
|
|
148
|
+
interface SnapshotConsistencyResult {
|
|
149
|
+
ok: boolean;
|
|
150
|
+
violations: SnapshotViolation[];
|
|
151
|
+
}
|
|
152
|
+
declare function computeImmutableSnapshot(signal: SignalDefinition): SnapshotRecord;
|
|
153
|
+
declare function checkSnapshotConsistency(committed: SnapshotRecord[], live: SignalDefinition[]): SnapshotConsistencyResult;
|
|
154
|
+
declare function recordSnapshot(committed: SnapshotRecord[], live: SignalDefinition[]): SnapshotRecord[];
|
|
155
|
+
|
|
156
|
+
declare function generateRegistryMarkdown(registry: SignalDefinition[]): string;
|
|
157
|
+
|
|
158
|
+
export { COMPOSITION_RISK_RULES, CURRENT_REGISTRY_VERSION, CURRENT_SENSITIVE_REJECTION_LIST_VERSION, type CompositionRiskRule, type DenoisePolicy, FROZEN_FIELDS, type FingerprintTree, type GroupFingerprint, type GroupedSignals, type PlaneFingerprint, REGISTRY_VERSIONS, type RegistryValidationResult, type RegistryVersion, SENSITIVE_ATTRIBUTE_REJECTION_LIST, SENSITIVE_REJECTION_LIST_VERSIONS, SIGNAL_REGISTRY, type SensitiveAttributeCategory, SensitiveAttributeRejectionError, type SensitiveAttributeReview, type SensitiveAttributeRule, type SensitiveAttributeViolation, type SensitiveAttributeViolationKind, type SensitiveRejectionListVersion, type SignalDefinition, type SignalMode, type SignalPlane, type SignalReading, type SnapshotConsistencyResult, type SnapshotRecord, type SnapshotViolation, type StabilityTier, TIER_LOCKED_FIELDS, type TierMeasurement, buildFingerprintTree, checkCompositionRisk, checkDeclaredCategory, checkDirectMatch, checkReviewRecordIntegrity, checkSensitiveAttributeCompliance, checkSnapshotConsistency, computeImmutableSnapshot, computeSessionFingerprintHash, evaluateSensitiveAttributeCompliance, findSignalsNeedingReevaluation, generateRegistryMarkdown, getSignal, groupSignals, listShippedSignals, recordSnapshot, registerSignal, resolveSignalsAt, validateRegistry };
|