agent-passport-system 2.0.0 → 2.1.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 +2 -2
- package/dist/src/v2/cognitive-attestation/disputes.d.ts +50 -0
- package/dist/src/v2/cognitive-attestation/disputes.d.ts.map +1 -0
- package/dist/src/v2/cognitive-attestation/disputes.js +12 -0
- package/dist/src/v2/cognitive-attestation/disputes.js.map +1 -0
- package/dist/src/v2/cognitive-attestation/envelope.d.ts +44 -0
- package/dist/src/v2/cognitive-attestation/envelope.d.ts.map +1 -0
- package/dist/src/v2/cognitive-attestation/envelope.js +341 -0
- package/dist/src/v2/cognitive-attestation/envelope.js.map +1 -0
- package/dist/src/v2/cognitive-attestation/index.d.ts +6 -0
- package/dist/src/v2/cognitive-attestation/index.d.ts.map +1 -0
- package/dist/src/v2/cognitive-attestation/index.js +23 -0
- package/dist/src/v2/cognitive-attestation/index.js.map +1 -0
- package/dist/src/v2/cognitive-attestation/types.d.ts +111 -0
- package/dist/src/v2/cognitive-attestation/types.d.ts.map +1 -0
- package/dist/src/v2/cognitive-attestation/types.js +13 -0
- package/dist/src/v2/cognitive-attestation/types.js.map +1 -0
- package/dist/src/v2/cognitive-attestation/verify.d.ts +67 -0
- package/dist/src/v2/cognitive-attestation/verify.d.ts.map +1 -0
- package/dist/src/v2/cognitive-attestation/verify.js +125 -0
- package/dist/src/v2/cognitive-attestation/verify.js.map +1 -0
- package/dist/src/v2/index.d.ts +2 -0
- package/dist/src/v2/index.d.ts.map +1 -1
- package/dist/src/v2/index.js +7 -0
- package/dist/src/v2/index.js.map +1 -1
- package/dist/src/v2/wallet-binding/bind.d.ts +12 -0
- package/dist/src/v2/wallet-binding/bind.d.ts.map +1 -1
- package/dist/src/v2/wallet-binding/bind.js +8 -9
- package/dist/src/v2/wallet-binding/bind.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -123,11 +123,11 @@ Institutional governance: charters, offices, federation, reserves, multi-party a
|
|
|
123
123
|
npx agent-passport-system-mcp
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
-
20 essential tools by default. Set `APS_PROFILE=full` for all
|
|
126
|
+
20 essential tools by default. Set `APS_PROFILE=full` for all 142 tools. Profiles: essential, identity, governance, coordination, commerce, data, gateway, comms, minimal, full.
|
|
127
127
|
|
|
128
128
|
## Numbers
|
|
129
129
|
|
|
130
|
-
2,
|
|
130
|
+
2,326 tests. 8 protocol layers. 11 framework adapters. Gateway evaluation under 2ms. Zero heavy dependencies. Apache-2.0.
|
|
131
131
|
|
|
132
132
|
## Papers
|
|
133
133
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The envelope claimed a feature activation that differs from replay by
|
|
3
|
+
* more than `epsilon_applied`.
|
|
4
|
+
*/
|
|
5
|
+
export interface ThresholdDispute {
|
|
6
|
+
kind: 'threshold';
|
|
7
|
+
feature_id: number;
|
|
8
|
+
attested_value: number;
|
|
9
|
+
claimed_value: number;
|
|
10
|
+
delta: number;
|
|
11
|
+
epsilon_applied: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A feature active in replay was not present in the envelope's reported
|
|
15
|
+
* activations. Reason distinguishes the aggregation-policy mechanism that
|
|
16
|
+
* excluded it.
|
|
17
|
+
*/
|
|
18
|
+
export interface ExclusionDispute {
|
|
19
|
+
kind: 'exclusion';
|
|
20
|
+
feature_id: number;
|
|
21
|
+
claimed_activation: number;
|
|
22
|
+
reason: 'missing_from_top_k' | 'below_threshold' | 'allowlist_violation';
|
|
23
|
+
}
|
|
24
|
+
export type ComputationalDispute = ThresholdDispute | ExclusionDispute;
|
|
25
|
+
/**
|
|
26
|
+
* Claim that the dictionary's feature decomposition is inadequate to
|
|
27
|
+
* describe the attested behavior. Resolved by governance, not math.
|
|
28
|
+
*/
|
|
29
|
+
export interface DecompositionAdequacyDispute {
|
|
30
|
+
kind: 'decomposition_adequacy';
|
|
31
|
+
claim: string;
|
|
32
|
+
/** IPFS CIDs, Zenodo DOIs, gateway artifact IDs, etc. SDK does not interpret. */
|
|
33
|
+
evidence_refs: string[];
|
|
34
|
+
annotator_did: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Claim that a feature's conventional label misrepresents the concept it
|
|
38
|
+
* detects in the attested context. Resolved by governance annotation.
|
|
39
|
+
*/
|
|
40
|
+
export interface FacetedReinterpretationDispute {
|
|
41
|
+
kind: 'faceted_reinterpretation';
|
|
42
|
+
feature_id: number;
|
|
43
|
+
original_label: string | null;
|
|
44
|
+
proposed_reinterpretation: string;
|
|
45
|
+
evidence_refs: string[];
|
|
46
|
+
annotator_did: string;
|
|
47
|
+
}
|
|
48
|
+
export type InterpretiveDispute = DecompositionAdequacyDispute | FacetedReinterpretationDispute;
|
|
49
|
+
export type Dispute = ComputationalDispute | InterpretiveDispute;
|
|
50
|
+
//# sourceMappingURL=disputes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disputes.d.ts","sourceRoot":"","sources":["../../../../src/v2/cognitive-attestation/disputes.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,WAAW,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,eAAe,EAAE,MAAM,CAAA;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,WAAW,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,MAAM,EAAE,oBAAoB,GAAG,iBAAiB,GAAG,qBAAqB,CAAA;CACzE;AAED,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG,gBAAgB,CAAA;AAMtE;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,wBAAwB,CAAA;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,iFAAiF;IACjF,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,0BAA0B,CAAA;IAChC,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,yBAAyB,EAAE,MAAM,CAAA;IACjC,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,MAAM,mBAAmB,GAC3B,4BAA4B,GAC5B,8BAA8B,CAAA;AAElC,MAAM,MAAM,OAAO,GAAG,oBAAoB,GAAG,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright 2024-2026 Tymofii Pidlisnyi. Apache-2.0 license. See LICENSE.
|
|
2
|
+
// ══════════════════════════════════════════════════════════════════
|
|
3
|
+
// Cognitive Attestation — dispute primitives (typed shapes only)
|
|
4
|
+
// ══════════════════════════════════════════════════════════════════
|
|
5
|
+
// Paper: "Cognitive Attestation" — Zenodo DOI 10.5281/zenodo.19646276, §5
|
|
6
|
+
//
|
|
7
|
+
// The SDK ships the dispute VOCABULARY, not the workflow. Dispute
|
|
8
|
+
// submission, resolution, scheduling, rate-limiting, and governance
|
|
9
|
+
// annotations are product intelligence and live in the private gateway.
|
|
10
|
+
// ══════════════════════════════════════════════════════════════════
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=disputes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disputes.js","sourceRoot":"","sources":["../../../../src/v2/cognitive-attestation/disputes.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qEAAqE;AACrE,iEAAiE;AACjE,qEAAqE;AACrE,0EAA0E;AAC1E,EAAE;AACF,kEAAkE;AAClE,oEAAoE;AACpE,wEAAwE;AACxE,qEAAqE"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { CognitiveAttestation, BuildAttestationInput, FeatureActivation, SignerRole } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Sort feature_activations canonically. Per schema: sort by
|
|
4
|
+
* (feature_id ascending, activation_statistic alphabetically).
|
|
5
|
+
* Returns a new array; does not mutate input.
|
|
6
|
+
*/
|
|
7
|
+
export declare function sortFeatureActivations(acts: FeatureActivation[]): FeatureActivation[];
|
|
8
|
+
/**
|
|
9
|
+
* Construct an unsigned cognitive attestation. The returned object has
|
|
10
|
+
* `signatures: []` and canonically-sorted `feature_activations`. Callers
|
|
11
|
+
* sign it via `signAttestation`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildAttestation(input: BuildAttestationInput): CognitiveAttestation;
|
|
14
|
+
/**
|
|
15
|
+
* JCS-canonicalize the attestation for signing. Signatures are elided
|
|
16
|
+
* (`signatures: []`) so all signers over the same payload produce the
|
|
17
|
+
* same input bytes regardless of signing order.
|
|
18
|
+
*
|
|
19
|
+
* Returns UTF-8 bytes. To obtain the canonical string, decode with TextDecoder.
|
|
20
|
+
*/
|
|
21
|
+
export declare function canonicalizeAttestation(att: CognitiveAttestation): Uint8Array;
|
|
22
|
+
/**
|
|
23
|
+
* Sign an attestation with a 32-byte Ed25519 seed. Appends a new entry to
|
|
24
|
+
* `signatures`. Returns a new object; never mutates input.
|
|
25
|
+
*
|
|
26
|
+
* The signature covers `canonicalizeAttestation(att)`, i.e. the envelope
|
|
27
|
+
* with `signatures: []`. Additional signers produce byte-identical canonical
|
|
28
|
+
* input, so the signing order does not affect any individual signature.
|
|
29
|
+
*/
|
|
30
|
+
export declare function signAttestation(att: CognitiveAttestation, privateKey: Uint8Array, signerDid: string, signerRole: SignerRole): CognitiveAttestation;
|
|
31
|
+
/**
|
|
32
|
+
* Cross-primitive anchor. Returns lowercase hex sha256 of the full signed
|
|
33
|
+
* envelope (including signatures) under JCS. Use this when an APS action
|
|
34
|
+
* receipt needs to reference a cognitive attestation by content hash.
|
|
35
|
+
*
|
|
36
|
+
* Matches the hashing pattern of other v2 primitives (wallet-binding digest,
|
|
37
|
+
* attribution-primitive canonical hash).
|
|
38
|
+
*/
|
|
39
|
+
export declare function cognitiveAttestationDigest(att: CognitiveAttestation): string;
|
|
40
|
+
export declare function validateAttestationShape(att: unknown): {
|
|
41
|
+
ok: boolean;
|
|
42
|
+
errors: string[];
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=envelope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../../../src/v2/cognitive-attestation/envelope.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,UAAU,EACX,MAAM,YAAY,CAAA;AAcnB;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,iBAAiB,EAAE,GAAG,iBAAiB,EAAE,CAOrF;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,oBAAoB,CAuCnF;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,oBAAoB,GAAG,UAAU,CAQ7E;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,oBAAoB,EACzB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,UAAU,GACrB,oBAAoB,CAsBtB;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,oBAAoB,GAAG,MAAM,CAO5E;AAkCD,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAsJxF"}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
// Copyright 2024-2026 Tymofii Pidlisnyi. Apache-2.0 license. See LICENSE.
|
|
2
|
+
// ══════════════════════════════════════════════════════════════════
|
|
3
|
+
// Cognitive Attestation — envelope construction, JCS, signing, digest
|
|
4
|
+
// ══════════════════════════════════════════════════════════════════
|
|
5
|
+
// Paper: "Cognitive Attestation" — Zenodo DOI 10.5281/zenodo.19646276
|
|
6
|
+
// Normative schema: papers/paper-4/poc/schema/cognitive_attestation.schema.json
|
|
7
|
+
//
|
|
8
|
+
// Wire compatibility with the Python reference impl at
|
|
9
|
+
// papers/paper-4/poc/src/envelope.py is preserved via:
|
|
10
|
+
// - canonicalizeJCS (RFC 8785, nulls preserved)
|
|
11
|
+
// - base64 signatures
|
|
12
|
+
// - feature_activations sorted by (feature_id, activation_statistic)
|
|
13
|
+
// ══════════════════════════════════════════════════════════════════
|
|
14
|
+
import { createHash } from 'node:crypto';
|
|
15
|
+
import { canonicalizeJCS } from '../../core/canonical-jcs.js';
|
|
16
|
+
import { sign as edSignHex } from '../../crypto/keys.js';
|
|
17
|
+
const SPEC_VERSION = '1.0';
|
|
18
|
+
function bytesToHex(bytes) {
|
|
19
|
+
let out = '';
|
|
20
|
+
for (let i = 0; i < bytes.length; i++)
|
|
21
|
+
out += bytes[i].toString(16).padStart(2, '0');
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
function hexToBase64(hex) {
|
|
25
|
+
return Buffer.from(hex, 'hex').toString('base64');
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Sort feature_activations canonically. Per schema: sort by
|
|
29
|
+
* (feature_id ascending, activation_statistic alphabetically).
|
|
30
|
+
* Returns a new array; does not mutate input.
|
|
31
|
+
*/
|
|
32
|
+
export function sortFeatureActivations(acts) {
|
|
33
|
+
return acts.slice().sort((a, b) => {
|
|
34
|
+
if (a.feature_id !== b.feature_id)
|
|
35
|
+
return a.feature_id - b.feature_id;
|
|
36
|
+
if (a.activation_statistic < b.activation_statistic)
|
|
37
|
+
return -1;
|
|
38
|
+
if (a.activation_statistic > b.activation_statistic)
|
|
39
|
+
return 1;
|
|
40
|
+
return 0;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Construct an unsigned cognitive attestation. The returned object has
|
|
45
|
+
* `signatures: []` and canonically-sorted `feature_activations`. Callers
|
|
46
|
+
* sign it via `signAttestation`.
|
|
47
|
+
*/
|
|
48
|
+
export function buildAttestation(input) {
|
|
49
|
+
const timestamp = input.timestamp ?? new Date().toISOString();
|
|
50
|
+
return {
|
|
51
|
+
spec_version: SPEC_VERSION,
|
|
52
|
+
model_ref: {
|
|
53
|
+
model_id: input.model_id,
|
|
54
|
+
model_version_hash: input.model_version_hash,
|
|
55
|
+
tokenizer_version_hash: input.tokenizer_version_hash,
|
|
56
|
+
inference_provider: input.inference_provider,
|
|
57
|
+
execution_environment: {
|
|
58
|
+
hardware_family: input.hardware_family,
|
|
59
|
+
precision: input.precision,
|
|
60
|
+
inference_engine: input.inference_engine,
|
|
61
|
+
deterministic_mode: input.deterministic_mode,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
dictionary_ref: {
|
|
65
|
+
dictionary_id: input.dictionary_id,
|
|
66
|
+
dictionary_version_hash: input.dictionary_version_hash,
|
|
67
|
+
training_corpus_hash: input.training_corpus_hash,
|
|
68
|
+
layer_index: input.layer_index,
|
|
69
|
+
attachment_point: input.attachment_point,
|
|
70
|
+
sae_type: input.sae_type,
|
|
71
|
+
},
|
|
72
|
+
token_range: {
|
|
73
|
+
absolute_sequence_hash: input.absolute_sequence_hash,
|
|
74
|
+
prior_state_hash: input.prior_state_hash,
|
|
75
|
+
start_token_index: input.start_token_index,
|
|
76
|
+
end_token_index: input.end_token_index,
|
|
77
|
+
token_count: input.token_count,
|
|
78
|
+
},
|
|
79
|
+
feature_activations: sortFeatureActivations(input.feature_activations),
|
|
80
|
+
aggregation_policy: {
|
|
81
|
+
...input.aggregation_policy,
|
|
82
|
+
required_signer_roles: input.aggregation_policy.required_signer_roles.slice(),
|
|
83
|
+
},
|
|
84
|
+
signatures: [],
|
|
85
|
+
attestation_timestamp: timestamp,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* JCS-canonicalize the attestation for signing. Signatures are elided
|
|
90
|
+
* (`signatures: []`) so all signers over the same payload produce the
|
|
91
|
+
* same input bytes regardless of signing order.
|
|
92
|
+
*
|
|
93
|
+
* Returns UTF-8 bytes. To obtain the canonical string, decode with TextDecoder.
|
|
94
|
+
*/
|
|
95
|
+
export function canonicalizeAttestation(att) {
|
|
96
|
+
const view = {
|
|
97
|
+
...att,
|
|
98
|
+
feature_activations: sortFeatureActivations(att.feature_activations),
|
|
99
|
+
signatures: [],
|
|
100
|
+
};
|
|
101
|
+
const s = canonicalizeJCS(view);
|
|
102
|
+
return new TextEncoder().encode(s);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Sign an attestation with a 32-byte Ed25519 seed. Appends a new entry to
|
|
106
|
+
* `signatures`. Returns a new object; never mutates input.
|
|
107
|
+
*
|
|
108
|
+
* The signature covers `canonicalizeAttestation(att)`, i.e. the envelope
|
|
109
|
+
* with `signatures: []`. Additional signers produce byte-identical canonical
|
|
110
|
+
* input, so the signing order does not affect any individual signature.
|
|
111
|
+
*/
|
|
112
|
+
export function signAttestation(att, privateKey, signerDid, signerRole) {
|
|
113
|
+
if (!(privateKey instanceof Uint8Array) || privateKey.length !== 32) {
|
|
114
|
+
throw new Error('signAttestation: privateKey must be a 32-byte Uint8Array (Ed25519 seed)');
|
|
115
|
+
}
|
|
116
|
+
if (typeof signerDid !== 'string' || signerDid.length === 0) {
|
|
117
|
+
throw new Error('signAttestation: signerDid must be a non-empty string');
|
|
118
|
+
}
|
|
119
|
+
const canonicalBytes = canonicalizeAttestation(att);
|
|
120
|
+
const canonicalString = new TextDecoder().decode(canonicalBytes);
|
|
121
|
+
const privateKeyHex = bytesToHex(privateKey);
|
|
122
|
+
const sigHex = edSignHex(canonicalString, privateKeyHex);
|
|
123
|
+
const sigB64 = hexToBase64(sigHex);
|
|
124
|
+
return {
|
|
125
|
+
...att,
|
|
126
|
+
feature_activations: sortFeatureActivations(att.feature_activations),
|
|
127
|
+
signatures: [
|
|
128
|
+
...att.signatures,
|
|
129
|
+
{ signer_did: signerDid, signer_role: signerRole, signature: sigB64 },
|
|
130
|
+
],
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Cross-primitive anchor. Returns lowercase hex sha256 of the full signed
|
|
135
|
+
* envelope (including signatures) under JCS. Use this when an APS action
|
|
136
|
+
* receipt needs to reference a cognitive attestation by content hash.
|
|
137
|
+
*
|
|
138
|
+
* Matches the hashing pattern of other v2 primitives (wallet-binding digest,
|
|
139
|
+
* attribution-primitive canonical hash).
|
|
140
|
+
*/
|
|
141
|
+
export function cognitiveAttestationDigest(att) {
|
|
142
|
+
const withSortedFeatures = {
|
|
143
|
+
...att,
|
|
144
|
+
feature_activations: sortFeatureActivations(att.feature_activations),
|
|
145
|
+
};
|
|
146
|
+
const canonical = canonicalizeJCS(withSortedFeatures);
|
|
147
|
+
return createHash('sha256').update(canonical, 'utf-8').digest('hex');
|
|
148
|
+
}
|
|
149
|
+
// ──────────────────────────────────────────────────────────────────
|
|
150
|
+
// Shape validation — hand-rolled check of the normative JSON schema.
|
|
151
|
+
// No new runtime deps. The schema file is the source of truth; this
|
|
152
|
+
// function mirrors its required fields, enums, and patterns.
|
|
153
|
+
// ──────────────────────────────────────────────────────────────────
|
|
154
|
+
const HEX64 = /^[0-9a-f]{64}$/;
|
|
155
|
+
const PRECISIONS = new Set(['fp32', 'fp16', 'bf16', 'int8']);
|
|
156
|
+
const ATTACHMENT_POINTS = new Set(['residual_stream', 'attention_output', 'mlp_output']);
|
|
157
|
+
const SAE_TYPES = new Set(['standard', 'topk', 'jumprelu', 'gated', 'batchtopk']);
|
|
158
|
+
const STATS = new Set(['max', 'mean', 'sum', 'integral', 'last']);
|
|
159
|
+
const COMPLETENESS = new Set(['top_k_only', 'all_above_threshold', 'dictionary_exhaustive']);
|
|
160
|
+
const TIEBREAKERS = new Set(['lowest_feature_id', 'highest_feature_id']);
|
|
161
|
+
const ROLES = new Set(['agent', 'operator', 'provider', 'third_party_attester']);
|
|
162
|
+
function isObject(v) {
|
|
163
|
+
return typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
164
|
+
}
|
|
165
|
+
function isInt(v) {
|
|
166
|
+
return typeof v === 'number' && Number.isInteger(v);
|
|
167
|
+
}
|
|
168
|
+
function checkHex64(errs, path, v) {
|
|
169
|
+
if (typeof v !== 'string' || !HEX64.test(v))
|
|
170
|
+
errs.push(`${path}: expected 64-char lowercase hex`);
|
|
171
|
+
}
|
|
172
|
+
function checkHex64Nullable(errs, path, v) {
|
|
173
|
+
if (v === null)
|
|
174
|
+
return;
|
|
175
|
+
checkHex64(errs, path, v);
|
|
176
|
+
}
|
|
177
|
+
export function validateAttestationShape(att) {
|
|
178
|
+
const errors = [];
|
|
179
|
+
if (!isObject(att))
|
|
180
|
+
return { ok: false, errors: ['root: expected object'] };
|
|
181
|
+
if (att.spec_version !== '1.0')
|
|
182
|
+
errors.push('spec_version: must be "1.0"');
|
|
183
|
+
// model_ref
|
|
184
|
+
const m = att.model_ref;
|
|
185
|
+
if (!isObject(m)) {
|
|
186
|
+
errors.push('model_ref: expected object');
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
if (typeof m.model_id !== 'string')
|
|
190
|
+
errors.push('model_ref.model_id: expected string');
|
|
191
|
+
checkHex64(errors, 'model_ref.model_version_hash', m.model_version_hash);
|
|
192
|
+
checkHex64(errors, 'model_ref.tokenizer_version_hash', m.tokenizer_version_hash);
|
|
193
|
+
if (m.inference_provider !== null && typeof m.inference_provider !== 'string') {
|
|
194
|
+
errors.push('model_ref.inference_provider: expected string|null');
|
|
195
|
+
}
|
|
196
|
+
const ee = m.execution_environment;
|
|
197
|
+
if (!isObject(ee)) {
|
|
198
|
+
errors.push('model_ref.execution_environment: expected object');
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
if (typeof ee.hardware_family !== 'string')
|
|
202
|
+
errors.push('execution_environment.hardware_family: expected string');
|
|
203
|
+
if (typeof ee.precision !== 'string' || !PRECISIONS.has(ee.precision)) {
|
|
204
|
+
errors.push('execution_environment.precision: must be fp32|fp16|bf16|int8');
|
|
205
|
+
}
|
|
206
|
+
if (typeof ee.inference_engine !== 'string')
|
|
207
|
+
errors.push('execution_environment.inference_engine: expected string');
|
|
208
|
+
if (typeof ee.deterministic_mode !== 'boolean')
|
|
209
|
+
errors.push('execution_environment.deterministic_mode: expected boolean');
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
// dictionary_ref
|
|
213
|
+
const d = att.dictionary_ref;
|
|
214
|
+
if (!isObject(d)) {
|
|
215
|
+
errors.push('dictionary_ref: expected object');
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
if (typeof d.dictionary_id !== 'string')
|
|
219
|
+
errors.push('dictionary_ref.dictionary_id: expected string');
|
|
220
|
+
checkHex64(errors, 'dictionary_ref.dictionary_version_hash', d.dictionary_version_hash);
|
|
221
|
+
checkHex64Nullable(errors, 'dictionary_ref.training_corpus_hash', d.training_corpus_hash);
|
|
222
|
+
if (!isInt(d.layer_index) || d.layer_index < 0) {
|
|
223
|
+
errors.push('dictionary_ref.layer_index: expected non-negative integer');
|
|
224
|
+
}
|
|
225
|
+
if (typeof d.attachment_point !== 'string' || !ATTACHMENT_POINTS.has(d.attachment_point)) {
|
|
226
|
+
errors.push('dictionary_ref.attachment_point: must be residual_stream|attention_output|mlp_output');
|
|
227
|
+
}
|
|
228
|
+
if (typeof d.sae_type !== 'string' || !SAE_TYPES.has(d.sae_type)) {
|
|
229
|
+
errors.push('dictionary_ref.sae_type: must be standard|topk|jumprelu|gated|batchtopk');
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// token_range
|
|
233
|
+
const tr = att.token_range;
|
|
234
|
+
if (!isObject(tr)) {
|
|
235
|
+
errors.push('token_range: expected object');
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
checkHex64(errors, 'token_range.absolute_sequence_hash', tr.absolute_sequence_hash);
|
|
239
|
+
checkHex64Nullable(errors, 'token_range.prior_state_hash', tr.prior_state_hash);
|
|
240
|
+
if (!isInt(tr.start_token_index) || tr.start_token_index < 0) {
|
|
241
|
+
errors.push('token_range.start_token_index: expected non-negative integer');
|
|
242
|
+
}
|
|
243
|
+
if (!isInt(tr.end_token_index) || tr.end_token_index < 0) {
|
|
244
|
+
errors.push('token_range.end_token_index: expected non-negative integer');
|
|
245
|
+
}
|
|
246
|
+
if (!isInt(tr.token_count) || tr.token_count < 1) {
|
|
247
|
+
errors.push('token_range.token_count: expected integer >= 1');
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
// feature_activations
|
|
251
|
+
if (!Array.isArray(att.feature_activations)) {
|
|
252
|
+
errors.push('feature_activations: expected array');
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
att.feature_activations.forEach((fa, i) => {
|
|
256
|
+
if (!isObject(fa)) {
|
|
257
|
+
errors.push(`feature_activations[${i}]: expected object`);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (!isInt(fa.feature_id) || fa.feature_id < 0) {
|
|
261
|
+
errors.push(`feature_activations[${i}].feature_id: expected non-negative integer`);
|
|
262
|
+
}
|
|
263
|
+
if (fa.feature_label !== null && typeof fa.feature_label !== 'string') {
|
|
264
|
+
errors.push(`feature_activations[${i}].feature_label: expected string|null`);
|
|
265
|
+
}
|
|
266
|
+
if (typeof fa.activation_statistic !== 'string' || !STATS.has(fa.activation_statistic)) {
|
|
267
|
+
errors.push(`feature_activations[${i}].activation_statistic: must be max|mean|sum|integral|last`);
|
|
268
|
+
}
|
|
269
|
+
if (typeof fa.activation_value !== 'number' || fa.activation_value < 0) {
|
|
270
|
+
errors.push(`feature_activations[${i}].activation_value: expected number >= 0`);
|
|
271
|
+
}
|
|
272
|
+
if (!isInt(fa.tokens_active) || fa.tokens_active < 0) {
|
|
273
|
+
errors.push(`feature_activations[${i}].tokens_active: expected non-negative integer`);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
// aggregation_policy
|
|
278
|
+
const ap = att.aggregation_policy;
|
|
279
|
+
if (!isObject(ap)) {
|
|
280
|
+
errors.push('aggregation_policy: expected object');
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
if (ap.top_k !== null && (!isInt(ap.top_k) || ap.top_k < 1)) {
|
|
284
|
+
errors.push('aggregation_policy.top_k: expected integer >= 1 or null');
|
|
285
|
+
}
|
|
286
|
+
if (ap.threshold !== null && (typeof ap.threshold !== 'number' || ap.threshold < 0)) {
|
|
287
|
+
errors.push('aggregation_policy.threshold: expected number >= 0 or null');
|
|
288
|
+
}
|
|
289
|
+
if (typeof ap.attestation_epsilon !== 'number' || ap.attestation_epsilon <= 0) {
|
|
290
|
+
errors.push('aggregation_policy.attestation_epsilon: required, must be number > 0');
|
|
291
|
+
}
|
|
292
|
+
checkHex64Nullable(errors, 'aggregation_policy.feature_allowlist_hash', ap.feature_allowlist_hash);
|
|
293
|
+
if (typeof ap.completeness_claim !== 'string' || !COMPLETENESS.has(ap.completeness_claim)) {
|
|
294
|
+
errors.push('aggregation_policy.completeness_claim: must be top_k_only|all_above_threshold|dictionary_exhaustive');
|
|
295
|
+
}
|
|
296
|
+
if (typeof ap.tiebreaker_rule !== 'string' || !TIEBREAKERS.has(ap.tiebreaker_rule)) {
|
|
297
|
+
errors.push('aggregation_policy.tiebreaker_rule: must be lowest_feature_id|highest_feature_id');
|
|
298
|
+
}
|
|
299
|
+
if (!Array.isArray(ap.required_signer_roles) || ap.required_signer_roles.length === 0) {
|
|
300
|
+
errors.push('aggregation_policy.required_signer_roles: required, non-empty array');
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
const seen = new Set();
|
|
304
|
+
ap.required_signer_roles.forEach((r, i) => {
|
|
305
|
+
if (typeof r !== 'string' || !ROLES.has(r)) {
|
|
306
|
+
errors.push(`aggregation_policy.required_signer_roles[${i}]: must be agent|operator|provider|third_party_attester`);
|
|
307
|
+
}
|
|
308
|
+
if (seen.has(r))
|
|
309
|
+
errors.push(`aggregation_policy.required_signer_roles: duplicate "${r}"`);
|
|
310
|
+
seen.add(r);
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
// signatures
|
|
315
|
+
if (!Array.isArray(att.signatures) || att.signatures.length < 1) {
|
|
316
|
+
errors.push('signatures: expected non-empty array');
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
att.signatures.forEach((s, i) => {
|
|
320
|
+
if (!isObject(s)) {
|
|
321
|
+
errors.push(`signatures[${i}]: expected object`);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
if (typeof s.signer_did !== 'string' || s.signer_did.length === 0) {
|
|
325
|
+
errors.push(`signatures[${i}].signer_did: expected non-empty string`);
|
|
326
|
+
}
|
|
327
|
+
if (typeof s.signer_role !== 'string' || !ROLES.has(s.signer_role)) {
|
|
328
|
+
errors.push(`signatures[${i}].signer_role: must be agent|operator|provider|third_party_attester`);
|
|
329
|
+
}
|
|
330
|
+
if (typeof s.signature !== 'string' || s.signature.length === 0) {
|
|
331
|
+
errors.push(`signatures[${i}].signature: expected non-empty base64 string`);
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
// attestation_timestamp
|
|
336
|
+
if (typeof att.attestation_timestamp !== 'string' || Number.isNaN(Date.parse(att.attestation_timestamp))) {
|
|
337
|
+
errors.push('attestation_timestamp: expected ISO 8601 date-time string');
|
|
338
|
+
}
|
|
339
|
+
return { ok: errors.length === 0, errors };
|
|
340
|
+
}
|
|
341
|
+
//# sourceMappingURL=envelope.js.map
|
|
@@ -0,0 +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AQ,IAAI,CAAC,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAChE,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,+CAA+C,CAAC,CAAA;YAC7E,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,wBAAwB;IACxB,IAAI,OAAO,GAAG,CAAC,qBAAqB,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,EAAE,CAAC;QACzG,MAAM,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAA;IAC1E,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;AAC5C,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { CognitiveAttestation, ModelRef, DictionaryRef, TokenRange, FeatureActivation, AggregationPolicy, Signature, SignerRole, ExecutionEnvironment, Precision, AttachmentPoint, SAEType, ActivationStatistic, CompletenessClaim, TiebreakerRule, BuildAttestationInput, } from './types.js';
|
|
2
|
+
export { buildAttestation, canonicalizeAttestation, signAttestation, cognitiveAttestationDigest, sortFeatureActivations, validateAttestationShape, } from './envelope.js';
|
|
3
|
+
export { verifySignature, verifyRequiredSignerRoles, verifyAgainstRegistry, verifyByReplay, } from './verify.js';
|
|
4
|
+
export type { RequiredRoleCoverage, RegistryResolver, RegistryVerificationResult, ReplayBackend, ReplayVerificationResult, } from './verify.js';
|
|
5
|
+
export type { ThresholdDispute, ExclusionDispute, ComputationalDispute, DecompositionAdequacyDispute, FacetedReinterpretationDispute, InterpretiveDispute, Dispute, } from './disputes.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/cognitive-attestation/index.ts"],"names":[],"mappings":"AAqBA,YAAY,EACV,oBAAoB,EACpB,QAAQ,EACR,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,oBAAoB,EACpB,SAAS,EACT,eAAe,EACf,OAAO,EACP,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,GACtB,MAAM,YAAY,CAAA;AAEnB,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,eAAe,CAAA;AAGtB,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,qBAAqB,EACrB,cAAc,GACf,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,0BAA0B,EAC1B,aAAa,EACb,wBAAwB,GACzB,MAAM,aAAa,CAAA;AAGpB,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,4BAA4B,EAC5B,8BAA8B,EAC9B,mBAAmB,EACnB,OAAO,GACR,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright 2024-2026 Tymofii Pidlisnyi. Apache-2.0 license. See LICENSE.
|
|
2
|
+
// ══════════════════════════════════════════════════════════════════
|
|
3
|
+
// Cognitive Attestation — public surface
|
|
4
|
+
// ══════════════════════════════════════════════════════════════════
|
|
5
|
+
// Paper: "Cognitive Attestation — signed declarations of feature-level
|
|
6
|
+
// model computation for accountable AI"
|
|
7
|
+
// Zenodo DOI: 10.5281/zenodo.19646276
|
|
8
|
+
// Normative schema: papers/paper-4/poc/schema/cognitive_attestation.schema.json
|
|
9
|
+
//
|
|
10
|
+
// SDK scope: envelope construction, JCS canonicalization, Ed25519 signing,
|
|
11
|
+
// Stage 1 (cryptographic) verification, Stage 2 (registry)
|
|
12
|
+
// interface, Stage 3 (replay) stub, typed dispute primitives.
|
|
13
|
+
//
|
|
14
|
+
// Out of scope for the SDK: dispute resolution, re-verification scheduling,
|
|
15
|
+
// cross-tenant correlation, transparency-log
|
|
16
|
+
// publishing, bulk compliance reports. All of
|
|
17
|
+
// those are product intelligence and live in
|
|
18
|
+
// the private `@aeoess/gateway` module.
|
|
19
|
+
// ══════════════════════════════════════════════════════════════════
|
|
20
|
+
export { buildAttestation, canonicalizeAttestation, signAttestation, cognitiveAttestationDigest, sortFeatureActivations, validateAttestationShape, } from './envelope.js';
|
|
21
|
+
// Three-stage verification
|
|
22
|
+
export { verifySignature, verifyRequiredSignerRoles, verifyAgainstRegistry, verifyByReplay, } from './verify.js';
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/v2/cognitive-attestation/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qEAAqE;AACrE,yCAAyC;AACzC,qEAAqE;AACrE,uEAAuE;AACvE,+CAA+C;AAC/C,sCAAsC;AACtC,gFAAgF;AAChF,EAAE;AACF,2EAA2E;AAC3E,sEAAsE;AACtE,yEAAyE;AACzE,EAAE;AACF,4EAA4E;AAC5E,uEAAuE;AACvE,wEAAwE;AACxE,uEAAuE;AACvE,kEAAkE;AAClE,qEAAqE;AAsBrE,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,eAAe,CAAA;AAEtB,2BAA2B;AAC3B,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,qBAAqB,EACrB,cAAc,GACf,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export type Precision = 'fp32' | 'fp16' | 'bf16' | 'int8';
|
|
2
|
+
export type AttachmentPoint = 'residual_stream' | 'attention_output' | 'mlp_output';
|
|
3
|
+
export type SAEType = 'standard' | 'topk' | 'jumprelu' | 'gated' | 'batchtopk';
|
|
4
|
+
export type ActivationStatistic = 'max' | 'mean' | 'sum' | 'integral' | 'last';
|
|
5
|
+
export type CompletenessClaim = 'top_k_only' | 'all_above_threshold' | 'dictionary_exhaustive';
|
|
6
|
+
export type TiebreakerRule = 'lowest_feature_id' | 'highest_feature_id';
|
|
7
|
+
export type SignerRole = 'agent' | 'operator' | 'provider' | 'third_party_attester';
|
|
8
|
+
export interface ExecutionEnvironment {
|
|
9
|
+
/** e.g. `nvidia/hopper/h100-sxm5` or `apple-silicon/m-series/m3-max` */
|
|
10
|
+
hardware_family: string;
|
|
11
|
+
precision: Precision;
|
|
12
|
+
/** `library@version` format, e.g. `vllm@0.6.3`. */
|
|
13
|
+
inference_engine: string;
|
|
14
|
+
deterministic_mode: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface ModelRef {
|
|
17
|
+
model_id: string;
|
|
18
|
+
/** sha256 hex, 64 lowercase chars. */
|
|
19
|
+
model_version_hash: string;
|
|
20
|
+
/** sha256 hex, 64 lowercase chars. */
|
|
21
|
+
tokenizer_version_hash: string;
|
|
22
|
+
inference_provider: string | null;
|
|
23
|
+
execution_environment: ExecutionEnvironment;
|
|
24
|
+
}
|
|
25
|
+
export interface DictionaryRef {
|
|
26
|
+
dictionary_id: string;
|
|
27
|
+
/** sha256 hex, 64 lowercase chars. */
|
|
28
|
+
dictionary_version_hash: string;
|
|
29
|
+
/** sha256 hex, 64 lowercase chars, or null. */
|
|
30
|
+
training_corpus_hash: string | null;
|
|
31
|
+
layer_index: number;
|
|
32
|
+
attachment_point: AttachmentPoint;
|
|
33
|
+
sae_type: SAEType;
|
|
34
|
+
}
|
|
35
|
+
export interface TokenRange {
|
|
36
|
+
/** sha256 of uint32-big-endian token IDs from BOS through end-of-range, no separators. */
|
|
37
|
+
absolute_sequence_hash: string;
|
|
38
|
+
/** sha256 of tokens preceding the attested range, or null. NOT a KV-cache hash. */
|
|
39
|
+
prior_state_hash: string | null;
|
|
40
|
+
start_token_index: number;
|
|
41
|
+
end_token_index: number;
|
|
42
|
+
token_count: number;
|
|
43
|
+
}
|
|
44
|
+
export interface FeatureActivation {
|
|
45
|
+
feature_id: number;
|
|
46
|
+
feature_label: string | null;
|
|
47
|
+
activation_statistic: ActivationStatistic;
|
|
48
|
+
activation_value: number;
|
|
49
|
+
tokens_active: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Aggregation policy. Note: `attestation_epsilon` and `required_signer_roles`
|
|
53
|
+
* are REQUIRED per the normative schema. The Python reference's smoke test
|
|
54
|
+
* omitted them — this TS type makes that omission a compile error.
|
|
55
|
+
*/
|
|
56
|
+
export interface AggregationPolicy {
|
|
57
|
+
top_k: number | null;
|
|
58
|
+
threshold: number | null;
|
|
59
|
+
/** Governance-relevant "effectively zero" threshold. Must be > 0. */
|
|
60
|
+
attestation_epsilon: number;
|
|
61
|
+
/** sha256 hex of the allowlist, or null. */
|
|
62
|
+
feature_allowlist_hash: string | null;
|
|
63
|
+
completeness_claim: CompletenessClaim;
|
|
64
|
+
tiebreaker_rule: TiebreakerRule;
|
|
65
|
+
/** At least one role. Verifiers MUST confirm every listed role is signed by someone. */
|
|
66
|
+
required_signer_roles: SignerRole[];
|
|
67
|
+
}
|
|
68
|
+
export interface Signature {
|
|
69
|
+
signer_did: string;
|
|
70
|
+
signer_role: SignerRole;
|
|
71
|
+
/** base64-encoded Ed25519 signature over JCS-canonicalized payload with signatures=[] elided. */
|
|
72
|
+
signature: string;
|
|
73
|
+
}
|
|
74
|
+
export interface CognitiveAttestation {
|
|
75
|
+
spec_version: '1.0';
|
|
76
|
+
model_ref: ModelRef;
|
|
77
|
+
dictionary_ref: DictionaryRef;
|
|
78
|
+
token_range: TokenRange;
|
|
79
|
+
feature_activations: FeatureActivation[];
|
|
80
|
+
aggregation_policy: AggregationPolicy;
|
|
81
|
+
signatures: Signature[];
|
|
82
|
+
/** ISO 8601 UTC timestamp. */
|
|
83
|
+
attestation_timestamp: string;
|
|
84
|
+
}
|
|
85
|
+
/** Input to `buildAttestation`. Flat shape matches the Python reference. */
|
|
86
|
+
export interface BuildAttestationInput {
|
|
87
|
+
model_id: string;
|
|
88
|
+
model_version_hash: string;
|
|
89
|
+
tokenizer_version_hash: string;
|
|
90
|
+
inference_provider: string | null;
|
|
91
|
+
hardware_family: string;
|
|
92
|
+
precision: Precision;
|
|
93
|
+
inference_engine: string;
|
|
94
|
+
deterministic_mode: boolean;
|
|
95
|
+
dictionary_id: string;
|
|
96
|
+
dictionary_version_hash: string;
|
|
97
|
+
training_corpus_hash: string | null;
|
|
98
|
+
layer_index: number;
|
|
99
|
+
attachment_point: AttachmentPoint;
|
|
100
|
+
sae_type: SAEType;
|
|
101
|
+
absolute_sequence_hash: string;
|
|
102
|
+
prior_state_hash: string | null;
|
|
103
|
+
start_token_index: number;
|
|
104
|
+
end_token_index: number;
|
|
105
|
+
token_count: number;
|
|
106
|
+
feature_activations: FeatureActivation[];
|
|
107
|
+
aggregation_policy: AggregationPolicy;
|
|
108
|
+
/** Override for deterministic fixtures. Defaults to `new Date().toISOString()`. */
|
|
109
|
+
timestamp?: string;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/v2/cognitive-attestation/types.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;AAEzD,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,YAAY,CAAA;AAEnF,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,WAAW,CAAA;AAE9E,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,UAAU,GAAG,MAAM,CAAA;AAE9E,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG,qBAAqB,GAAG,uBAAuB,CAAA;AAE9F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M,GAAG,IAAI,CAAA;IACnC,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,eAAe,CAAA;IACjC,QAAQ,EAAE,OAAO,CAAA;IAEjB,sBAAsB,EAAE,MAAM,CAAA;IAC9B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,iBAAiB,EAAE,MAAM,CAAA;IACzB,eAAe,EAAE,MAAM,CAAA;IACvB,WAAW,EAAE,MAAM,CAAA;IAEnB,mBAAmB,EAAE,iBAAiB,EAAE,CAAA;IACxC,kBAAkB,EAAE,iBAAiB,CAAA;IACrC,mFAAmF;IACnF,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright 2024-2026 Tymofii Pidlisnyi. Apache-2.0 license. See LICENSE.
|
|
2
|
+
// ══════════════════════════════════════════════════════════════════
|
|
3
|
+
// Cognitive Attestation — TypeScript types mirroring the normative schema
|
|
4
|
+
// ══════════════════════════════════════════════════════════════════
|
|
5
|
+
// Source of truth: papers/paper-4/poc/schema/cognitive_attestation.schema.json
|
|
6
|
+
// Paper: "Cognitive Attestation" — Zenodo DOI 10.5281/zenodo.19646276
|
|
7
|
+
//
|
|
8
|
+
// Every nullable field in the JSON schema is expressed as `T | null` here so
|
|
9
|
+
// that JCS canonicalization preserves null (RFC 8785 requirement, and the
|
|
10
|
+
// cross-language compatibility contract with the Python reference impl).
|
|
11
|
+
// ══════════════════════════════════════════════════════════════════
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/v2/cognitive-attestation/types.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qEAAqE;AACrE,0EAA0E;AAC1E,qEAAqE;AACrE,+EAA+E;AAC/E,sEAAsE;AACtE,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,yEAAyE;AACzE,qEAAqE"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { CognitiveAttestation, SignerRole } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Verify that at least one signature entry for `signerDid` validates against
|
|
4
|
+
* `publicKey`. Returns false on tamper, wrong DID, malformed signature, or
|
|
5
|
+
* key mismatch.
|
|
6
|
+
*/
|
|
7
|
+
export declare function verifySignature(att: CognitiveAttestation, publicKey: Uint8Array, signerDid: string): boolean;
|
|
8
|
+
export interface RequiredRoleCoverage {
|
|
9
|
+
ok: boolean;
|
|
10
|
+
missing: SignerRole[];
|
|
11
|
+
present: SignerRole[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Confirm every role in `aggregation_policy.required_signer_roles` is
|
|
15
|
+
* represented by at least one signature entry with that role. Structural
|
|
16
|
+
* check only — does NOT verify signature cryptographically. Callers should
|
|
17
|
+
* pair this with `verifySignature` per signer for full Stage 1.
|
|
18
|
+
*/
|
|
19
|
+
export declare function verifyRequiredSignerRoles(att: CognitiveAttestation): RequiredRoleCoverage;
|
|
20
|
+
export interface RegistryResolver {
|
|
21
|
+
/** Return true if the model_version_hash is known to the caller's model registry. */
|
|
22
|
+
isKnownModel(modelId: string, modelVersionHash: string): Promise<boolean>;
|
|
23
|
+
/** Return true if the dictionary_version_hash is known to the caller's SAE/feature-dict registry. */
|
|
24
|
+
isKnownDictionary(dictionaryId: string, dictionaryVersionHash: string): Promise<boolean>;
|
|
25
|
+
}
|
|
26
|
+
export interface RegistryVerificationResult {
|
|
27
|
+
ok: boolean;
|
|
28
|
+
model_known: boolean;
|
|
29
|
+
dictionary_known: boolean;
|
|
30
|
+
errors: string[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Stage 2. Checks that the referenced model and dictionary versions exist in
|
|
34
|
+
* the resolver's registry view. The SDK ships no registry client — integrators
|
|
35
|
+
* (or the private gateway) implement `RegistryResolver`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function verifyAgainstRegistry(att: CognitiveAttestation, registryResolver: RegistryResolver): Promise<RegistryVerificationResult>;
|
|
38
|
+
export interface ReplayBackend {
|
|
39
|
+
/**
|
|
40
|
+
* Replay the attested token range through the referenced model + SAE and
|
|
41
|
+
* compare feature activations against the envelope within the policy's
|
|
42
|
+
* attestation_epsilon. Implementations live outside the SDK.
|
|
43
|
+
*/
|
|
44
|
+
replay(att: CognitiveAttestation): Promise<ReplayVerificationResult>;
|
|
45
|
+
}
|
|
46
|
+
export interface ReplayVerificationResult {
|
|
47
|
+
ok: boolean;
|
|
48
|
+
/** Per-feature deltas keyed by feature_id. */
|
|
49
|
+
per_feature_delta: Record<number, number>;
|
|
50
|
+
/** Features whose |delta| exceeded aggregation_policy.attestation_epsilon. */
|
|
51
|
+
over_epsilon: number[];
|
|
52
|
+
/** Features claimed by the envelope but not observed during replay. */
|
|
53
|
+
missing_from_replay: number[];
|
|
54
|
+
/** Features observed above threshold during replay but absent from the envelope. */
|
|
55
|
+
unexpected_in_replay: number[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Stage 3. Requires an injected `ReplayBackend`. Running an SAE live is
|
|
59
|
+
* outside what a pure SDK primitive should bundle — use a private backend
|
|
60
|
+
* or the gateway's replay service.
|
|
61
|
+
*
|
|
62
|
+
* TODO: Once a reference replay backend exists (gateway-side, not SDK),
|
|
63
|
+
* document its contract here and ship test vectors covering
|
|
64
|
+
* threshold-delta, missing-feature, and unexpected-feature cases.
|
|
65
|
+
*/
|
|
66
|
+
export declare function verifyByReplay(att: CognitiveAttestation, replayer: ReplayBackend): Promise<ReplayVerificationResult>;
|
|
67
|
+
//# sourceMappingURL=verify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../../src/v2/cognitive-attestation/verify.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;A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BAAmB,EAAE,MAAM,EAAE,CAAA;IAC7B,oFAAoF;IACpF,oBAAoB,EAAE,MAAM,EAAE,CAAA;CAC/B;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,oBAAoB,EACzB,QAAQ,EAAE,aAAa,GACtB,OAAO,CAAC,wBAAwB,CAAC,CAQnC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// Copyright 2024-2026 Tymofii Pidlisnyi. Apache-2.0 license. See LICENSE.
|
|
2
|
+
// ══════════════════════════════════════════════════════════════════
|
|
3
|
+
// Cognitive Attestation — three-stage verification
|
|
4
|
+
// ══════════════════════════════════════════════════════════════════
|
|
5
|
+
// Paper: "Cognitive Attestation" — Zenodo DOI 10.5281/zenodo.19646276, §4
|
|
6
|
+
//
|
|
7
|
+
// Stage 1 (cryptographic): verifySignature + verifyRequiredSignerRoles — ships.
|
|
8
|
+
// Stage 2 (registry): verifyAgainstRegistry — interface + basic impl;
|
|
9
|
+
// concrete resolvers injected by integrators/gateway.
|
|
10
|
+
// Stage 3 (replay): verifyByReplay — typed shape only; the SDK does
|
|
11
|
+
// not bundle a running SAE. Throws "not implemented"
|
|
12
|
+
// until a ReplayBackend is wired.
|
|
13
|
+
// ══════════════════════════════════════════════════════════════════
|
|
14
|
+
import { verify as edVerifyHex } from '../../crypto/keys.js';
|
|
15
|
+
import { canonicalizeAttestation } from './envelope.js';
|
|
16
|
+
function bytesToHex(bytes) {
|
|
17
|
+
let out = '';
|
|
18
|
+
for (let i = 0; i < bytes.length; i++)
|
|
19
|
+
out += bytes[i].toString(16).padStart(2, '0');
|
|
20
|
+
return out;
|
|
21
|
+
}
|
|
22
|
+
function base64ToHex(b64) {
|
|
23
|
+
try {
|
|
24
|
+
return Buffer.from(b64, 'base64').toString('hex');
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// ──────────────────────────────────────────────────────────────────
|
|
31
|
+
// Stage 1a — cryptographic single-signer check.
|
|
32
|
+
// ──────────────────────────────────────────────────────────────────
|
|
33
|
+
/**
|
|
34
|
+
* Verify that at least one signature entry for `signerDid` validates against
|
|
35
|
+
* `publicKey`. Returns false on tamper, wrong DID, malformed signature, or
|
|
36
|
+
* key mismatch.
|
|
37
|
+
*/
|
|
38
|
+
export function verifySignature(att, publicKey, signerDid) {
|
|
39
|
+
if (!(publicKey instanceof Uint8Array) || publicKey.length !== 32)
|
|
40
|
+
return false;
|
|
41
|
+
const canonicalBytes = canonicalizeAttestation(att);
|
|
42
|
+
const canonicalString = new TextDecoder().decode(canonicalBytes);
|
|
43
|
+
const publicKeyHex = bytesToHex(publicKey);
|
|
44
|
+
const matches = att.signatures.filter((s) => s.signer_did === signerDid);
|
|
45
|
+
if (matches.length === 0)
|
|
46
|
+
return false;
|
|
47
|
+
for (const entry of matches) {
|
|
48
|
+
const sigHex = base64ToHex(entry.signature);
|
|
49
|
+
if (!sigHex)
|
|
50
|
+
continue;
|
|
51
|
+
if (edVerifyHex(canonicalString, sigHex, publicKeyHex))
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Confirm every role in `aggregation_policy.required_signer_roles` is
|
|
58
|
+
* represented by at least one signature entry with that role. Structural
|
|
59
|
+
* check only — does NOT verify signature cryptographically. Callers should
|
|
60
|
+
* pair this with `verifySignature` per signer for full Stage 1.
|
|
61
|
+
*/
|
|
62
|
+
export function verifyRequiredSignerRoles(att) {
|
|
63
|
+
const required = new Set(att.aggregation_policy.required_signer_roles);
|
|
64
|
+
const presentRoles = new Set(att.signatures.map((s) => s.signer_role));
|
|
65
|
+
const missing = [];
|
|
66
|
+
for (const role of required)
|
|
67
|
+
if (!presentRoles.has(role))
|
|
68
|
+
missing.push(role);
|
|
69
|
+
return {
|
|
70
|
+
ok: missing.length === 0,
|
|
71
|
+
missing,
|
|
72
|
+
present: Array.from(presentRoles),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Stage 2. Checks that the referenced model and dictionary versions exist in
|
|
77
|
+
* the resolver's registry view. The SDK ships no registry client — integrators
|
|
78
|
+
* (or the private gateway) implement `RegistryResolver`.
|
|
79
|
+
*/
|
|
80
|
+
export async function verifyAgainstRegistry(att, registryResolver) {
|
|
81
|
+
const errors = [];
|
|
82
|
+
let model_known = false;
|
|
83
|
+
let dictionary_known = false;
|
|
84
|
+
try {
|
|
85
|
+
model_known = await registryResolver.isKnownModel(att.model_ref.model_id, att.model_ref.model_version_hash);
|
|
86
|
+
if (!model_known) {
|
|
87
|
+
errors.push(`unknown model_version_hash for model_id="${att.model_ref.model_id}"`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
errors.push(`model resolver error: ${e instanceof Error ? e.message : String(e)}`);
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
dictionary_known = await registryResolver.isKnownDictionary(att.dictionary_ref.dictionary_id, att.dictionary_ref.dictionary_version_hash);
|
|
95
|
+
if (!dictionary_known) {
|
|
96
|
+
errors.push(`unknown dictionary_version_hash for dictionary_id="${att.dictionary_ref.dictionary_id}"`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
errors.push(`dictionary resolver error: ${e instanceof Error ? e.message : String(e)}`);
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
ok: errors.length === 0 && model_known && dictionary_known,
|
|
104
|
+
model_known,
|
|
105
|
+
dictionary_known,
|
|
106
|
+
errors,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Stage 3. Requires an injected `ReplayBackend`. Running an SAE live is
|
|
111
|
+
* outside what a pure SDK primitive should bundle — use a private backend
|
|
112
|
+
* or the gateway's replay service.
|
|
113
|
+
*
|
|
114
|
+
* TODO: Once a reference replay backend exists (gateway-side, not SDK),
|
|
115
|
+
* document its contract here and ship test vectors covering
|
|
116
|
+
* threshold-delta, missing-feature, and unexpected-feature cases.
|
|
117
|
+
*/
|
|
118
|
+
export async function verifyByReplay(att, replayer) {
|
|
119
|
+
if (!replayer || typeof replayer.replay !== 'function') {
|
|
120
|
+
throw new Error('verifyByReplay: not implemented in SDK. Inject a ReplayBackend ' +
|
|
121
|
+
'or use a private backend (e.g. gateway replay service).');
|
|
122
|
+
}
|
|
123
|
+
return replayer.replay(att);
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=verify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../../../../src/v2/cognitive-attestation/verify.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qEAAqE;AACrE,mDAAmD;AACnD,qEAAqE;AACrE,0EAA0E;AAC1E,EAAE;AACF,gFAAgF;AAChF,2EAA2E;AAC3E,+EAA+E;AAC/E,2EAA2E;AAC3E,8EAA8E;AAC9E,2DAA2D;AAC3D,qEAAqE;AAErE,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAGvD,SAAS,UAAU,CAAC,KAAiB;IACnC,IAAI,GAAG,GAAG,EAAE,CAAA;IACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;IACpF,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,SAAS,WAAW,CAAC,GAAW;IAC9B,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,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AAE,CAAC;YACtB,MAAM,CAAC,IAAI,CACT,sDAAsD,GAAG,CAAC,cAAc,CAAC,aAAa,GAAG,CAC1F,CAAA;QACH,CAAC;IACH,CAAC;IAAC,OAAO,CAAU,EAAE,CAAC;QACpB,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IACzF,CAAC;IAED,OAAO;QACL,EAAE,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,WAAW,IAAI,gBAAgB;QAC1D,WAAW;QACX,gBAAgB;QAChB,MAAM;KACP,CAAA;AACH,CAAC;AA2BD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,GAAyB,EACzB,QAAuB;IAEvB,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QACvD,MAAM,IAAI,KAAK,CACb,iEAAiE;YAC/D,yDAAyD,CAC5D,CAAA;IACH,CAAC;IACD,OAAO,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AAC7B,CAAC"}
|
package/dist/src/v2/index.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export { checkEscalationRequired, requestOwnerConfirmation, recordOwnerConfirmat
|
|
|
27
27
|
export type { EscalationAction, EscalationCheck, RecordConfirmationParams, ConfirmationVerdict, VerifyForActionResult, } from './human-escalation.js';
|
|
28
28
|
export { bindWallet, unbindWallet, verifyBoundWallet, verifyUnbindEvent, } from "./wallet-binding/index.js";
|
|
29
29
|
export type { BoundWallet, WalletChain, WalletVerificationChallenge, UnbindEvent, } from "./wallet-binding/index.js";
|
|
30
|
+
export { buildAttestation, canonicalizeAttestation, signAttestation as signCognitiveAttestation, cognitiveAttestationDigest, sortFeatureActivations, validateAttestationShape, verifySignature as verifyCognitiveAttestationSignature, verifyRequiredSignerRoles, verifyAgainstRegistry, verifyByReplay, } from './cognitive-attestation/index.js';
|
|
31
|
+
export type { CognitiveAttestation, ModelRef, DictionaryRef, TokenRange, FeatureActivation, AggregationPolicy, Signature as CognitiveAttestationSignature, SignerRole as CognitiveAttestationSignerRole, ExecutionEnvironment, Precision, AttachmentPoint, SAEType, ActivationStatistic, CompletenessClaim, TiebreakerRule, BuildAttestationInput, RequiredRoleCoverage, RegistryResolver, RegistryVerificationResult, ReplayBackend, ReplayVerificationResult, ThresholdDispute, ExclusionDispute, ComputationalDispute, DecompositionAdequacyDispute, FacetedReinterpretationDispute, InterpretiveDispute, Dispute, } from './cognitive-attestation/index.js';
|
|
30
32
|
export { verifyOnAccept, evaluateCredentialCheck, resolveCheckMode, } from "./credential-check-policy/index.js";
|
|
31
33
|
export type { CredentialCheckMode, CredentialCheckPolicy, CredentialCheckResult, CredentialCheckDenialCode, AcceptanceStamp, } from "./credential-check-policy/index.js";
|
|
32
34
|
export { createAttributionReceipt, signAttributionConsent, verifyAttributionConsent, checkArtifactCitations, receiptCore, } from './attribution-consent/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/v2/index.ts"],"names":[],"mappings":"AACA;;;GAGG;AAGH,YAAY,EACV,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAClE,cAAc,EAAE,mBAAmB,EAAE,YAAY,EAAE,cAAc,EACjE,SAAS,EAAE,qBAAqB,EAAE,UAAU,EAAE,WAAW,EACzD,gBAAgB,EAAE,kBAAkB,EAAE,aAAa,EACnD,kBAAkB,EAAE,0BAA0B,EAC9C,SAAS,EAAE,YAAY,EACvB,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAC/C,gBAAgB,EAAE,eAAe,EACjC,mBAAmB,EAAE,qBAAqB,EAC1C,SAAS,EAAE,WAAW,EAAE,kBAAkB,EAC1C,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,k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,EAAE,qBAAqB,EAC9D,wBAAwB,EAAE,gBAAgB,EAC1C,kBAAkB,IAAI,6BAA6B,EACnD,gBAAgB,IAAI,2BAA2B,EAC/C,0BAA0B,EAAE,2BAA2B,EACvD,6BAA6B,EAAE,aAAa,EAC5C,YAAY,EAAE,QAAQ,EACtB,aAAa,EAAE,mBAAmB,EAClC,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAClD,iBAAiB,EAAE,iBAAiB,EACpC,iBAAiB,EAAE,iBAAiB,EACpC,eAAe,EAAE,0BAA0B,EAC3C,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAC/C,cAAc,EACd,0BAA0B,EAAE,2BAA2B,GACxD,MAAM,kCAAkC,CAAA;AACzC,YAAY,EACV,gBAAgB,EAAE,iBAAiB,EACnC,iBAAiB,EAAE,eAAe,EAAE,kBAAkB,EACtD,4BAA4B,EAAE,mBAAmB,EACjD,oBAAoB,EAAE,qBAAqB,EAAE,uBAAuB,EACpE,gBAAgB,EAAE,eAAe,EACjC,0BAA0B,EAC1B,aAAa,EAAE,YAAY,EAC3B,mBAAmB,EACnB,WAAW,EACX,iBAAiB,EAAE,gBAAgB,EACnC,cAAc,GACf,MAAM,kCAAkC,CAAA"}
|
package/dist/src/v2/index.js
CHANGED
|
@@ -43,6 +43,13 @@ export { subDelegateAdvisor, consultAdvisor, getAdvisorUses, clearAdvisorUseTrac
|
|
|
43
43
|
export { checkEscalationRequired, requestOwnerConfirmation, recordOwnerConfirmation, verifyOwnerConfirmation, isConfirmationValid, verifyV2DelegationForAction, hashActionDetails, DEFAULT_FLAGGED_ACTION_CLASSES, } from './human-escalation.js';
|
|
44
44
|
// Wallet Binding (agent-native structural attestation)
|
|
45
45
|
export { bindWallet, unbindWallet, verifyBoundWallet, verifyUnbindEvent, } from "./wallet-binding/index.js";
|
|
46
|
+
// Cognitive Attestation (Paper 7 — Zenodo DOI 10.5281/zenodo.19646276)
|
|
47
|
+
// Signed declarations of feature-level model computation. SDK ships the
|
|
48
|
+
// envelope, JCS canonicalization, Ed25519 signing, Stage 1 verification,
|
|
49
|
+
// Stage 2 registry interface, Stage 3 replay stub, typed dispute primitives.
|
|
50
|
+
// Dispute resolution / transparency logs / cross-tenant correlation live
|
|
51
|
+
// in @aeoess/gateway.
|
|
52
|
+
export { buildAttestation, canonicalizeAttestation, signAttestation as signCognitiveAttestation, cognitiveAttestationDigest, sortFeatureActivations, validateAttestationShape, verifySignature as verifyCognitiveAttestationSignature, verifyRequiredSignerRoles, verifyAgainstRegistry, verifyByReplay, } from './cognitive-attestation/index.js';
|
|
46
53
|
// Credential Check Policy (verification timing for governance metadata)
|
|
47
54
|
// Proposed by @piiiico on a2aproject/A2A governance metadata thread.
|
|
48
55
|
export { verifyOnAccept, evaluateCredentialCheck, resolveCheckMode, } from "./credential-check-policy/index.js";
|
package/dist/src/v2/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/v2/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E;;;GAGG;AAuBH,8DAA8D;AAC9D,OAAO,EACL,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAC5C,mBAAmB,EAAE,qBAAqB,EAAE,sBAAsB,EAClE,gBAAgB,EAAE,gBAAgB,EAClC,wBAAwB,EAAE,uBAAuB,EACjD,oBAAoB,EACpB,0BAA0B,EAAE,uBAAuB,EACnD,kBAAkB,GACnB,MAAM,aAAa,CAAA;AAEpB,2BAA2B;AAC3B,OAAO,EACL,kBAAkB,EAAE,qBAAqB,EAAE,iBAAiB,EAC5D,kBAAkB,EAAE,oBAAoB,EACxC,eAAe,EAAE,mBAAmB,EAAE,qBAAqB,EAC3D,wBAAwB,EAAE,wBAAwB,EAClD,oBAAoB,EAAE,sBAAsB,EAC5C,gBAAgB,EAAE,gBAAgB,GACnC,MAAM,oBAAoB,CAAA;AAG3B,0BAA0B;AAC1B,OAAO,EACL,qBAAqB,EAAE,oBAAo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,EAAE,0BAA0B,EAC3C,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAC/C,cAAc,EACd,0BAA0B,EAAE,2BAA2B,GACxD,MAAM,kCAAkC,CAAA"}
|
|
@@ -37,14 +37,26 @@ export declare function unbindWallet(opts: {
|
|
|
37
37
|
passport: SignedPassport;
|
|
38
38
|
unbindEvent: UnbindEvent;
|
|
39
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Object-form input for `verifyBoundWallet`, mirroring `bindWallet`.
|
|
42
|
+
*/
|
|
43
|
+
export type VerifyBoundWalletInput = {
|
|
44
|
+
passport: SignedPassport;
|
|
45
|
+
chain: WalletChain;
|
|
46
|
+
address: string;
|
|
47
|
+
};
|
|
40
48
|
/**
|
|
41
49
|
* Verify that (chain, address) is currently bound to the passport AND that
|
|
42
50
|
* the binding_signature is valid against the passport's public key.
|
|
43
51
|
*
|
|
52
|
+
* Accepts both positional args and an object form (as of v2.1.0). The object
|
|
53
|
+
* form matches `bindWallet`'s signature for call-site symmetry.
|
|
54
|
+
*
|
|
44
55
|
* Returns false if the wallet is not in bound_wallets, the signature is
|
|
45
56
|
* invalid, or the bound record has been tampered with.
|
|
46
57
|
*/
|
|
47
58
|
export declare function verifyBoundWallet(passport: SignedPassport, chain: WalletChain, address: string): boolean;
|
|
59
|
+
export declare function verifyBoundWallet(input: VerifyBoundWalletInput): boolean;
|
|
48
60
|
/**
|
|
49
61
|
* Verify a previously issued unbind event against a passport's public key.
|
|
50
62
|
* Useful when reconstructing wallet history from a stored unbind log.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../../../../src/v2/wallet-binding/bind.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,EAEV,WAAW,EACX,2BAA2B,EAC3B,WAAW,EACZ,MAAM,YAAY,CAAA;AAqDnB;;;;;;;;GAQG;AACH,wBAAgB,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,KAAK,EAAE,WAAW,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG;IAAE,QAAQ,EAAE,cAAc,CAAC;IAAC,WAAW,EAAE,WAAW,CAAA;CAAE,CA0DzD;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,cAAc,CAAA;IACxB,KAAK,EAAE,WAAW,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,MAAM,GACd,OAAO,CAAA;AACV,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAA;AAkCzE;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAYxF"}
|
|
@@ -156,18 +156,17 @@ export function unbindWallet(opts) {
|
|
|
156
156
|
unbindEvent,
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
export function verifyBoundWallet(passport, chain, address) {
|
|
159
|
+
export function verifyBoundWallet(arg1, chain, address) {
|
|
160
|
+
const asObj = arg1;
|
|
161
|
+
const isObjectForm = !!asObj && typeof asObj === 'object' &&
|
|
162
|
+
!!asObj.passport && !!asObj.chain && !!asObj.address;
|
|
163
|
+
const passport = isObjectForm ? asObj.passport : arg1;
|
|
164
|
+
const c = isObjectForm ? asObj.chain : chain;
|
|
165
|
+
const a = isObjectForm ? asObj.address : address;
|
|
167
166
|
const wallets = passport.passport.bound_wallets;
|
|
168
167
|
if (!wallets || wallets.length === 0)
|
|
169
168
|
return false;
|
|
170
|
-
const bound = wallets.find((w) => w.chain ===
|
|
169
|
+
const bound = wallets.find((w) => w.chain === c && w.address === a);
|
|
171
170
|
if (!bound)
|
|
172
171
|
return false;
|
|
173
172
|
const payload = bindingPayload({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bind.js","sourceRoot":"","sources":["../../../../src/v2/wallet-binding/bind.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qEAAqE;AACrE,oDAAoD;AACpD,qEAAqE;AAErE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAStD;;;;GAIG;AACH,MAAM,eAAe,GAAG,yBAAyB,CAAA;AAEjD;;;GAGG;AACH,SAAS,qBAAqB,CAAC,OAAe;IAC5C,IAAI,OAAO,CAAC,MAAM,GAAG,EAAE,IAAI,OAAO,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CACb,yEAAyE,OAAO,CAAC,MAAM,EAAE,CAC1F,CAAA;IACH,CAAC;IACD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAA;IACjG,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,IAKvB;IACC,OAAO,YAAY,CAAC;QAClB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;KACxB,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,IAKtB;IACC,OAAO,YAAY,CAAC;QAClB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,UAAU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M,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-passport-system",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Enforcement and accountability layer for AI agents. Bring your own identity (did:key, did:web, SPIFFE, OAuth, did:aps). Policy eval <2ms, 14 constraint dimensions, 403 ops/sec. Gateway enforcement, monotonic narrowing, cascade revocation, Bayesian reputation, feeless Nano payments, unified four-axis attribution primitive, per-period attribution settlement, data lifecycle.
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Enforcement and accountability layer for AI agents. Bring your own identity (did:key, did:web, SPIFFE, OAuth, did:aps). Policy eval <2ms, 14 constraint dimensions, 403 ops/sec. Gateway enforcement, monotonic narrowing, cascade revocation, Bayesian reputation, feeless Nano payments, unified four-axis attribution primitive, per-period attribution settlement, data lifecycle. 124 modules. 2,972 tests.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
7
7
|
"types": "dist/src/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "tsc && chmod +x dist/src/cli/index.js",
|
|
23
|
-
"test": "npx tsx --test tests/passport.test.ts tests/adversarial.ts tests/v2.0-integration.ts tests/contract.test.ts tests/agora.test.ts tests/values.test.ts tests/delegation.test.ts tests/attribution.test.ts tests/policy.test.ts tests/canonical.test.ts tests/coordination.test.ts tests/commerce.test.ts tests/enforcement.test.ts tests/routing.test.ts tests/did-vc.test.ts tests/a2a.test.ts tests/principal.test.ts tests/adversarial-paper.test.ts tests/property-delegation.test.ts tests/intent.test.ts tests/reputation-authority.test.ts tests/cross-chain.test.ts tests/encrypted-messaging.test.ts tests/obligations.test.ts tests/execution-envelope.test.ts tests/adversarial-causal-chain.test.ts tests/governance.test.ts tests/feasibility.test.ts tests/identity.test.ts tests/precedent.test.ts tests/reanchor.test.ts tests/escalation.test.ts tests/oracle-witness.test.ts tests/messaging-audit.test.ts tests/policy-conflict.test.ts tests/data-source.test.ts tests/decision-semantics.test.ts tests/interop-vectors.test.ts tests/v2-bridge.test.ts tests/v2-full.test.ts tests/key-storage.test.ts tests/qntm-bridge.test.ts tests/agent-json-bridge.test.ts tests/did-resolution-conformance.test.ts tests/decision-equivalence.test.ts tests/data-lifecycle.test.ts tests/campaign7-composition.test.ts tests/entity-verification.test.ts tests/conformance.test.ts tests/governance-block.test.ts tests/aps-txt.test.ts tests/governance-360.test.ts tests/storage-backend.test.ts tests/receipt-bundle.test.ts tests/reputation-confidence.test.ts tests/governance-consumer.test.ts tests/charter.test.ts tests/rome-phase2.test.ts tests/data-source-attribution.test.ts tests/canonical-jcs.test.ts tests/temporal-spread.test.ts tests/fidelity-pressure.test.ts tests/denial-domains.test.ts tests/data-narrowing.test.ts tests/governance-posture.test.ts tests/anchor-state.test.ts tests/issuer-signature.test.ts tests/openshell-adapter.test.ts tests/attestation.test.ts tests/execution-attestation.test.ts tests/bilateral-receipt.test.ts tests/proof-namespace.test.ts tests/ecosystem-features.test.ts tests/persistent-passport.test.ts tests/security-av.test.ts tests/audit-fixes.test.ts tests/did-interop.test.ts tests/identity-bridge.test.ts tests/vc-wrapper.test.ts tests/identity-pipeline.test.ts tests/cross-protocol/sint-crossverify.test.ts tests/action-ref.test.ts tests/freshness.test.ts tests/evidence-grade.test.ts tests/key-rotation.test.ts tests/governance-regression.test.ts tests/posture-overlay.test.ts tests/feasibility-gateway.test.ts tests/trust-adapters.test.ts tests/evaluation-context.test.ts tests/health.test.ts tests/composio-adapter.test.ts tests/interop/ietf-envelope.test.ts tests/interop/signet-combined.test.ts tests/interop/moltrust-attestation.test.ts tests/interop/cross-protocol-vectors.test.ts tests/interop/receipt-chaining.test.ts tests/ibac-adapter.test.ts tests/langchain-adapter.test.ts tests/crewai-adapter.test.ts tests/mcp-adapter.test.ts tests/a2a-adapter.test.ts tests/gonka-adapter.test.ts tests/cross-algo-mismatch.test.ts tests/credential-lifecycle.test.ts tests/behavioral-memory.test.ts tests/telemetry-scope.test.ts tests/idempotency.test.ts tests/v2/wallet-binding.test.ts tests/v2/wallet-binding-fixture.test.ts tests/v2/credential-check-policy.test.ts tests/v2/delegation-escalation.test.ts tests/v2/attribution-consent.test.ts tests/v2/attribution-integration.test.ts tests/v2/attribution-primitive.test.ts tests/v2/attribution-primitive-integration.test.ts tests/v2/build-b-fractional-weights.test.ts tests/v2/build-b-cross-language.test.ts tests/v2/build-c-settlement.test.ts tests/v2/build-c-cross-language.test.ts tests/v2/build-c-end-to-end.test.ts tests/v2/provisional-statement.test.ts tests/temporal-decay.test.ts tests/confidence-breakdown.test.ts tests/behavioral-fingerprint.test.ts tests/session-boundary.test.ts tests/probe-identity.test.ts",
|
|
23
|
+
"test": "npx tsx --test tests/passport.test.ts tests/adversarial.ts tests/v2.0-integration.ts tests/contract.test.ts tests/agora.test.ts tests/values.test.ts tests/delegation.test.ts tests/attribution.test.ts tests/policy.test.ts tests/canonical.test.ts tests/coordination.test.ts tests/commerce.test.ts tests/enforcement.test.ts tests/routing.test.ts tests/did-vc.test.ts tests/a2a.test.ts tests/principal.test.ts tests/adversarial-paper.test.ts tests/property-delegation.test.ts tests/intent.test.ts tests/reputation-authority.test.ts tests/cross-chain.test.ts tests/encrypted-messaging.test.ts tests/obligations.test.ts tests/execution-envelope.test.ts tests/adversarial-causal-chain.test.ts tests/governance.test.ts tests/feasibility.test.ts tests/identity.test.ts tests/precedent.test.ts tests/reanchor.test.ts tests/escalation.test.ts tests/oracle-witness.test.ts tests/messaging-audit.test.ts tests/policy-conflict.test.ts tests/data-source.test.ts tests/decision-semantics.test.ts tests/interop-vectors.test.ts tests/v2-bridge.test.ts tests/v2-full.test.ts tests/key-storage.test.ts tests/qntm-bridge.test.ts tests/agent-json-bridge.test.ts tests/did-resolution-conformance.test.ts tests/decision-equivalence.test.ts tests/data-lifecycle.test.ts tests/campaign7-composition.test.ts tests/entity-verification.test.ts tests/conformance.test.ts tests/governance-block.test.ts tests/aps-txt.test.ts tests/governance-360.test.ts tests/storage-backend.test.ts tests/receipt-bundle.test.ts tests/reputation-confidence.test.ts tests/governance-consumer.test.ts tests/charter.test.ts tests/rome-phase2.test.ts tests/data-source-attribution.test.ts tests/canonical-jcs.test.ts tests/temporal-spread.test.ts tests/fidelity-pressure.test.ts tests/denial-domains.test.ts tests/data-narrowing.test.ts tests/governance-posture.test.ts tests/anchor-state.test.ts tests/issuer-signature.test.ts tests/openshell-adapter.test.ts tests/attestation.test.ts tests/execution-attestation.test.ts tests/bilateral-receipt.test.ts tests/proof-namespace.test.ts tests/ecosystem-features.test.ts tests/persistent-passport.test.ts tests/security-av.test.ts tests/audit-fixes.test.ts tests/did-interop.test.ts tests/identity-bridge.test.ts tests/vc-wrapper.test.ts tests/identity-pipeline.test.ts tests/cross-protocol/sint-crossverify.test.ts tests/action-ref.test.ts tests/freshness.test.ts tests/evidence-grade.test.ts tests/key-rotation.test.ts tests/governance-regression.test.ts tests/posture-overlay.test.ts tests/feasibility-gateway.test.ts tests/trust-adapters.test.ts tests/evaluation-context.test.ts tests/health.test.ts tests/composio-adapter.test.ts tests/interop/ietf-envelope.test.ts tests/interop/signet-combined.test.ts tests/interop/moltrust-attestation.test.ts tests/interop/cross-protocol-vectors.test.ts tests/interop/receipt-chaining.test.ts tests/ibac-adapter.test.ts tests/langchain-adapter.test.ts tests/crewai-adapter.test.ts tests/mcp-adapter.test.ts tests/a2a-adapter.test.ts tests/gonka-adapter.test.ts tests/cross-algo-mismatch.test.ts tests/credential-lifecycle.test.ts tests/behavioral-memory.test.ts tests/telemetry-scope.test.ts tests/idempotency.test.ts tests/v2/wallet-binding.test.ts tests/v2/wallet-binding-fixture.test.ts tests/v2/credential-check-policy.test.ts tests/v2/delegation-escalation.test.ts tests/v2/attribution-consent.test.ts tests/v2/attribution-integration.test.ts tests/v2/attribution-primitive.test.ts tests/v2/attribution-primitive-integration.test.ts tests/v2/build-b-fractional-weights.test.ts tests/v2/build-b-cross-language.test.ts tests/v2/build-c-settlement.test.ts tests/v2/build-c-cross-language.test.ts tests/v2/build-c-end-to-end.test.ts tests/v2/provisional-statement.test.ts tests/temporal-decay.test.ts tests/confidence-breakdown.test.ts tests/behavioral-fingerprint.test.ts tests/session-boundary.test.ts tests/probe-identity.test.ts tests/v2/cognitive-attestation/envelope.test.ts tests/v2/cognitive-attestation/verify.test.ts tests/v2/cognitive-attestation/adversarial.test.ts",
|
|
24
24
|
"test:interop": "npx tsx --test tests/interop/ietf-envelope.test.ts tests/interop/signet-combined.test.ts tests/interop/moltrust-attestation.test.ts tests/interop/cross-protocol-vectors.test.ts tests/interop/receipt-chaining.test.ts",
|
|
25
25
|
"test:quick": "tsx --test tests/passport.test.ts",
|
|
26
26
|
"lint": "tsc --noEmit",
|