@mnemom/mnemom 0.17.37 → 0.17.38-next.1
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/dist/commands/agent-doctor.d.ts +2 -2
- package/dist/commands/agent-doctor.js +4 -4
- package/dist/commands/agent-run.d.ts +11 -0
- package/dist/commands/agent-run.js +37 -0
- package/dist/commands/agent-setup.d.ts +11 -9
- package/dist/commands/agent-setup.js +24 -19
- package/dist/commands/agent-share-render.d.ts +5 -5
- package/dist/commands/agent-share-render.js +9 -7
- package/dist/commands/agent-share-test-issuer.d.ts +1 -1
- package/dist/commands/agent-share-test-issuer.js +1 -1
- package/dist/commands/agent.d.ts +8 -1
- package/dist/commands/agent.js +14 -3
- package/dist/commands/card.js +1 -1
- package/dist/commands/onboard.js +5 -4
- package/dist/commands/scan.d.ts +35 -8
- package/dist/commands/scan.js +134 -45
- package/dist/commands/verify-card.d.ts +25 -1
- package/dist/commands/verify-card.js +29 -2
- package/dist/commands/wrap.js +4 -3
- package/dist/index.js +8 -6
- package/dist/lib/commit-report.d.ts +7 -13
- package/dist/lib/commit-report.js +12 -5
- package/dist/lib/conduct-receipt.d.ts +8 -3
- package/dist/lib/conduct-receipt.js +29 -7
- package/dist/lib/experimental.d.ts +1 -1
- package/dist/lib/experimental.js +1 -12
- package/dist/lib/runner/executor-client.d.ts +5 -0
- package/dist/lib/runner/executor-client.js +8 -0
- package/dist/lib/runner/job.d.ts +37 -0
- package/dist/lib/runner/job.js +74 -1
- package/dist/lib/runner/phases.d.ts +7 -2
- package/dist/lib/runner/phases.js +7 -2
- package/dist/lib/runner/proxy.d.ts +26 -2
- package/dist/lib/runner/proxy.js +33 -1
- package/dist/lib/runner/record-commit.d.ts +16 -0
- package/dist/lib/runner/record-commit.js +7 -0
- package/dist/lib/scan/report-email.d.ts +19 -2
- package/dist/lib/scan/report-email.js +78 -22
- package/dist/lib/scan/scan.d.ts +2 -0
- package/dist/lib/scan/scan.js +2 -1
- package/dist/lib/scan/share.d.ts +8 -6
- package/dist/lib/scan/share.js +28 -11
- package/dist/lib/scan/spend/anthropic-usage.d.ts +20 -1
- package/dist/lib/scan/spend/anthropic-usage.js +32 -7
- package/dist/lib/scan/spend/anthropic-wif.d.ts +42 -0
- package/dist/lib/scan/spend/anthropic-wif.js +153 -0
- package/dist/lib/starter-integrity.d.ts +20 -0
- package/dist/lib/starter-integrity.js +28 -0
- package/package.json +2 -5
- package/node_modules/@mnemom/aip-verifier/LICENSE +0 -190
- package/node_modules/@mnemom/aip-verifier/dist/claim-lint-CVITIRcU.d.cts +0 -478
- package/node_modules/@mnemom/aip-verifier/dist/claim-lint-CVITIRcU.d.ts +0 -478
- package/node_modules/@mnemom/aip-verifier/dist/index.cjs +0 -971
- package/node_modules/@mnemom/aip-verifier/dist/index.cjs.map +0 -1
- package/node_modules/@mnemom/aip-verifier/dist/index.d.cts +0 -330
- package/node_modules/@mnemom/aip-verifier/dist/index.d.ts +0 -330
- package/node_modules/@mnemom/aip-verifier/dist/index.js +0 -933
- package/node_modules/@mnemom/aip-verifier/dist/index.js.map +0 -1
- package/node_modules/@mnemom/aip-verifier/dist/render-lines.cjs +0 -879
- package/node_modules/@mnemom/aip-verifier/dist/render-lines.cjs.map +0 -1
- package/node_modules/@mnemom/aip-verifier/dist/render-lines.d.cts +0 -96
- package/node_modules/@mnemom/aip-verifier/dist/render-lines.d.ts +0 -96
- package/node_modules/@mnemom/aip-verifier/dist/render-lines.js +0 -875
- package/node_modules/@mnemom/aip-verifier/dist/render-lines.js.map +0 -1
- package/node_modules/@mnemom/aip-verifier/package.json +0 -86
- package/node_modules/@noble/ed25519/LICENSE +0 -21
- package/node_modules/@noble/ed25519/README.md +0 -371
- package/node_modules/@noble/ed25519/index.d.ts +0 -391
- package/node_modules/@noble/ed25519/index.js +0 -933
- package/node_modules/@noble/ed25519/index.ts +0 -1134
- package/node_modules/@noble/ed25519/package.json +0 -54
- package/node_modules/@noble/hashes/LICENSE +0 -21
- package/node_modules/@noble/hashes/README.md +0 -478
- package/node_modules/@noble/hashes/_blake.d.ts +0 -20
- package/node_modules/@noble/hashes/_blake.js +0 -59
- package/node_modules/@noble/hashes/_md.d.ts +0 -95
- package/node_modules/@noble/hashes/_md.js +0 -209
- package/node_modules/@noble/hashes/_u64.d.ts +0 -36
- package/node_modules/@noble/hashes/_u64.js +0 -77
- package/node_modules/@noble/hashes/argon2.d.ts +0 -148
- package/node_modules/@noble/hashes/argon2.js +0 -577
- package/node_modules/@noble/hashes/blake1.d.ts +0 -162
- package/node_modules/@noble/hashes/blake1.js +0 -630
- package/node_modules/@noble/hashes/blake2.d.ts +0 -203
- package/node_modules/@noble/hashes/blake2.js +0 -573
- package/node_modules/@noble/hashes/blake3.d.ts +0 -68
- package/node_modules/@noble/hashes/blake3.js +0 -310
- package/node_modules/@noble/hashes/eskdf.d.ts +0 -91
- package/node_modules/@noble/hashes/eskdf.js +0 -225
- package/node_modules/@noble/hashes/hkdf.d.ts +0 -70
- package/node_modules/@noble/hashes/hkdf.js +0 -152
- package/node_modules/@noble/hashes/hmac.d.ts +0 -50
- package/node_modules/@noble/hashes/hmac.js +0 -93
- package/node_modules/@noble/hashes/index.d.ts +0 -1
- package/node_modules/@noble/hashes/index.js +0 -34
- package/node_modules/@noble/hashes/legacy.d.ts +0 -107
- package/node_modules/@noble/hashes/legacy.js +0 -348
- package/node_modules/@noble/hashes/package.json +0 -91
- package/node_modules/@noble/hashes/pbkdf2.d.ts +0 -66
- package/node_modules/@noble/hashes/pbkdf2.js +0 -176
- package/node_modules/@noble/hashes/scrypt.d.ts +0 -98
- package/node_modules/@noble/hashes/scrypt.js +0 -304
- package/node_modules/@noble/hashes/sha2.d.ts +0 -176
- package/node_modules/@noble/hashes/sha2.js +0 -446
- package/node_modules/@noble/hashes/sha3-addons.d.ts +0 -533
- package/node_modules/@noble/hashes/sha3-addons.js +0 -973
- package/node_modules/@noble/hashes/sha3.d.ts +0 -208
- package/node_modules/@noble/hashes/sha3.js +0 -475
- package/node_modules/@noble/hashes/src/_blake.ts +0 -67
- package/node_modules/@noble/hashes/src/_md.ts +0 -227
- package/node_modules/@noble/hashes/src/_u64.ts +0 -111
- package/node_modules/@noble/hashes/src/argon2.ts +0 -693
- package/node_modules/@noble/hashes/src/blake1.ts +0 -677
- package/node_modules/@noble/hashes/src/blake2.ts +0 -648
- package/node_modules/@noble/hashes/src/blake3.ts +0 -344
- package/node_modules/@noble/hashes/src/eskdf.ts +0 -265
- package/node_modules/@noble/hashes/src/hkdf.ts +0 -161
- package/node_modules/@noble/hashes/src/hmac.ts +0 -130
- package/node_modules/@noble/hashes/src/index.ts +0 -33
- package/node_modules/@noble/hashes/src/legacy.ts +0 -361
- package/node_modules/@noble/hashes/src/pbkdf2.ts +0 -219
- package/node_modules/@noble/hashes/src/scrypt.ts +0 -375
- package/node_modules/@noble/hashes/src/sha2.ts +0 -486
- package/node_modules/@noble/hashes/src/sha3-addons.ts +0 -1157
- package/node_modules/@noble/hashes/src/sha3.ts +0 -525
- package/node_modules/@noble/hashes/src/utils.ts +0 -978
- package/node_modules/@noble/hashes/src/webcrypto.ts +0 -283
- package/node_modules/@noble/hashes/utils.d.ts +0 -560
- package/node_modules/@noble/hashes/utils.js +0 -687
- package/node_modules/@noble/hashes/webcrypto.d.ts +0 -121
- package/node_modules/@noble/hashes/webcrypto.js +0 -228
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
import { S as SignedStatement, R as RecordBundle, a as RecordJwks, b as RecordVerificationResult, c as StatementVerificationResult } from './claim-lint-CVITIRcU.js';
|
|
2
|
-
export { B as BUNDLE_TYP, C as CARD_LINE_CLASSES, d as CARD_SURFACES, e as CLAIM_CLASSES, f as CLAIM_TABLE, g as CardLineClass, h as CheckpointCitation, i as ClaimClass, j as ClaimField, k as ClaimTableEntry, l as ConductRecordStatement, E as ESTIMATE_FORBIDDEN_SURFACES, F as FLAGS, m as Flag, G as GOAL_MODES, n as GoalMode, L as LINE_KEY_FIELDS, o as LINT_RULES, p as LintResult, q as LintRule, r as LintViolation, M as MODES, s as MODE_VERBS, t as Mode, O as OutcomeStatement, P as PROTECTION_VERDICTS, u as PRRecordStatement, v as ProtectionVerdict, w as REASONS, x as Reason, y as RecordJwk, z as RecordShareCardLine, A as RenderedLine, D as Rendering, H as STATEMENT_TYPES, I as SURFACES, J as ShareCardStatement, K as SignedStatementBase, N as StatementFlag, Q as StatementGoalBlock, T as StatementLine, U as StatementProtectionAct, V as StatementTyp, W as Surface, X as attachLineContext, Y as fieldForLineKey, Z as isClaimField, _ as lintRendering, $ as lintRenderings, a0 as protectionVerb } from './claim-lint-CVITIRcU.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Certificate and proof types for AIP integrity verification.
|
|
6
|
-
*
|
|
7
|
-
* These types describe the structure of an integrity certificate
|
|
8
|
-
* produced by the AIP attestation pipeline, and the result of
|
|
9
|
-
* verifying one offline.
|
|
10
|
-
*/
|
|
11
|
-
/** A single concern identified during integrity analysis. */
|
|
12
|
-
interface CertificateConcern {
|
|
13
|
-
category: string;
|
|
14
|
-
severity: string;
|
|
15
|
-
description: string;
|
|
16
|
-
}
|
|
17
|
-
/** Subject of the integrity certificate — identifies what was analyzed. */
|
|
18
|
-
interface CertificateSubject {
|
|
19
|
-
checkpoint_id: string;
|
|
20
|
-
agent_id: string;
|
|
21
|
-
session_id: string;
|
|
22
|
-
card_id: string;
|
|
23
|
-
}
|
|
24
|
-
/** Claims made by the integrity analysis. */
|
|
25
|
-
interface CertificateClaims {
|
|
26
|
-
verdict: string;
|
|
27
|
-
concerns: CertificateConcern[];
|
|
28
|
-
confidence: number;
|
|
29
|
-
reasoning_summary: string;
|
|
30
|
-
analysis_model: string;
|
|
31
|
-
analysis_duration_ms: number;
|
|
32
|
-
}
|
|
33
|
-
/** Cryptographic commitments over the analysis inputs. */
|
|
34
|
-
interface InputCommitments {
|
|
35
|
-
thinking_block_hash: string;
|
|
36
|
-
card_hash: string;
|
|
37
|
-
values_hash: string;
|
|
38
|
-
context_hash: string;
|
|
39
|
-
model_version: string;
|
|
40
|
-
combined_commitment: string;
|
|
41
|
-
}
|
|
42
|
-
/** Ed25519 signature proof. */
|
|
43
|
-
interface SignatureProof {
|
|
44
|
-
algorithm: "Ed25519";
|
|
45
|
-
key_id: string;
|
|
46
|
-
value: string;
|
|
47
|
-
signed_payload: string;
|
|
48
|
-
}
|
|
49
|
-
/** Hash-chain position proof. */
|
|
50
|
-
interface ChainProof {
|
|
51
|
-
chain_hash: string;
|
|
52
|
-
prev_chain_hash: string | null;
|
|
53
|
-
position: number;
|
|
54
|
-
}
|
|
55
|
-
/** A single sibling node in a Merkle inclusion proof. */
|
|
56
|
-
interface MerkleSibling {
|
|
57
|
-
hash: string;
|
|
58
|
-
position: "left" | "right";
|
|
59
|
-
}
|
|
60
|
-
/** Merkle tree inclusion proof. */
|
|
61
|
-
interface MerkleProof {
|
|
62
|
-
leaf_hash: string;
|
|
63
|
-
leaf_index: number;
|
|
64
|
-
root: string;
|
|
65
|
-
tree_size: number;
|
|
66
|
-
inclusion_proof: MerkleSibling[];
|
|
67
|
-
}
|
|
68
|
-
/** Zero-knowledge verdict derivation proof (SP1 STARK). */
|
|
69
|
-
interface VerdictDerivationProof {
|
|
70
|
-
method: "SP1-STARK" | "RISC-Zero-STARK";
|
|
71
|
-
image_id: string;
|
|
72
|
-
receipt: string;
|
|
73
|
-
journal: string;
|
|
74
|
-
verified_at: string;
|
|
75
|
-
}
|
|
76
|
-
/** All cryptographic proofs attached to a certificate. */
|
|
77
|
-
interface CertificateProofs {
|
|
78
|
-
signature: SignatureProof;
|
|
79
|
-
chain: ChainProof;
|
|
80
|
-
merkle: MerkleProof | null;
|
|
81
|
-
verdict_derivation: VerdictDerivationProof | null;
|
|
82
|
-
}
|
|
83
|
-
/** Verification endpoint URLs (informational, not used offline). */
|
|
84
|
-
interface VerificationEndpoints {
|
|
85
|
-
keys_url: string;
|
|
86
|
-
certificate_url: string;
|
|
87
|
-
verify_url: string;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* An AIP Integrity Certificate.
|
|
91
|
-
*
|
|
92
|
-
* Produced by the attestation pipeline and cryptographically bound
|
|
93
|
-
* to the integrity checkpoint it attests.
|
|
94
|
-
*/
|
|
95
|
-
interface IntegrityCertificate {
|
|
96
|
-
"@context": "https://mnemom.ai/aip/v1";
|
|
97
|
-
type: "IntegrityCertificate";
|
|
98
|
-
version: "1.0.0";
|
|
99
|
-
certificate_id: string;
|
|
100
|
-
issued_at: string;
|
|
101
|
-
subject: CertificateSubject;
|
|
102
|
-
claims: CertificateClaims;
|
|
103
|
-
input_commitments: InputCommitments;
|
|
104
|
-
proofs: CertificateProofs;
|
|
105
|
-
verification: VerificationEndpoints;
|
|
106
|
-
}
|
|
107
|
-
/** Result of a single verification check. */
|
|
108
|
-
interface CheckResult {
|
|
109
|
-
valid: boolean;
|
|
110
|
-
details: string;
|
|
111
|
-
}
|
|
112
|
-
/** Aggregated result of verifying an integrity certificate. */
|
|
113
|
-
interface VerificationResult {
|
|
114
|
-
valid: boolean;
|
|
115
|
-
checks: {
|
|
116
|
-
signature: CheckResult;
|
|
117
|
-
chain: CheckResult;
|
|
118
|
-
merkle: CheckResult | null;
|
|
119
|
-
verdict_derivation: CheckResult | null;
|
|
120
|
-
};
|
|
121
|
-
certificate_id: string;
|
|
122
|
-
verified_at: string;
|
|
123
|
-
}
|
|
124
|
-
/** Options for the certificate verifier. */
|
|
125
|
-
interface VerifierOptions {
|
|
126
|
-
/** Ed25519 public key as hex string or Uint8Array. */
|
|
127
|
-
publicKey: string | Uint8Array;
|
|
128
|
-
/** Expected Merkle root (hex). If provided, Merkle proof is verified against it. */
|
|
129
|
-
merkleRoot?: string;
|
|
130
|
-
/** Expected SP1 image ID (hex). If provided, verdict derivation proof is checked against it. */
|
|
131
|
-
verdictDerivationImageId?: string;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Main certificate verification logic.
|
|
136
|
-
*
|
|
137
|
-
* Given a trusted public key (and optionally a Merkle root), verifies
|
|
138
|
-
* an AIP Integrity Certificate entirely offline.
|
|
139
|
-
*/
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Verify an AIP Integrity Certificate offline.
|
|
143
|
-
*
|
|
144
|
-
* Performs four checks:
|
|
145
|
-
*
|
|
146
|
-
* 1. **Signature** — Ed25519 verification of the signed payload.
|
|
147
|
-
* 2. **Chain** — Recomputes chain hash and compares with the certificate.
|
|
148
|
-
* 3. **Merkle** — If the certificate carries a Merkle proof *and*
|
|
149
|
-
* `options.merkleRoot` is supplied, verifies the inclusion proof.
|
|
150
|
-
* Otherwise the check is skipped (returns `null`).
|
|
151
|
-
* 4. **Verdict derivation** — If the certificate carries a verdict derivation
|
|
152
|
-
* proof, verifies structural integrity (journal fields match certificate
|
|
153
|
-
* claims). STARK receipt verification is deferred to server-side.
|
|
154
|
-
*
|
|
155
|
-
* @param certificate - The integrity certificate to verify.
|
|
156
|
-
* @param options - Public key and optional Merkle root.
|
|
157
|
-
* @returns Verification result with per-check details.
|
|
158
|
-
*/
|
|
159
|
-
declare function verifyCertificate(certificate: IntegrityCertificate, options: VerifierOptions): Promise<VerificationResult>;
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Offline verification of record statements and bundles.
|
|
163
|
-
*
|
|
164
|
-
* `verify(statement | bundle, jwks)` is the one entry point the CLI, CI,
|
|
165
|
-
* the PR check and the web pages all call. It never touches the network:
|
|
166
|
-
* the caller hands it the published JWKS.
|
|
167
|
-
*
|
|
168
|
-
* Order of checks for one statement, fail-closed, same as the SDK's
|
|
169
|
-
* `JwksClient.verify` (mnemom-platform `shared/sdk/src/jwks.ts`):
|
|
170
|
-
*
|
|
171
|
-
* 1. shape and `typ` (domain separation, T3)
|
|
172
|
-
* 2. `alg`, exact-match `EdDSA`, before any key material is touched
|
|
173
|
-
* 3. `signing_key_id` and `signature` present and well formed
|
|
174
|
-
* 4. key lookup by `kid`; the key must be an Ed25519 OKP key with `alg: EdDSA`
|
|
175
|
-
* 5. Ed25519 over `canonicalJson(statement minus signature)`
|
|
176
|
-
* 6. per-type rules (share card line classes, verdict coverage)
|
|
177
|
-
* 7. flags on cited checkpoints (T12), which never change `valid`
|
|
178
|
-
*/
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* The bytes a statement's signature covers: canonical JSON of the statement
|
|
182
|
-
* with `signature` removed. Exported so a signer in another language can be
|
|
183
|
-
* checked against it byte for byte.
|
|
184
|
-
*/
|
|
185
|
-
declare function statementCommitment(statement: Record<string, unknown>): string;
|
|
186
|
-
/** Lowercase sha256 hex of a statement's commitment: how statements link (T2). */
|
|
187
|
-
declare function statementDigest(statement: Record<string, unknown>): string;
|
|
188
|
-
/**
|
|
189
|
-
* Verify one signed statement against the published JWKS.
|
|
190
|
-
* Never throws and never calls the network.
|
|
191
|
-
*/
|
|
192
|
-
declare function verifyStatement(statement: unknown, jwks: RecordJwks): Promise<StatementVerificationResult>;
|
|
193
|
-
/**
|
|
194
|
-
* Verify a statement or a whole bundle against the published JWKS.
|
|
195
|
-
*
|
|
196
|
-
* For a bundle every statement is verified on its own, then the links
|
|
197
|
-
* between them are checked: a digest that names a statement in the bundle
|
|
198
|
-
* must name one of the right type. A digest that names nothing in the
|
|
199
|
-
* bundle is flagged, not failed, because a long session's earlier
|
|
200
|
-
* statements may live outside the bundle (design, open questions).
|
|
201
|
-
*/
|
|
202
|
-
declare function verify(input: SignedStatement | RecordBundle | unknown, jwks: RecordJwks): Promise<RecordVerificationResult>;
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* The render-estimate rule (criterion K4.4, design decision T8).
|
|
206
|
-
*
|
|
207
|
-
* The savings estimate stays off every rendering until the estimator gives a
|
|
208
|
-
* conservative net lower bound. Today's estimator overstates: it uses median
|
|
209
|
-
* benchmark savings, starts counting at 60k tokens, does not subtract μ, and
|
|
210
|
-
* never shows a loss. `estimateQualifies` is the registry's rule written as a
|
|
211
|
-
* pure function over the estimator's self-description, so a renderer and the
|
|
212
|
-
* verifier reach the same answer. Even when it qualifies, the estimate never
|
|
213
|
-
* appears on a PR comment or a share card.
|
|
214
|
-
*/
|
|
215
|
-
/** Tokens above which the gateway's context work is counted (the 200k line). */
|
|
216
|
-
declare const ESTIMATE_COUNTING_FLOOR_TOKENS = 200000;
|
|
217
|
-
interface EstimateDescription {
|
|
218
|
-
/** How the per-request saving is derived. Only a lower bound qualifies. */
|
|
219
|
-
method: "lower_bound" | "median" | "mean" | string;
|
|
220
|
-
/** Tokens from which the estimator starts counting. Must be at least the 200k line. */
|
|
221
|
-
counting_floor_tokens: number;
|
|
222
|
-
/** True when μ is subtracted from the gross saving. */
|
|
223
|
-
net_of_mu: boolean;
|
|
224
|
-
/** True when the estimator reports a loss as a negative figure rather than clamping at zero. */
|
|
225
|
-
reports_loss: boolean;
|
|
226
|
-
/** The net lower bound itself, in the same currency as model cost. */
|
|
227
|
-
net_lower_bound?: number;
|
|
228
|
-
[k: string]: unknown;
|
|
229
|
-
}
|
|
230
|
-
declare const ESTIMATE_DISQUALIFIERS: {
|
|
231
|
-
readonly not_an_object: "not_an_object";
|
|
232
|
-
readonly method_not_lower_bound: "method_not_lower_bound";
|
|
233
|
-
readonly counting_floor_below_200k: "counting_floor_below_200k";
|
|
234
|
-
readonly not_net_of_mu: "not_net_of_mu";
|
|
235
|
-
readonly never_shows_loss: "never_shows_loss";
|
|
236
|
-
readonly value_not_finite: "value_not_finite";
|
|
237
|
-
};
|
|
238
|
-
type EstimateDisqualifier = (typeof ESTIMATE_DISQUALIFIERS)[keyof typeof ESTIMATE_DISQUALIFIERS];
|
|
239
|
-
interface EstimateQualification {
|
|
240
|
-
qualifies: boolean;
|
|
241
|
-
reasons: EstimateDisqualifier[];
|
|
242
|
-
}
|
|
243
|
-
/** The registry's `estimate_qualifies` rule: a conservative net lower bound. */
|
|
244
|
-
declare function estimateQualifies(estimate: unknown): EstimateQualification;
|
|
245
|
-
declare const RENDER_ESTIMATE_REASONS: {
|
|
246
|
-
readonly unknown_surface: "unknown_surface";
|
|
247
|
-
readonly surface_never_shows_estimate: "surface_never_shows_estimate";
|
|
248
|
-
readonly estimate_does_not_qualify: "estimate_does_not_qualify";
|
|
249
|
-
};
|
|
250
|
-
interface RenderEstimateDecision {
|
|
251
|
-
render: boolean;
|
|
252
|
-
reasons: string[];
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Whether a rendering on `surface` may show the estimate. False on a PR
|
|
256
|
-
* comment or any card regardless of the estimate; otherwise the registry's
|
|
257
|
-
* rule decides. A missing estimate never renders.
|
|
258
|
-
*/
|
|
259
|
-
declare function shouldRenderEstimate(estimate: unknown, surface: unknown): RenderEstimateDecision;
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Canonical JSON, byte-identical to mnemom-api `src/attestation/crypto.ts`
|
|
263
|
-
* (`canonicalJson`): object keys sorted recursively, no whitespace, arrays
|
|
264
|
-
* kept in order, primitives through `JSON.stringify`.
|
|
265
|
-
*
|
|
266
|
-
* Every signed record statement commits to this serialisation of the
|
|
267
|
-
* statement minus its `signature` field, exactly the way
|
|
268
|
-
* `AAP-TransparencyRoot/v1` does (mnemom-api `src/transparency/root_publisher.ts`).
|
|
269
|
-
*/
|
|
270
|
-
declare function canonicalJson(value: unknown): string;
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* AAP-ShareCard/v1 — canonicalizer and offline verifier (MNE-9022).
|
|
274
|
-
*
|
|
275
|
-
* A share card is a signed set of numeric lines, each committing to the hash
|
|
276
|
-
* of the signed statement it was derived from. Signing follows the
|
|
277
|
-
* AAP-TransparencyRoot/v1 pattern (mnemom-api src/transparency/root_publisher.ts):
|
|
278
|
-
* Ed25519 over canonical JSON (sorted keys, no whitespace) of the card MINUS
|
|
279
|
-
* `signature`, with its own pinned `typ`. Renderers must display only the
|
|
280
|
-
* `lines` returned by a successful verification.
|
|
281
|
-
*
|
|
282
|
-
* This module verifies only. It never handles private keys.
|
|
283
|
-
*/
|
|
284
|
-
|
|
285
|
-
declare const SHARE_CARD_TYP = "AAP-ShareCard/v1";
|
|
286
|
-
type ShareCardLineKind = "count" | "revert";
|
|
287
|
-
interface ShareCardLine {
|
|
288
|
-
id: string;
|
|
289
|
-
kind: ShareCardLineKind;
|
|
290
|
-
label: string;
|
|
291
|
-
value: number;
|
|
292
|
-
statement_hash: string;
|
|
293
|
-
}
|
|
294
|
-
interface ShareCardStatementRef {
|
|
295
|
-
typ: string;
|
|
296
|
-
hash: string;
|
|
297
|
-
}
|
|
298
|
-
interface ShareCard {
|
|
299
|
-
typ: string;
|
|
300
|
-
card_id: string;
|
|
301
|
-
period: {
|
|
302
|
-
start: string;
|
|
303
|
-
end: string;
|
|
304
|
-
};
|
|
305
|
-
issued_at: string;
|
|
306
|
-
signing_key_id: string;
|
|
307
|
-
statements: ShareCardStatementRef[];
|
|
308
|
-
lines: ShareCardLine[];
|
|
309
|
-
/** base64url Ed25519 signature over canonicalJson(card minus signature). */
|
|
310
|
-
signature: string;
|
|
311
|
-
}
|
|
312
|
-
interface ShareCardVerification {
|
|
313
|
-
valid: boolean;
|
|
314
|
-
/** Empty unless `valid`. Renderers must show only these. */
|
|
315
|
-
lines: ShareCardLine[];
|
|
316
|
-
errors: string[];
|
|
317
|
-
}
|
|
318
|
-
/** The exact string that is signed: canonical JSON of the card minus `signature`. */
|
|
319
|
-
declare function shareCardSigningInput(card: Record<string, unknown>): string;
|
|
320
|
-
/** Structural validation (no signature check). Returns error strings. */
|
|
321
|
-
declare function validateShareCardShape(card: unknown): string[];
|
|
322
|
-
/**
|
|
323
|
-
* Verify a share card offline against a trusted Ed25519 public key.
|
|
324
|
-
* Fails closed: on any error `lines` is empty so nothing can be rendered.
|
|
325
|
-
*/
|
|
326
|
-
declare function verifyShareCard(card: unknown, options: {
|
|
327
|
-
publicKey: string | Uint8Array;
|
|
328
|
-
}): Promise<ShareCardVerification>;
|
|
329
|
-
|
|
330
|
-
export { type CertificateClaims, type CertificateConcern, type CertificateProofs, type CertificateSubject, type ChainProof, type CheckResult, ESTIMATE_COUNTING_FLOOR_TOKENS, ESTIMATE_DISQUALIFIERS, type EstimateDescription, type EstimateDisqualifier, type EstimateQualification, type InputCommitments, type IntegrityCertificate, type MerkleProof, type MerkleSibling, RENDER_ESTIMATE_REASONS, RecordBundle, RecordJwks, RecordVerificationResult, type RenderEstimateDecision, SHARE_CARD_TYP, type ShareCard, type ShareCardLine, type ShareCardLineKind, type ShareCardStatementRef, type ShareCardVerification, type SignatureProof, SignedStatement, StatementVerificationResult, type VerdictDerivationProof, type VerificationEndpoints, type VerificationResult, type VerifierOptions, canonicalJson, estimateQualifies, shareCardSigningInput, shouldRenderEstimate, statementCommitment, statementDigest, validateShareCardShape, verify, verifyCertificate, verifyShareCard, verifyStatement };
|