burnledger 0.8.0 → 0.9.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 +139 -2
- package/dist/cjs/anchor.d.ts +5 -3
- package/dist/cjs/anchor.d.ts.map +1 -1
- package/dist/cjs/anchor.js +10 -4
- package/dist/cjs/anchor.js.map +1 -1
- package/dist/cjs/client.d.ts +95 -0
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +133 -2
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/customer-keys.d.ts +146 -0
- package/dist/cjs/customer-keys.d.ts.map +1 -0
- package/dist/cjs/customer-keys.js +465 -0
- package/dist/cjs/customer-keys.js.map +1 -0
- package/dist/cjs/enclave-registration.d.ts +153 -0
- package/dist/cjs/enclave-registration.d.ts.map +1 -0
- package/dist/cjs/enclave-registration.js +275 -0
- package/dist/cjs/enclave-registration.js.map +1 -0
- package/dist/cjs/enclave-seal.d.ts +43 -0
- package/dist/cjs/enclave-seal.d.ts.map +1 -1
- package/dist/cjs/enclave-seal.js +62 -1
- package/dist/cjs/enclave-seal.js.map +1 -1
- package/dist/cjs/errors.d.ts +10 -0
- package/dist/cjs/errors.d.ts.map +1 -1
- package/dist/cjs/errors.js +11 -1
- package/dist/cjs/errors.js.map +1 -1
- package/dist/cjs/index.browser.d.ts +7 -3
- package/dist/cjs/index.browser.d.ts.map +1 -1
- package/dist/cjs/index.browser.js +6 -3
- package/dist/cjs/index.browser.js.map +1 -1
- package/dist/cjs/index.d.ts +23 -9
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +40 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/key-group.d.ts +80 -0
- package/dist/cjs/key-group.d.ts.map +1 -0
- package/dist/cjs/key-group.js +136 -0
- package/dist/cjs/key-group.js.map +1 -0
- package/dist/cjs/models.d.ts +60 -0
- package/dist/cjs/models.d.ts.map +1 -1
- package/dist/cjs/models.js +63 -0
- package/dist/cjs/models.js.map +1 -1
- package/dist/cjs/status-document.d.ts +25 -0
- package/dist/cjs/status-document.d.ts.map +1 -0
- package/dist/cjs/status-document.js +62 -0
- package/dist/cjs/status-document.js.map +1 -0
- package/dist/cjs/verify.d.ts +112 -3
- package/dist/cjs/verify.d.ts.map +1 -1
- package/dist/cjs/verify.js +393 -146
- package/dist/cjs/verify.js.map +1 -1
- package/dist/cjs/web-verifier.d.ts +23 -3
- package/dist/cjs/web-verifier.d.ts.map +1 -1
- package/dist/cjs/web-verifier.js +31 -5
- package/dist/cjs/web-verifier.js.map +1 -1
- package/dist/esm/anchor.d.ts +5 -3
- package/dist/esm/anchor.d.ts.map +1 -1
- package/dist/esm/anchor.js +10 -4
- package/dist/esm/anchor.js.map +1 -1
- package/dist/esm/cli.d.ts +13 -19
- package/dist/esm/cli.d.ts.map +1 -1
- package/dist/esm/cli.js +109 -81
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/client.d.ts +95 -0
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +133 -2
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/customer-keys.d.ts +146 -0
- package/dist/esm/customer-keys.d.ts.map +1 -0
- package/dist/esm/customer-keys.js +450 -0
- package/dist/esm/customer-keys.js.map +1 -0
- package/dist/esm/enclave-registration.d.ts +153 -0
- package/dist/esm/enclave-registration.d.ts.map +1 -0
- package/dist/esm/enclave-registration.js +265 -0
- package/dist/esm/enclave-registration.js.map +1 -0
- package/dist/esm/enclave-seal.d.ts +43 -0
- package/dist/esm/enclave-seal.d.ts.map +1 -1
- package/dist/esm/enclave-seal.js +61 -1
- package/dist/esm/enclave-seal.js.map +1 -1
- package/dist/esm/errors.d.ts +10 -0
- package/dist/esm/errors.d.ts.map +1 -1
- package/dist/esm/errors.js +10 -0
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/index.browser.d.ts +7 -3
- package/dist/esm/index.browser.d.ts.map +1 -1
- package/dist/esm/index.browser.js +6 -3
- package/dist/esm/index.browser.js.map +1 -1
- package/dist/esm/index.d.ts +23 -9
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +18 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/key-group.d.ts +80 -0
- package/dist/esm/key-group.d.ts.map +1 -0
- package/dist/esm/key-group.js +130 -0
- package/dist/esm/key-group.js.map +1 -0
- package/dist/esm/models.d.ts +60 -0
- package/dist/esm/models.d.ts.map +1 -1
- package/dist/esm/models.js +59 -0
- package/dist/esm/models.js.map +1 -1
- package/dist/esm/status-document.d.ts +25 -0
- package/dist/esm/status-document.d.ts.map +1 -0
- package/dist/esm/status-document.js +59 -0
- package/dist/esm/status-document.js.map +1 -0
- package/dist/esm/verify.d.ts +112 -3
- package/dist/esm/verify.d.ts.map +1 -1
- package/dist/esm/verify.js +390 -147
- package/dist/esm/verify.js.map +1 -1
- package/dist/esm/web-verifier.d.ts +23 -3
- package/dist/esm/web-verifier.d.ts.map +1 -1
- package/dist/esm/web-verifier.js +27 -5
- package/dist/esm/web-verifier.js.map +1 -1
- package/package.json +1 -1
- package/src/anchor.ts +10 -4
- package/src/cli.ts +122 -79
- package/src/client.ts +198 -6
- package/src/customer-keys.ts +550 -0
- package/src/enclave-registration.ts +390 -0
- package/src/enclave-seal.ts +108 -1
- package/src/errors.ts +11 -0
- package/src/index.browser.ts +9 -3
- package/src/index.ts +48 -6
- package/src/key-group.ts +181 -0
- package/src/models.ts +131 -0
- package/src/status-document.ts +59 -0
- package/src/verify.ts +503 -152
- package/src/web-verifier.ts +36 -3
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The members of a customer key group as signers (ADR-025 §2–3).
|
|
4
|
+
*
|
|
5
|
+
* Node only, like enclave-seal.ts: ADR-025 §2 makes a client the customer runs
|
|
6
|
+
* locally the only place enrolment can happen, because whoever serves a page
|
|
7
|
+
* controls the check the page would make.
|
|
8
|
+
*
|
|
9
|
+
* WHY A SIGNER AND NOT A PRIVATE KEY. Everything in this SDK that needs a
|
|
10
|
+
* member's signature takes a {@link KeyGroupSigner} — a public key and a
|
|
11
|
+
* function that signs bytes. The SDK never needs, holds or transmits a private
|
|
12
|
+
* key, so a member can live in an HSM, a cloud KMS, a hardware token or another
|
|
13
|
+
* process, and the SDK's only job is to hand it the exact canonical bytes and
|
|
14
|
+
* check what comes back. {@link InMemorySigner} is the convenience for tests and
|
|
15
|
+
* for customers who keep keys on the machine running the SDK.
|
|
16
|
+
*
|
|
17
|
+
* CUSTODY, stated plainly because nothing recovers from getting it wrong. The
|
|
18
|
+
* private halves are the customer's alone; BurnLedger never sees them and cannot
|
|
19
|
+
* reissue them. Lose enough members that the group can no longer meet its
|
|
20
|
+
* threshold and it can neither sign a registration nor authorise its own
|
|
21
|
+
* rotation — and an operator who could re-enrol on the customer's behalf is an
|
|
22
|
+
* operator who could mint, so there is no recovery path (ADR-025 §3 "Key loss").
|
|
23
|
+
* The only way back is to enrol a NEW group and re-register every system, and
|
|
24
|
+
* records issued before and after will name different `customer_key_id`s,
|
|
25
|
+
* visibly. Hedge before it happens: enrol more members than the threshold and
|
|
26
|
+
* keep at least one offline (the simplest is two members, threshold one).
|
|
27
|
+
*/
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.InMemorySigner = void 0;
|
|
30
|
+
exports.generateKeyGroup = generateKeyGroup;
|
|
31
|
+
exports.signWithGroup = signWithGroup;
|
|
32
|
+
const node_crypto_1 = require("node:crypto");
|
|
33
|
+
const crypto_node_js_1 = require("./crypto-node.js");
|
|
34
|
+
const customer_keys_js_1 = require("./customer-keys.js");
|
|
35
|
+
// RFC 8410: an Ed25519 private key as PKCS#8 is this fixed prefix and the seed.
|
|
36
|
+
const PKCS8_ED25519_PREFIX = Buffer.from("302e020100300506032b657004220420", "hex");
|
|
37
|
+
const SEED_SIZE = 32;
|
|
38
|
+
/**
|
|
39
|
+
* A member whose private key is held in this process.
|
|
40
|
+
*
|
|
41
|
+
* Convenient, and exactly as safe as the memory and disk of the machine running
|
|
42
|
+
* it. `exportSeed()` is the one way the key leaves: store the seed as you would
|
|
43
|
+
* any credential that cannot be reissued.
|
|
44
|
+
*/
|
|
45
|
+
class InMemorySigner {
|
|
46
|
+
publicKey;
|
|
47
|
+
#privateKey;
|
|
48
|
+
constructor(privateKey) {
|
|
49
|
+
this.#privateKey = privateKey;
|
|
50
|
+
const spki = (0, node_crypto_1.createPublicKey)(privateKey).export({ format: "der", type: "spki" });
|
|
51
|
+
this.publicKey = new Uint8Array(spki.subarray(spki.length - 32));
|
|
52
|
+
}
|
|
53
|
+
/** A fresh member, from the operating system's CSPRNG. */
|
|
54
|
+
static generate() {
|
|
55
|
+
return new InMemorySigner((0, node_crypto_1.generateKeyPairSync)("ed25519").privateKey);
|
|
56
|
+
}
|
|
57
|
+
/** The member a 32-byte seed (as returned by `exportSeed`) describes. */
|
|
58
|
+
static fromSeed(seed) {
|
|
59
|
+
if (!(seed instanceof Uint8Array) || seed.length !== SEED_SIZE) {
|
|
60
|
+
throw new Error(`an Ed25519 seed is ${SEED_SIZE} bytes`);
|
|
61
|
+
}
|
|
62
|
+
return new InMemorySigner((0, node_crypto_1.createPrivateKey)({
|
|
63
|
+
key: Buffer.concat([PKCS8_ED25519_PREFIX, Buffer.from(seed)]),
|
|
64
|
+
format: "der",
|
|
65
|
+
type: "pkcs8",
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
/** The 32-byte seed. Whoever holds it IS this member. */
|
|
69
|
+
exportSeed() {
|
|
70
|
+
const der = this.#privateKey.export({ format: "der", type: "pkcs8" });
|
|
71
|
+
return new Uint8Array(der.subarray(der.length - SEED_SIZE));
|
|
72
|
+
}
|
|
73
|
+
async sign(payload) {
|
|
74
|
+
return new Uint8Array((0, node_crypto_1.sign)(null, payload, this.#privateKey));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.InMemorySigner = InMemorySigner;
|
|
78
|
+
/**
|
|
79
|
+
* Generate `members` Ed25519 keys and the group requiring `threshold` of them.
|
|
80
|
+
*
|
|
81
|
+
* The private halves are returned to the caller and go nowhere else. Read the
|
|
82
|
+
* custody note at the top of this module before choosing `members` and
|
|
83
|
+
* `threshold`: a group whose members fall below its threshold is unrecoverable.
|
|
84
|
+
*/
|
|
85
|
+
async function generateKeyGroup(opts) {
|
|
86
|
+
if (!Number.isInteger(opts.members) || opts.members < 1) {
|
|
87
|
+
throw new customer_keys_js_1.InvalidKeyGroupError(`a key group needs at least one member, got ${opts.members}`);
|
|
88
|
+
}
|
|
89
|
+
const signers = Array.from({ length: opts.members }, () => InMemorySigner.generate());
|
|
90
|
+
const group = {
|
|
91
|
+
threshold: opts.threshold,
|
|
92
|
+
members: signers.map((s) => s.publicKey),
|
|
93
|
+
};
|
|
94
|
+
await (0, customer_keys_js_1.validateKeyGroup)(crypto_node_js_1.nodeCrypto, group);
|
|
95
|
+
return { group, signers };
|
|
96
|
+
}
|
|
97
|
+
function toHex(bytes) {
|
|
98
|
+
return Buffer.from(bytes).toString("hex");
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Collect member signatures over `payload`, keyed by member fingerprint — the
|
|
102
|
+
* wire form every ADR-025 request carries.
|
|
103
|
+
*
|
|
104
|
+
* Refuses before anything is sent, with a reason, where the enclave would refuse
|
|
105
|
+
* after with a bare 401: a signer that is not a member of `group`, the same
|
|
106
|
+
* member twice, a signature that does not verify under the signer's own public
|
|
107
|
+
* key, or fewer distinct members than `required`.
|
|
108
|
+
*/
|
|
109
|
+
async function signWithGroup(payload, group, signers, required) {
|
|
110
|
+
const members = new Set();
|
|
111
|
+
for (const member of group.members)
|
|
112
|
+
members.add(await (0, customer_keys_js_1.memberFingerprint)(crypto_node_js_1.nodeCrypto, member));
|
|
113
|
+
const signatures = {};
|
|
114
|
+
for (const signer of signers) {
|
|
115
|
+
const fingerprint = await (0, customer_keys_js_1.memberFingerprint)(crypto_node_js_1.nodeCrypto, signer.publicKey);
|
|
116
|
+
if (!members.has(fingerprint)) {
|
|
117
|
+
throw new customer_keys_js_1.InvalidKeyGroupError(`signer ${fingerprint} is not a member of this key group`);
|
|
118
|
+
}
|
|
119
|
+
if (fingerprint in signatures) {
|
|
120
|
+
throw new customer_keys_js_1.InvalidKeyGroupError(`member ${fingerprint} is listed twice among the signers`);
|
|
121
|
+
}
|
|
122
|
+
const signature = await signer.sign(payload);
|
|
123
|
+
if (!(signature instanceof Uint8Array) ||
|
|
124
|
+
signature.length !== 64 ||
|
|
125
|
+
!(await crypto_node_js_1.nodeCrypto.ed25519Verify(signer.publicKey, payload, signature))) {
|
|
126
|
+
throw new Error(`the signer for member ${fingerprint} returned a signature that does not verify over the request`);
|
|
127
|
+
}
|
|
128
|
+
signatures[fingerprint] = toHex(signature);
|
|
129
|
+
}
|
|
130
|
+
const count = Object.keys(signatures).length;
|
|
131
|
+
if (count < required) {
|
|
132
|
+
throw new customer_keys_js_1.InvalidKeyGroupError(`this request needs signatures from ${required} distinct members, got ${count}`);
|
|
133
|
+
}
|
|
134
|
+
return signatures;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=key-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-group.js","sourceRoot":"","sources":["../../src/key-group.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;;;AAEH,6CAMqB;AACrB,qDAA8C;AAC9C,yDAK4B;AAU5B,gFAAgF;AAChF,MAAM,oBAAoB,GAAG,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;AACpF,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB;;;;;;GAMG;AACH;IACW,SAAS,CAAa;IACtB,WAAW,CAAY;IAEhC,YAAoB,UAAqB;QACvC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,MAAM,IAAI,GAAG,IAAA,6BAAe,EAAC,UAAU,CAAC,CAAC,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AM,IAAA,oCAAiB,EAAC,2BAAU,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;QAC1E,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,uCAAoB,CAAC,UAAU,WAAW,oCAAoC,CAAC,CAAC;QAC5F,CAAC;QACD,IAAI,WAAW,IAAI,UAAU,EAAE,CAAC;YAC9B,MAAM,IAAI,uCAAoB,CAAC,UAAU,WAAW,oCAAoC,CAAC,CAAC;QAC5F,CAAC;QACD,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7C,IACE,CAAC,CAAC,SAAS,YAAY,UAAU,CAAC;YAClC,SAAS,CAAC,MAAM,KAAK,EAAE;YACvB,CAAC,CAAC,MAAM,2BAAU,CAAC,aAAa,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,EACvE,CAAC;YACD,MAAM,IAAI,KAAK,CACb,yBAAyB,WAAW,6DAA6D,CAClG,CAAC;QACJ,CAAC;QACD,UAAU,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,KAAK,GAAG,QAAQ,EAAE,CAAC;QACrB,MAAM,IAAI,uCAAoB,CAC5B,sCAAsC,QAAQ,0BAA0B,KAAK,EAAE,CAChF,CAAC;IACJ,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
package/dist/cjs/models.d.ts
CHANGED
|
@@ -101,6 +101,17 @@ export interface CertificateResponse {
|
|
|
101
101
|
* it can be handed straight to verifyCertificateWithStatus().
|
|
102
102
|
*/
|
|
103
103
|
readonly statusStatement: Record<string, unknown> | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Base64 AWS Nitro NSM attestation document produced while this record was
|
|
106
|
+
* signed, exactly as the server sent it. Its PCRs identify the enclave image
|
|
107
|
+
* that held the signing key and its user_data binds this record's canonical
|
|
108
|
+
* payload. Carried so it can be archived beside the record; this SDK does NOT
|
|
109
|
+
* verify it (that needs COSE ES384 and an x509 chain to the Nitro root, which
|
|
110
|
+
* only the Go verifier implements). undefined for records issued before it
|
|
111
|
+
* was recorded and for dev-mode issuance; absence is not a verification
|
|
112
|
+
* result.
|
|
113
|
+
*/
|
|
114
|
+
readonly nsmAttestation: string | undefined;
|
|
104
115
|
}
|
|
105
116
|
export interface RevocationStatus {
|
|
106
117
|
readonly certificateId: string;
|
|
@@ -260,5 +271,54 @@ export declare function parseApiKeyListItem(d: Raw): ApiKeyListItem;
|
|
|
260
271
|
export declare function parseApiKeyResponse(d: Raw): ApiKeyResponse;
|
|
261
272
|
export declare function parseProfile(d: Raw): Profile;
|
|
262
273
|
export declare function parseSystemHealth(d: Raw): SystemHealth;
|
|
274
|
+
/** The enclave's statement of which key group it was told to trust for a team
|
|
275
|
+
* (core.KeyEnrollmentStatement). Trust on first use: compare `customerKeyId` —
|
|
276
|
+
* a hash over the members and threshold — against the group you hold. The SDK's
|
|
277
|
+
* enrol and rotate calls do, after verifying the enclave's signature. */
|
|
278
|
+
export interface KeyEnrollmentStatement {
|
|
279
|
+
readonly assertedTeamId: string;
|
|
280
|
+
readonly customerKeyId: string;
|
|
281
|
+
readonly threshold: number;
|
|
282
|
+
readonly members: readonly Uint8Array[];
|
|
283
|
+
readonly enrolledAt: Date;
|
|
284
|
+
readonly enclavePcr0: string;
|
|
285
|
+
readonly signature: Uint8Array;
|
|
286
|
+
}
|
|
287
|
+
/** The bounded authority that makes an enrolled group usable
|
|
288
|
+
* (core.TeamAuthorizationCertificate). It expires rather than being revoked;
|
|
289
|
+
* renew it by enrolling the same group again before `notAfter`. */
|
|
290
|
+
export interface TeamAuthorizationCertificate {
|
|
291
|
+
readonly assertedTeamId: string;
|
|
292
|
+
readonly customerKeyId: string;
|
|
293
|
+
readonly notBefore: Date;
|
|
294
|
+
readonly notAfter: Date;
|
|
295
|
+
/** The key this one replaced; undefined on a first enrolment. */
|
|
296
|
+
readonly prevKeyId: string | undefined;
|
|
297
|
+
readonly signature: Uint8Array;
|
|
298
|
+
}
|
|
299
|
+
/** Binds one system to the config and query it may be measured with, under a
|
|
300
|
+
* customer key (core.SystemRegistrationCertificate). No expiry: it states a
|
|
301
|
+
* fact about bytes. */
|
|
302
|
+
export interface SystemRegistrationCertificate {
|
|
303
|
+
readonly systemId: string;
|
|
304
|
+
/** SHA-256 of the exact config plaintext submitted for the system. */
|
|
305
|
+
readonly configDigest: Uint8Array;
|
|
306
|
+
/** HashQuery over the NORMALIZED subject query — not the raw-template hash
|
|
307
|
+
* the registration request signs. */
|
|
308
|
+
readonly queryTemplateHash: Uint8Array;
|
|
309
|
+
readonly connectorType: string;
|
|
310
|
+
readonly customerKeyId: string;
|
|
311
|
+
readonly registeredAt: Date;
|
|
312
|
+
readonly signature: Uint8Array;
|
|
313
|
+
}
|
|
314
|
+
/** What enrolling or rotating a key group returns. */
|
|
315
|
+
export interface KeyEnrollmentResult {
|
|
316
|
+
readonly enrollment: KeyEnrollmentStatement;
|
|
317
|
+
readonly authorization: TeamAuthorizationCertificate;
|
|
318
|
+
}
|
|
319
|
+
export declare function parseKeyEnrollmentStatement(d: Raw): KeyEnrollmentStatement;
|
|
320
|
+
export declare function parseTeamAuthorizationCertificate(d: Raw): TeamAuthorizationCertificate;
|
|
321
|
+
export declare function parseSystemRegistrationCertificate(d: Raw): SystemRegistrationCertificate;
|
|
322
|
+
export declare function parseKeyEnrollmentResult(d: Raw): KeyEnrollmentResult;
|
|
263
323
|
export {};
|
|
264
324
|
//# sourceMappingURL=models.d.ts.map
|
package/dist/cjs/models.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,MAA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,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,iEAAiE;IACjE,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;CAChC;AAED;;uBAEuB;AACvB,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,sEAAsE;IACtE,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC;IAClC;yCACqC;IACrC,QAAQ,CAAC,iBAAiB,EAAE,UAAU,CAAC;IACvC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;CAChC;AAED,sDAAsD;AACtD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,UAAU,EAAE,sBAAsB,CAAC;IAC5C,QAAQ,CAAC,aAAa,EAAE,4BAA4B,CAAC;CACtD;AAuBD,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,GAAG,GAAG,sBAAsB,CAa1E;AAED,wBAAgB,iCAAiC,CAAC,CAAC,EAAE,GAAG,GAAG,4BAA4B,CAStF;AAED,wBAAgB,kCAAkC,CAAC,CAAC,EAAE,GAAG,GAAG,6BAA6B,CAUxF;AAED,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,GAAG,GAAG,mBAAmB,CAKpE"}
|
package/dist/cjs/models.js
CHANGED
|
@@ -24,6 +24,10 @@ exports.parseApiKeyListItem = parseApiKeyListItem;
|
|
|
24
24
|
exports.parseApiKeyResponse = parseApiKeyResponse;
|
|
25
25
|
exports.parseProfile = parseProfile;
|
|
26
26
|
exports.parseSystemHealth = parseSystemHealth;
|
|
27
|
+
exports.parseKeyEnrollmentStatement = parseKeyEnrollmentStatement;
|
|
28
|
+
exports.parseTeamAuthorizationCertificate = parseTeamAuthorizationCertificate;
|
|
29
|
+
exports.parseSystemRegistrationCertificate = parseSystemRegistrationCertificate;
|
|
30
|
+
exports.parseKeyEnrollmentResult = parseKeyEnrollmentResult;
|
|
27
31
|
// ---------------------------------------------------------------------------
|
|
28
32
|
// Timestamp parsing
|
|
29
33
|
// ---------------------------------------------------------------------------
|
|
@@ -109,6 +113,7 @@ function parseCertificateResponse(d) {
|
|
|
109
113
|
revocationReason: d.revocation_reason ?? undefined,
|
|
110
114
|
certificate: d.certificate,
|
|
111
115
|
statusStatement: d.status_statement ?? undefined,
|
|
116
|
+
nsmAttestation: d.nsm_attestation ?? undefined,
|
|
112
117
|
};
|
|
113
118
|
}
|
|
114
119
|
function parseRevocationStatus(d) {
|
|
@@ -273,4 +278,62 @@ function parseSystemHealth(d) {
|
|
|
273
278
|
healthError: d.health_error ?? undefined,
|
|
274
279
|
};
|
|
275
280
|
}
|
|
281
|
+
/** Go encodes [N]byte as an array of numbers; anything else here is a response
|
|
282
|
+
* this SDK cannot read, and is refused rather than coerced. */
|
|
283
|
+
function bytesFromInts(v, field, length) {
|
|
284
|
+
if (!Array.isArray(v) ||
|
|
285
|
+
v.length !== length ||
|
|
286
|
+
!v.every((b) => Number.isInteger(b) && b >= 0 && b <= 255)) {
|
|
287
|
+
throw new Error(`${field} is not ${length} bytes`);
|
|
288
|
+
}
|
|
289
|
+
return new Uint8Array(v);
|
|
290
|
+
}
|
|
291
|
+
function bytesFromBase64(v, field) {
|
|
292
|
+
if (typeof v !== "string")
|
|
293
|
+
throw new Error(`${field} is not base64`);
|
|
294
|
+
const bin = atob(v);
|
|
295
|
+
const out = new Uint8Array(bin.length);
|
|
296
|
+
for (let i = 0; i < bin.length; i++)
|
|
297
|
+
out[i] = bin.charCodeAt(i);
|
|
298
|
+
return out;
|
|
299
|
+
}
|
|
300
|
+
function parseKeyEnrollmentStatement(d) {
|
|
301
|
+
const group = (d.group ?? {});
|
|
302
|
+
return {
|
|
303
|
+
assertedTeamId: d.asserted_team_id,
|
|
304
|
+
customerKeyId: d.customer_key_id,
|
|
305
|
+
threshold: group.threshold,
|
|
306
|
+
members: (group.members ?? []).map((m, i) => bytesFromBase64(m, `enrollment.group.members[${i}]`)),
|
|
307
|
+
enrolledAt: parseDt(d.enrolled_at),
|
|
308
|
+
enclavePcr0: d.enclave_pcr0,
|
|
309
|
+
signature: bytesFromInts(d.signature, "enrollment.signature", 64),
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
function parseTeamAuthorizationCertificate(d) {
|
|
313
|
+
return {
|
|
314
|
+
assertedTeamId: d.asserted_team_id,
|
|
315
|
+
customerKeyId: d.customer_key_id,
|
|
316
|
+
notBefore: parseDt(d.not_before),
|
|
317
|
+
notAfter: parseDt(d.not_after),
|
|
318
|
+
prevKeyId: d.prev_key_id || undefined,
|
|
319
|
+
signature: bytesFromInts(d.signature, "authorization.signature", 64),
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
function parseSystemRegistrationCertificate(d) {
|
|
323
|
+
return {
|
|
324
|
+
systemId: d.system_id,
|
|
325
|
+
configDigest: bytesFromInts(d.config_digest, "registration.config_digest", 32),
|
|
326
|
+
queryTemplateHash: bytesFromInts(d.query_template_hash, "registration.query_template_hash", 32),
|
|
327
|
+
connectorType: d.connector_type,
|
|
328
|
+
customerKeyId: d.customer_key_id,
|
|
329
|
+
registeredAt: parseDt(d.registered_at),
|
|
330
|
+
signature: bytesFromInts(d.signature, "registration.signature", 64),
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
function parseKeyEnrollmentResult(d) {
|
|
334
|
+
return {
|
|
335
|
+
enrollment: parseKeyEnrollmentStatement(d.enrollment ?? {}),
|
|
336
|
+
authorization: parseTeamAuthorizationCertificate(d.authorization ?? {}),
|
|
337
|
+
};
|
|
338
|
+
}
|
|
276
339
|
//# sourceMappingURL=models.js.map
|
package/dist/cjs/models.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;AA8VH,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E,SAAS,OAAO,CAAC,GAAW;IAC1B,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC;AAED,SAAS,UAAU,CAAC,GAA8B;IAChD,IAAI,GAAG,IAAI,IAAI;QAAE,OAAO,SAAS,CAAC;IAClC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;AACtB,CAAC;AASD,qBAA4B,CAAM;IAChC,OAAO;QACL,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,aAAa,EAAE,CAAC,CAAC,cAA+B;QAChD,YAAY,EAAE,CAAC,CAAC,aAAa;QAC7B,SAAS,EAAE,CAAC,CAAC,UAAuB;QACpC,UAAU,EAAE,CAAC,CAAC,WAAW;QACzB,QAAQ,EAAE,CAAC,CAAC,SAAS;QACrB,YAAY,EAAE,CAAC,CAAC,aAAa;QAC7B,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;QAChC,YAAY,EAAE,CAAC,CAAC,CAAC,aAAa,IAAI,SAAS,CAAiB;QAC5D,eAAe,EAAE,UAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC;QAChD,WAAW,EAAE,CAAC,CAAC,YAAY,IAAI,SAAS;QACxC,yEAAyE;QACzE,kDAAkD;QAClD,iBAAiB,EAAE,CAAC,CAAC,CAAC,kBAAkB,IAAI,SAAS,CAAsB;QAC3E,yEAAyE;QACzE,sEAAsE;QACtE,+BAA+B;QAC/B,UAAU,EAAE,CAAC,CAAC,YAAY,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EAAE,aAAa,CAAC,CAAC,CAAC,SAAS,EAAE,yBAAyB,EAAE,EAAE,CAAC;KACrE,CAAC;AACJ,CAAC;AAED,4CAAmD,CAAM;IACvD,OAAO;QACL,QAAQ,EAAE,CAAC,CAAC,SAAS;QACrB,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC,aAAa,EAAE,4BAA4B,EAAE,EAAE,CAAC;QAC9E,iBAAiB,EAAE,aAAa,CAAC,CAAC,CAAC,mBAAmB,EAAE,kCAAkC,EAAE,EAAE,CAAC;QAC/F,aAAa,EAAE,CAAC,CAAC,cAAc;QAC/B,aAAa,EAAE,CAAC,CAAC,eAAe;QAChC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC;QACtC,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,SAAS,EAAE,wBAAwB,EAAE,EAAE,CAAC;KACpE,CAAC;AACJ,CAAC;AAED,kCAAyC,CAAM;IAC7C,OAAO;QACL,UAAU,EAAE,2BAA2B,CAAC,CAAC,CAAC,UAAU,IAAI,EAAE,CAAC;QAC3D,aAAa,EAAE,iCAAiC,CAAC,CAAC,CAAC,aAAa,IAAI,EAAE,CAAC;KACxE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Reading a status statement as the status endpoint serves it, before anything
|
|
2
|
+
* verifies it. Shared by the CLI and the /verify page's status button, so the two
|
|
3
|
+
* agree on what counts as a statement: an answer that is not one is silence
|
|
4
|
+
* about revocation, while a statement that is one and fails is a refusal. */
|
|
5
|
+
type StatusStatement = Record<string, unknown>;
|
|
6
|
+
/** The API wraps every response in {"data": ...}; a caller may hand over either
|
|
7
|
+
* the envelope or the document inside it. Mirrors
|
|
8
|
+
* core.ParseCertificateStatusDocument, so this CLI and the Go one cannot
|
|
9
|
+
* disagree about which shape the endpoint returns. Exported for testing.
|
|
10
|
+
*
|
|
11
|
+
* A document that does not parse THROWS, and the caller turns that into a
|
|
12
|
+
* warning and a VALID_REVOCATION_UNKNOWN verdict. That is deliberate: an answer
|
|
13
|
+
* this build cannot read is silence about revocation, not a finding about the
|
|
14
|
+
* certificate. Handing a half-read document to the verifier instead would
|
|
15
|
+
* report "status statement signature is invalid" — a claim about the issuer —
|
|
16
|
+
* when what actually happened is that something returned nonsense.
|
|
17
|
+
*
|
|
18
|
+
* `status` itself is NOT validated against a known set. A statement saying
|
|
19
|
+
* SUSPENDED is a statement this build cannot read, and the verifier already has
|
|
20
|
+
* the right answer for that: it authenticates the signature first, then reports
|
|
21
|
+
* VALID_REVOCATION_UNKNOWN. Refusing it here would discard the statement before
|
|
22
|
+
* anyone authenticated it. */
|
|
23
|
+
export declare function unwrapStatusStatement(parsed: unknown): StatusStatement;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=status-document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-document.d.ts","sourceRoot":"","sources":["../../src/status-document.ts"],"names":[],"mappings":"AAAA;;;6EAG6E;AAE7E,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE/C;;;;;;;;;;;;;;;;8BAgB8B;AAC9B,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,eAAe,CAoBtE"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Reading a status statement as the status endpoint serves it, before anything
|
|
3
|
+
* verifies it. Shared by the CLI and the /verify page's status button, so the two
|
|
4
|
+
* agree on what counts as a statement: an answer that is not one is silence
|
|
5
|
+
* about revocation, while a statement that is one and fails is a refusal. */
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.unwrapStatusStatement = unwrapStatusStatement;
|
|
8
|
+
/** The API wraps every response in {"data": ...}; a caller may hand over either
|
|
9
|
+
* the envelope or the document inside it. Mirrors
|
|
10
|
+
* core.ParseCertificateStatusDocument, so this CLI and the Go one cannot
|
|
11
|
+
* disagree about which shape the endpoint returns. Exported for testing.
|
|
12
|
+
*
|
|
13
|
+
* A document that does not parse THROWS, and the caller turns that into a
|
|
14
|
+
* warning and a VALID_REVOCATION_UNKNOWN verdict. That is deliberate: an answer
|
|
15
|
+
* this build cannot read is silence about revocation, not a finding about the
|
|
16
|
+
* certificate. Handing a half-read document to the verifier instead would
|
|
17
|
+
* report "status statement signature is invalid" — a claim about the issuer —
|
|
18
|
+
* when what actually happened is that something returned nonsense.
|
|
19
|
+
*
|
|
20
|
+
* `status` itself is NOT validated against a known set. A statement saying
|
|
21
|
+
* SUSPENDED is a statement this build cannot read, and the verifier already has
|
|
22
|
+
* the right answer for that: it authenticates the signature first, then reports
|
|
23
|
+
* VALID_REVOCATION_UNKNOWN. Refusing it here would discard the statement before
|
|
24
|
+
* anyone authenticated it. */
|
|
25
|
+
function unwrapStatusStatement(parsed) {
|
|
26
|
+
if (parsed === null || typeof parsed !== "object") {
|
|
27
|
+
throw new Error("status statement: response is not a JSON object");
|
|
28
|
+
}
|
|
29
|
+
let doc = parsed;
|
|
30
|
+
if (doc.certificate_id === undefined && doc.data !== null && typeof doc.data === "object") {
|
|
31
|
+
doc = doc.data;
|
|
32
|
+
}
|
|
33
|
+
for (const f of ["certificate_id", "status", "key_id"]) {
|
|
34
|
+
if (typeof doc[f] !== "string" || doc[f] === "")
|
|
35
|
+
throw new Error(`status statement: ${f} is missing`);
|
|
36
|
+
}
|
|
37
|
+
for (const f of ["statement_issued_at", "statement_expires_at"])
|
|
38
|
+
requireRfc3339(doc, f);
|
|
39
|
+
if (doc.revoked_at != null)
|
|
40
|
+
requireRfc3339(doc, "revoked_at");
|
|
41
|
+
if (typeof doc.sth_tree_size !== "number")
|
|
42
|
+
throw new Error("status statement: sth_tree_size is not a number");
|
|
43
|
+
// Refuse a short or long value rather than letting it through: a truncated
|
|
44
|
+
// signature or root hash that reaches the verifier is checked against bytes
|
|
45
|
+
// nobody sent.
|
|
46
|
+
requireHex(doc, "sth_root_hash", 32);
|
|
47
|
+
requireHex(doc, "signature", 64);
|
|
48
|
+
return doc;
|
|
49
|
+
}
|
|
50
|
+
function requireRfc3339(doc, field) {
|
|
51
|
+
const v = doc[field];
|
|
52
|
+
if (typeof v !== "string" || Number.isNaN(Date.parse(v))) {
|
|
53
|
+
throw new Error(`status statement: ${field} is not RFC 3339`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function requireHex(doc, field, bytes) {
|
|
57
|
+
const v = doc[field];
|
|
58
|
+
if (typeof v !== "string" || !new RegExp(`^[0-9a-fA-F]{${bytes * 2}}$`).test(v)) {
|
|
59
|
+
throw new Error(`status statement: ${field} is not ${bytes} bytes of hex`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=status-document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-document.js","sourceRoot":"","sources":["../../src/status-document.ts"],"names":[],"mappings":";AAAA;;;6EAG6E;;;AAI7E;;;;;;;;;;;;;;;;8BAgB8B;AAC9B,+BAAsC,MAAe;IACnD,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IACD,IAAI,GAAG,GAAG,MAAyB,CAAC;IACpC,IAAI,GAAG,CAAC,cAAc,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC1F,GAAG,GAAG,GAAG,CAAC,IAAuB,CAAC;IACpC,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC;QACvD,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE;YAAE,MAAM,IAAI,KAA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ify.d.ts
CHANGED
|
@@ -28,6 +28,9 @@ import type { TransparencyResult, VerificationResult } from "./models.js";
|
|
|
28
28
|
* script on the page could otherwise push a version onto it.
|
|
29
29
|
*/
|
|
30
30
|
export declare const KNOWN_FORMAT_VERSIONS: readonly string[];
|
|
31
|
+
/** Decode hex: whole bytes, digits in either case, nothing else. Anything else
|
|
32
|
+
* throws TypeError. It is exported, so its input is a boundary: reading a stray
|
|
33
|
+
* character as 0, as it once did, turned a typo into different bytes. */
|
|
31
34
|
export declare function hexToBytes(hex: string): Uint8Array;
|
|
32
35
|
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
33
36
|
/** A signing key's disposition (ADR-017 §1).
|
|
@@ -110,8 +113,90 @@ export declare function evaluateKey(pki: PublicKeyInfo, anchor: number | null):
|
|
|
110
113
|
*/
|
|
111
114
|
export declare function certificateAnchor(certificate: Record<string, unknown>): number | null;
|
|
112
115
|
type Cert = Record<string, unknown>;
|
|
116
|
+
/**
|
|
117
|
+
* Require what ADR-025 lets a record prove: that a key group you name signed the
|
|
118
|
+
* registration the enclave checked each system against before measuring it.
|
|
119
|
+
*
|
|
120
|
+
* A pass means each required system is `certified` under one of
|
|
121
|
+
* `customerKeyIds`, in a record from an enclave image of wire protocol 12 or
|
|
122
|
+
* later — the first that registers a system only with that key group's
|
|
123
|
+
* signatures. A record from an earlier image (PRE_PROTOCOL_12_IMAGES), or one
|
|
124
|
+
* that names no image, fails: those images could say `certified` with no
|
|
125
|
+
* customer signature at all.
|
|
126
|
+
*
|
|
127
|
+
* Off unless asked for, because a record that says `authorization: none` is
|
|
128
|
+
* still a genuine record. Whoever relays requests to the enclave can always
|
|
129
|
+
* leave a registration out (ADR-025 §5, §8), and the enclave cannot refuse that
|
|
130
|
+
* for want of durable state. So "my systems must be certified" can be enforced
|
|
131
|
+
* in one place only: here, by the party relying on the record.
|
|
132
|
+
*/
|
|
133
|
+
export interface AuthorizationPolicy {
|
|
134
|
+
/** The system_ids that must be certified. Omitted: every system the record covers. */
|
|
135
|
+
readonly systems?: readonly string[];
|
|
136
|
+
/**
|
|
137
|
+
* The key groups you accept. Required: `certified` under a key id you did not
|
|
138
|
+
* name proves nothing to you, because the relay can enroll a key group of its
|
|
139
|
+
* own and the record would name that one.
|
|
140
|
+
*/
|
|
141
|
+
readonly customerKeyIds: readonly string[];
|
|
142
|
+
}
|
|
143
|
+
export interface VerifyOptions {
|
|
144
|
+
/**
|
|
145
|
+
* Refuse the record, with a VerificationError whose code is
|
|
146
|
+
* AUTHORIZATION_POLICY_FAILED, unless it meets this policy. Omitted: no
|
|
147
|
+
* requirement, and `authorization: none` verifies as it always has.
|
|
148
|
+
*/
|
|
149
|
+
readonly requireAuthorization?: AuthorizationPolicy;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The enclave images that issued format 9.0 while running wire protocol 11 or
|
|
153
|
+
* earlier, by PCR0, as the published measurement history records them
|
|
154
|
+
* (website/docs/enclave-measurements/, docs/CONNECTOR-STATUS.md).
|
|
155
|
+
*
|
|
156
|
+
* Their `certified` is not evidence of a customer signature. Before protocol 12
|
|
157
|
+
* the enclave enrolled a key group with no proof that anyone held its keys, and
|
|
158
|
+
* registered a system for whoever relayed the authorization — so the host could
|
|
159
|
+
* make a genuine 9.0 record say `certified`, under a key id it chose, with no
|
|
160
|
+
* customer signature anywhere (reproduced by an independent re-review,
|
|
161
|
+
* 2026-09-13).
|
|
162
|
+
*
|
|
163
|
+
* THE SET IS CLOSED BY POLICY, NOT BY ENFORCEMENT: the release runbook forbids
|
|
164
|
+
* admitting or rolling back to an image of protocol 11 or earlier once any
|
|
165
|
+
* customer key is enrolled, and admitting one takes a KMS re-pin, which ADR-027
|
|
166
|
+
* leaves to the owner. The protocol-12 cutover's KMS tighten drops every
|
|
167
|
+
* measurement here from the signing key's policy, after which none of them can
|
|
168
|
+
* sign. v42 ran for seven minutes and is recorded as issuing nothing; it is here
|
|
169
|
+
* because it held the signing key while it ran.
|
|
170
|
+
*
|
|
171
|
+
* The Python SDK carries the same list, in _verify.py.
|
|
172
|
+
*/
|
|
173
|
+
export declare const PRE_PROTOCOL_12_IMAGES: ReadonlyMap<string, string>;
|
|
174
|
+
/**
|
|
175
|
+
* What a record's signed issuer.enclave_pcr0 makes of `certified`: whether the
|
|
176
|
+
* image that signed it could mark a system certified without the customer's
|
|
177
|
+
* signature. "protocol-12-or-later" is the inference the closed list licenses:
|
|
178
|
+
* a genuine 9.0 record under any other measurement was signed by a later image.
|
|
179
|
+
*/
|
|
180
|
+
export type IssuingImage = {
|
|
181
|
+
readonly kind: "unnamed";
|
|
182
|
+
} | {
|
|
183
|
+
readonly kind: "before-protocol-12";
|
|
184
|
+
readonly name: string;
|
|
185
|
+
readonly pcr0: string;
|
|
186
|
+
} | {
|
|
187
|
+
readonly kind: "protocol-12-or-later";
|
|
188
|
+
readonly pcr0: string;
|
|
189
|
+
};
|
|
190
|
+
export declare function issuingImage(certificate: Cert): IssuingImage;
|
|
191
|
+
/**
|
|
192
|
+
* What `certified` is evidence of, given the image that signed the record: the
|
|
193
|
+
* words every verifier prints after "certified under <key id> —". The Go CLI
|
|
194
|
+
* (cmd/cli/registration_image.go), both SDK CLIs and the /verify page state it
|
|
195
|
+
* identically, and testdata/registration_line_cases.json holds them to it.
|
|
196
|
+
*/
|
|
197
|
+
export declare function registrationQualifier(image: IssuingImage): string;
|
|
113
198
|
/** Verify all signatures on a deletion certificate offline. */
|
|
114
|
-
export declare function verifyCertificate(crypto: CryptoOps, certificate: Cert, publicKeys: Map<string, PublicKeyInfo
|
|
199
|
+
export declare function verifyCertificate(crypto: CryptoOps, certificate: Cert, publicKeys: Map<string, PublicKeyInfo>, options?: VerifyOptions): Promise<VerificationResult>;
|
|
115
200
|
/** Verify the transparency proof embedded in a certificate. */
|
|
116
201
|
export declare function verifyTransparency(crypto: CryptoOps, certificate: Cert, publicKeys: Map<string, PublicKeyInfo>): Promise<TransparencyResult>;
|
|
117
202
|
/** Reconstruct the certificate JSON as it existed at issuance time.
|
|
@@ -125,6 +210,10 @@ export declare function verifyTransparency(crypto: CryptoOps, certificate: Cert,
|
|
|
125
210
|
* verification (#C-01).
|
|
126
211
|
*/
|
|
127
212
|
export declare function issuanceBytes(certificate: Cert): Uint8Array;
|
|
213
|
+
/** Exported for tests/verify.test.ts, which keeps a second implementation of
|
|
214
|
+
* this and must be able to prove the two agree. Not re-exported from index.ts,
|
|
215
|
+
* so it stays off the published API. */
|
|
216
|
+
export declare function canonicalJson(obj: unknown): Uint8Array;
|
|
128
217
|
/** Normalize a certificate timestamp to the UTC form Go signs.
|
|
129
218
|
*
|
|
130
219
|
* Go builds every payload timestamp as `t.UTC().Format("2006-01-02T15:04:05Z")`
|
|
@@ -145,8 +234,11 @@ export declare function issuanceBytes(certificate: Cert): Uint8Array;
|
|
|
145
234
|
* Exported from this module so the timestamp_vectors.json suite can diff it
|
|
146
235
|
* against Go directly. It is deliberately not re-exported from index.ts, so it
|
|
147
236
|
* is not part of the published package surface.
|
|
237
|
+
*
|
|
238
|
+
* `field` names the value in a refusal. It defaults to the word these messages
|
|
239
|
+
* always used, for callers normalizing a time that is not a field of a document.
|
|
148
240
|
*/
|
|
149
|
-
export declare function formatTimestamp(ts: unknown): string;
|
|
241
|
+
export declare function formatTimestamp(ts: unknown, field?: string): string;
|
|
150
242
|
/**
|
|
151
243
|
* Port of Go's BuildTreeHeadPayload.
|
|
152
244
|
*
|
|
@@ -207,7 +299,24 @@ export declare const VALID_REVOCATION_UNKNOWN = "VALID_REVOCATION_UNKNOWN";
|
|
|
207
299
|
*
|
|
208
300
|
* The third row is the point: `verifyCertificate` answers VALID there, which
|
|
209
301
|
* reads as "not revoked" and is not something it checked.
|
|
302
|
+
*
|
|
303
|
+
* `options` is passed to {@link verifyCertificate} unchanged.
|
|
304
|
+
*/
|
|
305
|
+
export declare function verifyCertificateWithStatus(crypto: CryptoOps, certificate: Cert, publicKeys: Map<string, PublicKeyInfo>, status?: Record<string, unknown> | null, now?: Date, options?: VerifyOptions): Promise<string>;
|
|
306
|
+
/**
|
|
307
|
+
* The statement half of {@link verifyCertificateWithStatus}: authenticate a
|
|
308
|
+
* status statement about `certificateId` against the published keys, and read
|
|
309
|
+
* it at `now`. The /verify page's QR lookup has a record id and no record, and
|
|
310
|
+
* uses this so it shows what a signed, fresh statement says, never what the
|
|
311
|
+
* status endpoint claims.
|
|
312
|
+
*
|
|
313
|
+
* | input | result |
|
|
314
|
+
* |---|---|
|
|
315
|
+
* | fresh, REVOKED | throws VerificationError, code CERTIFICATE_REVOKED |
|
|
316
|
+
* | fresh, ACTIVE | the statement key's verdict: `"VALID"`, or a soft one |
|
|
317
|
+
* | stale, or a status this SDK does not know | `"VALID_REVOCATION_UNKNOWN"` |
|
|
318
|
+
* | unknown or unusable key, bad signature, another certificate | throws VerificationError |
|
|
210
319
|
*/
|
|
211
|
-
export declare function
|
|
320
|
+
export declare function verifyStatusStatement(crypto: CryptoOps, status: Record<string, unknown>, publicKeys: Map<string, PublicKeyInfo>, certificateId: unknown, now?: Date): Promise<string>;
|
|
212
321
|
export {};
|
|
213
322
|
//# sourceMappingURL=verify.d.ts.map
|