@certcrypt/sdk 0.0.0-stage → 1.0.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.
Potentially problematic release.
This version of @certcrypt/sdk might be problematic. Click here for more details.
- package/CHANGELOG.md +74 -0
- package/LICENSE +178 -0
- package/README.md +557 -2
- package/SECURITY.md +55 -0
- package/dist/src/artifacts/base-certificate.d.ts +336 -0
- package/dist/src/artifacts/base-certificate.js +373 -0
- package/dist/src/artifacts/base-certificate.js.map +1 -0
- package/dist/src/artifacts/capacity-evidence.d.ts +195 -0
- package/dist/src/artifacts/capacity-evidence.js +202 -0
- package/dist/src/artifacts/capacity-evidence.js.map +1 -0
- package/dist/src/artifacts/commitment-inclusion.d.ts +23 -0
- package/dist/src/artifacts/commitment-inclusion.js +91 -0
- package/dist/src/artifacts/commitment-inclusion.js.map +1 -0
- package/dist/src/artifacts/holder-keyset.d.ts +67 -0
- package/dist/src/artifacts/holder-keyset.js +149 -0
- package/dist/src/artifacts/holder-keyset.js.map +1 -0
- package/dist/src/artifacts/rfc3339.d.ts +9 -0
- package/dist/src/artifacts/rfc3339.js +39 -0
- package/dist/src/artifacts/rfc3339.js.map +1 -0
- package/dist/src/client.d.ts +552 -0
- package/dist/src/client.js +1347 -0
- package/dist/src/client.js.map +1 -0
- package/dist/src/crypto/ai-decision.d.ts +73 -0
- package/dist/src/crypto/ai-decision.js +94 -0
- package/dist/src/crypto/ai-decision.js.map +1 -0
- package/dist/src/crypto/canonical-subject.d.ts +33 -0
- package/dist/src/crypto/canonical-subject.js +240 -0
- package/dist/src/crypto/canonical-subject.js.map +1 -0
- package/dist/src/crypto/collection-merkle.d.ts +58 -0
- package/dist/src/crypto/collection-merkle.js +164 -0
- package/dist/src/crypto/collection-merkle.js.map +1 -0
- package/dist/src/crypto/composite.d.ts +53 -0
- package/dist/src/crypto/composite.js +69 -0
- package/dist/src/crypto/composite.js.map +1 -0
- package/dist/src/crypto/digest.d.ts +3 -0
- package/dist/src/crypto/digest.js +31 -0
- package/dist/src/crypto/digest.js.map +1 -0
- package/dist/src/crypto/ecdsa-p256.d.ts +79 -0
- package/dist/src/crypto/ecdsa-p256.js +277 -0
- package/dist/src/crypto/ecdsa-p256.js.map +1 -0
- package/dist/src/crypto/jcs.d.ts +13 -0
- package/dist/src/crypto/jcs.js +65 -0
- package/dist/src/crypto/jcs.js.map +1 -0
- package/dist/src/crypto/merkle.d.ts +18 -0
- package/dist/src/crypto/merkle.js +150 -0
- package/dist/src/crypto/merkle.js.map +1 -0
- package/dist/src/crypto/ml-dsa.d.ts +28 -0
- package/dist/src/crypto/ml-dsa.js +60 -0
- package/dist/src/crypto/ml-dsa.js.map +1 -0
- package/dist/src/crypto/pseudonym.d.ts +8 -0
- package/dist/src/crypto/pseudonym.js +50 -0
- package/dist/src/crypto/pseudonym.js.map +1 -0
- package/dist/src/crypto/strict-json.d.ts +25 -0
- package/dist/src/crypto/strict-json.js +180 -0
- package/dist/src/crypto/strict-json.js.map +1 -0
- package/dist/src/crypto/subject-json-preconditions.d.ts +46 -0
- package/dist/src/crypto/subject-json-preconditions.js +381 -0
- package/dist/src/crypto/subject-json-preconditions.js.map +1 -0
- package/dist/src/index.d.ts +18 -0
- package/dist/src/index.js +80 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/issuer.d.ts +668 -0
- package/dist/src/issuer.js +1066 -0
- package/dist/src/issuer.js.map +1 -0
- package/dist/src/retry.d.ts +67 -0
- package/dist/src/retry.js +78 -0
- package/dist/src/retry.js.map +1 -0
- package/dist/src/types.d.ts +297 -0
- package/dist/src/types.js +15 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +62 -4
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Issuer-side minter of the CCSP/1 `base_certificate` with a verifiable subject
|
|
3
|
+
* anchor — the object the verifier's Issued plane validates.
|
|
4
|
+
*
|
|
5
|
+
* NO CUSTODY: the issuer builds and SIGNS the `base_certificate` with its own
|
|
6
|
+
* issuer key, client-side. CERTCRYPT never holds the key and never signs on the
|
|
7
|
+
* issuer's behalf. This module builds the anchor + payload (CCCP/1
|
|
8
|
+
* per-subject and anchor commitments) and, given a signer, produces the
|
|
9
|
+
* signed certificate and its `certificate_commitment_digest = SHA3(JCS(cert))`.
|
|
10
|
+
*
|
|
11
|
+
* Byte parity is load-bearing and pinned by the conformance vectors — both the
|
|
12
|
+
* per-subject commitments and whole certificates.
|
|
13
|
+
* A one-byte divergence in the anchor JCS, the per-subject and anchor concatenation, or the
|
|
14
|
+
* payload JCS breaks verification cross-language.
|
|
15
|
+
*/
|
|
16
|
+
import { type KeyObject } from "node:crypto";
|
|
17
|
+
import { type CollectionLeafInput } from "../crypto/collection-merkle.js";
|
|
18
|
+
import { type CompositeSignatureWire } from "../crypto/composite.js";
|
|
19
|
+
/** One certified subject as it appears in `payload.anchor.subjects[]` (CCSP/1). */
|
|
20
|
+
export interface SubjectCommitment {
|
|
21
|
+
profile: string;
|
|
22
|
+
commitment_digest_hex: string;
|
|
23
|
+
/**
|
|
24
|
+
* `subject.collection/1` only: the signed collection descriptor. CCSP/1 §7.3.2 allows
|
|
25
|
+
* additional members whose meaning a referenced normative spec defines, and this is
|
|
26
|
+
* that case — the descriptor rides INSIDE the subject so each leaf's profile enters
|
|
27
|
+
* the signature (the profile decides how the leaf canonicalizes, so an unsigned one
|
|
28
|
+
* would be forgeable).
|
|
29
|
+
*/
|
|
30
|
+
collection?: CollectionDescriptor;
|
|
31
|
+
}
|
|
32
|
+
/** The signed `subject.collection/1` descriptor (four members, `subject.collection/1` §7). */
|
|
33
|
+
export interface CollectionDescriptor {
|
|
34
|
+
commitment_scheme: string;
|
|
35
|
+
root: string;
|
|
36
|
+
declared_cardinality: string;
|
|
37
|
+
leaves: {
|
|
38
|
+
profile: string;
|
|
39
|
+
commitment_digest_hex: string;
|
|
40
|
+
}[];
|
|
41
|
+
}
|
|
42
|
+
/** The signed issuance-time root (CCSP/1). A closed object. */
|
|
43
|
+
export interface CertificateAnchor {
|
|
44
|
+
issued_at: string;
|
|
45
|
+
nonce_hex: string;
|
|
46
|
+
root_id?: string;
|
|
47
|
+
subjects: SubjectCommitment[];
|
|
48
|
+
}
|
|
49
|
+
/** The normative payload (CCSP/1). `anchor_commitment_digest_hex` is a sibling of `anchor`. */
|
|
50
|
+
export interface CertificatePayload {
|
|
51
|
+
anchor: CertificateAnchor;
|
|
52
|
+
anchor_commitment_digest_hex: string;
|
|
53
|
+
system_id: string;
|
|
54
|
+
rules_version: string;
|
|
55
|
+
/** The declared context this certificate names for CCVP/1 (CCVP/1 §5.2). */
|
|
56
|
+
context?: ConsistencyContext;
|
|
57
|
+
/** The snapshot a context snapshot certificate carries (CCVP/1 §6). */
|
|
58
|
+
snapshot?: Record<string, unknown>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The declared context a certificate names for CCVP/1 consistency (CCVP/1
|
|
62
|
+
* §5.2): the snapshot issuer by label AND composite key fingerprint, and the
|
|
63
|
+
* context set. Naming the key is what keeps anyone else from publishing
|
|
64
|
+
* snapshots in this namespace under the same label.
|
|
65
|
+
*/
|
|
66
|
+
export interface ConsistencyContext {
|
|
67
|
+
snapshot_issuer_id: string;
|
|
68
|
+
/** `issuerKeyFingerprintHex(snapshotIssuerKey)`. */
|
|
69
|
+
snapshot_issuer_fingerprint_digest_hex: string;
|
|
70
|
+
context_set_id: string;
|
|
71
|
+
}
|
|
72
|
+
/** One subject the issuer wants to certify: its declared profile + raw material bytes. */
|
|
73
|
+
export interface SubjectInput {
|
|
74
|
+
/** e.g. "subject.binary/1", "subject.text/1". The profile string, byte-compared. */
|
|
75
|
+
profile: string;
|
|
76
|
+
/**
|
|
77
|
+
* The subject's ORIGINAL bytes. For JSON-object profiles
|
|
78
|
+
* (subject.collection/1, subject.ai-decision/1) these are the JSON source
|
|
79
|
+
* bytes; the VALUE is re-canonicalized. `canonicalBytesForSubject` handles the
|
|
80
|
+
* per-profile transform.
|
|
81
|
+
*
|
|
82
|
+
* For a `subject.collection/1` declared via `leaves`, omit this: the SDK builds
|
|
83
|
+
* the descriptor itself and fills it in.
|
|
84
|
+
*/
|
|
85
|
+
material?: Uint8Array;
|
|
86
|
+
/**
|
|
87
|
+
* A `subject.collection/1` declared by its ORDERED leaf materials instead of a
|
|
88
|
+
* prebuilt descriptor.
|
|
89
|
+
*
|
|
90
|
+
* Preferred for collections. The root is salted with the certificate's anchor
|
|
91
|
+
* `nonce_hex` (`subject.collection/1` §8), which does not exist until `issue()`
|
|
92
|
+
* generates it — so a caller CANNOT compute a correct root beforehand. Supplying
|
|
93
|
+
* leaves lets the SDK build the descriptor at the right moment and return the
|
|
94
|
+
* leaf hashes the issuer needs to build inclusion proofs.
|
|
95
|
+
*
|
|
96
|
+
* Each leaf declares its OWN profile, so one collection may mix texts, binaries and
|
|
97
|
+
* emails (`subject.collection/1` §7.4).
|
|
98
|
+
*/
|
|
99
|
+
leaves?: CollectionLeafInput[];
|
|
100
|
+
/** Set by `resolveCollectionSubjects`; callers do not supply this. */
|
|
101
|
+
collection?: CollectionDescriptor;
|
|
102
|
+
}
|
|
103
|
+
export interface AssemblePayloadInput {
|
|
104
|
+
subjects: SubjectInput[];
|
|
105
|
+
/** 64 lowercase hex, one nonce per anchor (CSPRNG, non-reuse). `generateNonceHex()`. */
|
|
106
|
+
nonce_hex: string;
|
|
107
|
+
/** RFC 3339 UTC with 'Z'. */
|
|
108
|
+
issued_at: string;
|
|
109
|
+
/** Optional; when present, the system_root_fingerprint (64 lowercase hex). */
|
|
110
|
+
root_id?: string;
|
|
111
|
+
system_id: string;
|
|
112
|
+
rules_version: string;
|
|
113
|
+
/**
|
|
114
|
+
* Optional CCVP/1 declared context, signed with the payload. Opting in only
|
|
115
|
+
* lets a verifier evaluate consistency; it never changes Issued or
|
|
116
|
+
* Independent.
|
|
117
|
+
*/
|
|
118
|
+
context?: ConsistencyContext;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* CCCP/1 per-subject commitment:
|
|
122
|
+
* commitment_digest_hex = SHA3-256(ASCII(nonce_hex) || ASCII(subject_local_digest_hex))
|
|
123
|
+
* where subject_local_digest_hex = SHA3-256(canonical_bytes). The hex
|
|
124
|
+
* strings are concatenated as ASCII bytes and NOT decoded first (the most common
|
|
125
|
+
* cross-language error). `digestHexText` hashes the UTF-8/ASCII bytes of the
|
|
126
|
+
* string, which is exactly this.
|
|
127
|
+
*/
|
|
128
|
+
export declare function computeSubjectCommitment(nonce_hex: string, subjectLocalDigestHex: string): string;
|
|
129
|
+
/** `subject_local_digest_hex = SHA3-256(canonical_bytes(subject))` (CCCP/1). */
|
|
130
|
+
export declare function subjectLocalDigestHex(subject: SubjectInput): string;
|
|
131
|
+
/** What `resolveCollectionSubjects` produced for one collection subject. */
|
|
132
|
+
export interface ResolvedCollection {
|
|
133
|
+
/** Zero-based index of the subject in `anchor.subjects[]`. */
|
|
134
|
+
subjectIndex: number;
|
|
135
|
+
descriptor: CollectionDescriptor;
|
|
136
|
+
/**
|
|
137
|
+
* Leaf hashes in leaf order. They travel signed inside the descriptor; the
|
|
138
|
+
* issuer also keeps them locally to build inclusion proofs.
|
|
139
|
+
*/
|
|
140
|
+
leafHashes: string[];
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Turn every `leaves`-declared collection subject into a concrete descriptor,
|
|
144
|
+
* salted with this certificate's nonce.
|
|
145
|
+
*
|
|
146
|
+
* Returns the resolved subjects plus, per collection, the descriptor and leaf hashes.
|
|
147
|
+
* Both ship signed inside the certificate and are readable from there, ordered — so an
|
|
148
|
+
* inclusion proof can be rebuilt from the certificate alone. What the certificate does
|
|
149
|
+
* NOT carry is the leaf MATERIAL: each leaf is a salted digest, and no party can
|
|
150
|
+
* recover the bytes behind it. Proving a member still requires holding that member.
|
|
151
|
+
*/
|
|
152
|
+
export declare function resolveCollectionSubjects(subjects: SubjectInput[], nonceHex: string): {
|
|
153
|
+
subjects: SubjectInput[];
|
|
154
|
+
collections: ResolvedCollection[];
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* CCCP/1 anchor commitment:
|
|
158
|
+
* anchor_commitment_digest_hex =
|
|
159
|
+
* SHA3-256(ASCII(nonce_hex) || ASCII(SHA3-256(RFC8785(anchor))))
|
|
160
|
+
* Published in `payload.anchor_commitment_digest_hex`.
|
|
161
|
+
*/
|
|
162
|
+
export declare function computeAnchorCommitment(anchor: CertificateAnchor): string;
|
|
163
|
+
/** 256-bit CSPRNG nonce as 64 lowercase hex chars. Non-reuse is the caller's invariant. */
|
|
164
|
+
export declare function generateNonceHex(): string;
|
|
165
|
+
/**
|
|
166
|
+
* Derive the evidence `expires_at = issued_at + ttl` (capacity.commitment/1),
|
|
167
|
+
* keeping RFC 3339 second precision (byte-parity with the canonical bytes).
|
|
168
|
+
*
|
|
169
|
+
* The TTL is NOT chosen here: it comes from the active rules-domain registry, and
|
|
170
|
+
* the value it yields is the signed settlement-bound deadline a verifier evaluates
|
|
171
|
+
* under the dual temporal condition. This function takes it as a parameter — a
|
|
172
|
+
* wrong value fails verification closed.
|
|
173
|
+
*
|
|
174
|
+
* `issued_at` MUST be RFC 3339 UTC second precision (…Z); `ttl_seconds` MUST be a
|
|
175
|
+
* positive whole number of seconds.
|
|
176
|
+
*/
|
|
177
|
+
export declare function computeExpiresAt(issued_at: string, ttl_seconds: number): string;
|
|
178
|
+
/**
|
|
179
|
+
* Build the unsigned CCSP/1 payload with a verifiable subject anchor. Computes
|
|
180
|
+
* each subject's commitment from its material (subject_local_digest never
|
|
181
|
+
* leaves this process), assembles the anchor, and computes the anchor
|
|
182
|
+
* commitment. The subject order is preserved (CCSP/1 — order is
|
|
183
|
+
* significant and the normative subject count).
|
|
184
|
+
*
|
|
185
|
+
* Throws on a malformed nonce or an empty subject set (fail-fast; the verifier
|
|
186
|
+
* would reject these downstream).
|
|
187
|
+
*/
|
|
188
|
+
export declare function assembleUnsignedPayload(input: AssemblePayloadInput): CertificatePayload;
|
|
189
|
+
/** `payload_canon_digest_hex = SHA3-256(RFC8785(payload))`, lowercase hex. */
|
|
190
|
+
export declare function payloadCanonDigestHex(payload: CertificatePayload): string;
|
|
191
|
+
/**
|
|
192
|
+
* Explicit issuance-target choice, closing the silent fail-open where an absent
|
|
193
|
+
* `root_id` quietly produces a certificate that can NEVER reach `Independent`.
|
|
194
|
+
*
|
|
195
|
+
* - `issued-only`: the issuer consciously emits a certificate that is
|
|
196
|
+
* Issued-valid but NOT eligible for `Independent` (no participation reference).
|
|
197
|
+
* Verifiable against original material offline; simply never anchored.
|
|
198
|
+
* - `independent-capable`: the certificate targets `Independent`. REQUIRES
|
|
199
|
+
* `root_id` (= the domain's `system_root_fingerprint`), the signed
|
|
200
|
+
* issuance-time participation reference (CCSP/1; independence.proof/1).
|
|
201
|
+
* Without it, no later step can make the certificate Independent — a
|
|
202
|
+
* non-repairable emission choice, so it must be explicit, never a defaulted
|
|
203
|
+
* omission.
|
|
204
|
+
*
|
|
205
|
+
* NOTE: `root_id` is OPTIONAL at the CCSP/1 layer — an Issued-only certificate is
|
|
206
|
+
* legitimate. This discriminated choice does not make it mandatory; it makes the
|
|
207
|
+
* choice deliberate.
|
|
208
|
+
*/
|
|
209
|
+
export type IssuanceTarget = {
|
|
210
|
+
mode: "issued-only";
|
|
211
|
+
} | {
|
|
212
|
+
mode: "independent-capable";
|
|
213
|
+
root_id: string;
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* The issuer's composite signing identity (client-side custody). The
|
|
217
|
+
* private components never leave the issuer process; only the public keys +
|
|
218
|
+
* `signer.id` travel in the certificate. Obtain one whole from
|
|
219
|
+
* `generateIssuerKey` / `deriveIssuerKey`. `p256Private` is a node KeyObject;
|
|
220
|
+
* `mldsaSecret` is the raw ML-DSA-65 secret. `pub_p256_b64` is SEC1 uncompressed
|
|
221
|
+
* (65B) base64; `pub_mldsa_b64` is the raw ML-DSA-65 public key base64.
|
|
222
|
+
*/
|
|
223
|
+
export interface IssuerKey {
|
|
224
|
+
id: string;
|
|
225
|
+
p256Private: KeyObject;
|
|
226
|
+
mldsaSecret: Uint8Array;
|
|
227
|
+
pub_p256_b64: string;
|
|
228
|
+
pub_mldsa_b64: string;
|
|
229
|
+
}
|
|
230
|
+
/** One `signatures[]` entry of the base certificate (composite issuer). */
|
|
231
|
+
export interface CertificateSignature {
|
|
232
|
+
role: string;
|
|
233
|
+
sig_target: string;
|
|
234
|
+
alg: string;
|
|
235
|
+
mode: string;
|
|
236
|
+
signatures: CompositeSignatureWire["signatures"];
|
|
237
|
+
signer: {
|
|
238
|
+
id: string;
|
|
239
|
+
pub_p256_b64: string;
|
|
240
|
+
pub_mldsa_b64: string;
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
/** The signed CCSP/1 base certificate. */
|
|
244
|
+
export interface BaseCertificate {
|
|
245
|
+
schema: string;
|
|
246
|
+
payload: CertificatePayload;
|
|
247
|
+
payload_canon_digest_hex: string;
|
|
248
|
+
signatures: CertificateSignature[];
|
|
249
|
+
}
|
|
250
|
+
/** The minter's output: the signed cert plus its LEAF-BINDING digest. */
|
|
251
|
+
export interface MintedCertificate {
|
|
252
|
+
base_certificate: BaseCertificate;
|
|
253
|
+
/** `certificate_commitment_digest = SHA3(JCS(base_certificate))` (LEAF-BINDING). */
|
|
254
|
+
certificate_commitment_digest: string;
|
|
255
|
+
}
|
|
256
|
+
export interface AssembleBaseCertificateInput extends AssemblePayloadInput {
|
|
257
|
+
issuerKey: IssuerKey;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Generate a fresh, random issuer composite key (P-256 + ML-DSA-65) for
|
|
261
|
+
* development and tests. Issuance derives the key from the seed
|
|
262
|
+
* (`deriveIssuerKey`) or takes an injected one (e.g. KMS-backed); a random key
|
|
263
|
+
* cannot be re-derived from the seed, so do NOT use this to mint production
|
|
264
|
+
* certificates.
|
|
265
|
+
*/
|
|
266
|
+
export declare function generateIssuerKey(id: string): IssuerKey;
|
|
267
|
+
/**
|
|
268
|
+
* Derive the issuer's composite signing key DETERMINISTICALLY from the same
|
|
269
|
+
* 32-byte master seed the SDK already holds (the one `HolderKeySet.fromMasterSeed`
|
|
270
|
+
* uses for the operation-key tree). The issuer therefore provisions ONE secret —
|
|
271
|
+
* the seed it supplies — and the SDK derives from it:
|
|
272
|
+
* - the operation-key tree (signs capacity evidence), via `op-key/<i>`, and
|
|
273
|
+
* - THIS composite cert-signing key, via a DISTINCT domain label.
|
|
274
|
+
*
|
|
275
|
+
* The two derivations are domain-separated (different SHA3 labels) so the cert key
|
|
276
|
+
* is cryptographically independent of the operation keys — a design invariant, not
|
|
277
|
+
* a convenience. The issuer NEVER handles this key; it is reconstructed from the
|
|
278
|
+
* seed each run, so it is stable across restarts (same seed → same issuer identity)
|
|
279
|
+
* with no stored key material and no KMS in the "first certificate" path.
|
|
280
|
+
*
|
|
281
|
+
* Self-contained: the public halves are carried inside every base_certificate, so
|
|
282
|
+
* a verifier reaches INDEPENDENT_VALID without any registry lookup.
|
|
283
|
+
*
|
|
284
|
+
* (A KMS-backed IssuerKey can be injected instead of deriving — a deliberate
|
|
285
|
+
* hardening, not a requirement for issuance.)
|
|
286
|
+
*
|
|
287
|
+
* @param masterSeed 32-byte seed (Uint8Array or 64-hex string), same as the keyset.
|
|
288
|
+
* @param id the issuer key id stamped into the certificate's signer block.
|
|
289
|
+
*/
|
|
290
|
+
export declare function deriveIssuerKey(masterSeed: Uint8Array | string, id: string): IssuerKey;
|
|
291
|
+
/**
|
|
292
|
+
* Mint a signed CCSP/1 base certificate with a verifiable subject anchor
|
|
293
|
+
* (the issuer signs client-side). Builds the payload, composite-signs
|
|
294
|
+
* `payload_canon_digest_hex` with the issuer key, and returns the
|
|
295
|
+
* certificate plus `certificate_commitment_digest = SHA3(JCS(cert))`.
|
|
296
|
+
*
|
|
297
|
+
* The result verifies under the toolkit's Issued plane (structure → composite
|
|
298
|
+
* issuer signature → original-material).
|
|
299
|
+
*/
|
|
300
|
+
export declare function assembleBaseCertificate(input: AssembleBaseCertificateInput): MintedCertificate;
|
|
301
|
+
/**
|
|
302
|
+
* The composite key fingerprint of an issuer key (CCVP/1 §8.1):
|
|
303
|
+
* `SHA3-256(pub_p256_bytes || pub_mldsa_bytes)` over the decoded keys, classical
|
|
304
|
+
* first — the construction of composite-signature/1 §10. It is the value a
|
|
305
|
+
* context snapshot entry names in `pub_fingerprint_digest_hex`, and the value a
|
|
306
|
+
* certificate names in `context.snapshot_issuer_fingerprint_digest_hex` for the
|
|
307
|
+
* key that signs its snapshots.
|
|
308
|
+
*/
|
|
309
|
+
export declare function issuerKeyFingerprintHex(key: Pick<IssuerKey, "pub_p256_b64" | "pub_mldsa_b64">): string;
|
|
310
|
+
export interface AssembleContextSnapshotInput {
|
|
311
|
+
/**
|
|
312
|
+
* The snapshot object (CCVP/1 §6): `context_set_id`, `snapshot_id`,
|
|
313
|
+
* `issued_at` (its effective time) and `entries`, plus optional members such
|
|
314
|
+
* as `policy_refs`. It is carried as `payload.snapshot` exactly as given, so
|
|
315
|
+
* fix array order and timestamp spelling before calling.
|
|
316
|
+
*/
|
|
317
|
+
snapshot: Record<string, unknown>;
|
|
318
|
+
issuerKey: IssuerKey;
|
|
319
|
+
/** 64 lowercase hex. `generateNonceHex()`. */
|
|
320
|
+
nonce_hex: string;
|
|
321
|
+
/** The certificate's own issuance time, RFC 3339 UTC with 'Z'. */
|
|
322
|
+
issued_at: string;
|
|
323
|
+
system_id: string;
|
|
324
|
+
rules_version: string;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Mint a CCVP/1 context snapshot certificate: a CCSP/1 certificate carrying
|
|
328
|
+
* `snapshot` as `payload.snapshot` and exactly one `subject.context-snapshot/1`
|
|
329
|
+
* subject committing to it (CCVP/1 §5.1). The snapshot issuer is the key that
|
|
330
|
+
* signs it; verifiers derive it from the signature, never from the snapshot.
|
|
331
|
+
*
|
|
332
|
+
* The snapshot is checked against the CCVP/1 shape and the profile's own
|
|
333
|
+
* preconditions (no JSON number at any depth) before anything is signed. It is
|
|
334
|
+
* an ordinary Issued certificate, with no root participation reference.
|
|
335
|
+
*/
|
|
336
|
+
export declare function assembleContextSnapshotCertificate(input: AssembleContextSnapshotInput): MintedCertificate;
|