burnledger 0.7.0 → 0.8.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/cjs/customer-keys.d.ts +74 -0
- package/dist/cjs/customer-keys.d.ts.map +1 -0
- package/dist/cjs/customer-keys.js +139 -0
- package/dist/cjs/customer-keys.js.map +1 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +11 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/verify.d.ts +4 -0
- package/dist/cjs/verify.d.ts.map +1 -1
- package/dist/cjs/verify.js +73 -0
- package/dist/cjs/verify.js.map +1 -1
- package/dist/cjs/web-verifier.d.ts +13 -0
- package/dist/cjs/web-verifier.d.ts.map +1 -1
- package/dist/cjs/web-verifier.js +2 -1
- package/dist/cjs/web-verifier.js.map +1 -1
- package/dist/esm/cli.d.ts.map +1 -1
- package/dist/esm/cli.js +71 -2
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/customer-keys.d.ts +74 -0
- package/dist/esm/customer-keys.d.ts.map +1 -0
- package/dist/esm/customer-keys.js +130 -0
- package/dist/esm/customer-keys.js.map +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/verify.d.ts +4 -0
- package/dist/esm/verify.d.ts.map +1 -1
- package/dist/esm/verify.js +73 -1
- package/dist/esm/verify.js.map +1 -1
- package/dist/esm/web-verifier.d.ts +13 -0
- package/dist/esm/web-verifier.d.ts.map +1 -1
- package/dist/esm/web-verifier.js +13 -1
- package/dist/esm/web-verifier.js.map +1 -1
- package/package.json +2 -2
- package/src/cli.ts +85 -1
- package/src/customer-keys.ts +180 -0
- package/src/index.ts +13 -0
- package/src/verify.ts +84 -1
- package/src/web-verifier.ts +14 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Customer key groups (ADR-025 §2), computed on the customer's own machine.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS IS CLIENT-SIDE AND NOT AN API CALL. The private halves never leave
|
|
5
|
+
* the customer's machines -- that is the entire point of the mechanism. What a
|
|
6
|
+
* customer needs from us is not a service that computes their key id, but the
|
|
7
|
+
* ability to compute it themselves and compare it against the id the enclave
|
|
8
|
+
* signed. An id returned over HTTP would be an id the parent could choose, and
|
|
9
|
+
* the one comparison this design rests on would be checking our answer against
|
|
10
|
+
* our answer.
|
|
11
|
+
*
|
|
12
|
+
* WHY IT MUST MATCH GO EXACTLY. `customer_key_id` is derived independently by
|
|
13
|
+
* the enclave and by the customer. If the two derivations disagree by so much
|
|
14
|
+
* as a JSON separator, enrollment SUCCEEDS, the enclave signs a statement
|
|
15
|
+
* naming an id, and the customer's comparison fails -- indistinguishable, from
|
|
16
|
+
* where they are standing, from a parent having substituted their key. Every
|
|
17
|
+
* expectation in tests/customer-key-parity.test.ts comes from a corpus the Go
|
|
18
|
+
* generator writes by calling core itself.
|
|
19
|
+
*/
|
|
20
|
+
import type { CryptoOps } from "./crypto.js";
|
|
21
|
+
/**
|
|
22
|
+
* Mirrors core.CustomerKeyIDPrefix. It distinguishes a customer's key id from
|
|
23
|
+
* an issuer key id, which are otherwise the same shape and would be confusable
|
|
24
|
+
* in a log line at exactly the wrong moment.
|
|
25
|
+
*/
|
|
26
|
+
export declare const CUSTOMER_KEY_ID_PREFIX = "cust_k_";
|
|
27
|
+
export declare const PAYLOAD_TYPE_KEY_ROTATION_REQUEST = "burnledger.key_rotation_request.v1";
|
|
28
|
+
/** Mirrors core.MaxCustomerKeyGroupMembers. */
|
|
29
|
+
export declare const MAX_CUSTOMER_KEY_GROUP_MEMBERS = 16;
|
|
30
|
+
/** A group that cannot be enrolled, for a reason stated in the message. */
|
|
31
|
+
export declare class InvalidKeyGroupError extends Error {
|
|
32
|
+
constructor(message: string);
|
|
33
|
+
}
|
|
34
|
+
export interface CustomerKeyGroup {
|
|
35
|
+
/** How many distinct members must sign. 1 <= threshold <= members.length. */
|
|
36
|
+
threshold: number;
|
|
37
|
+
/**
|
|
38
|
+
* The enrolled public keys. Order is not significant: the id sorts the
|
|
39
|
+
* fingerprints, so two customers who list the same keys in a different order
|
|
40
|
+
* enrol the same group rather than two indistinguishable ones.
|
|
41
|
+
*/
|
|
42
|
+
members: Uint8Array[];
|
|
43
|
+
}
|
|
44
|
+
/** hex(SHA-256(public key)) -- a member's identity inside a group. */
|
|
45
|
+
export declare function memberFingerprint(crypto: CryptoOps, publicKey: Uint8Array): Promise<string>;
|
|
46
|
+
/** Throws InvalidKeyGroupError unless this group could ever be used. */
|
|
47
|
+
export declare function validateKeyGroup(crypto: CryptoOps, group: CustomerKeyGroup): Promise<void>;
|
|
48
|
+
/** The members' fingerprints, sorted, so the id does not depend on order. */
|
|
49
|
+
export declare function memberFingerprints(crypto: CryptoOps, group: CustomerKeyGroup): Promise<string[]>;
|
|
50
|
+
/**
|
|
51
|
+
* The id the enclave will compute for this group.
|
|
52
|
+
*
|
|
53
|
+
* Throws rather than returning an id for a group that could never be enrolled:
|
|
54
|
+
* an id for an unusable group is a value a caller would go on to compare
|
|
55
|
+
* against, and it would never match anything.
|
|
56
|
+
*/
|
|
57
|
+
export declare function customerKeyId(crypto: CryptoOps, group: CustomerKeyGroup): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* The canonical bytes the OUTGOING group's members sign to authorise a rotation.
|
|
60
|
+
*
|
|
61
|
+
* This is the only payload in the scheme signed by the customer rather than by
|
|
62
|
+
* the enclave, so it is the only one where a signature captured elsewhere could
|
|
63
|
+
* be replayed into the mechanism -- hence its own payload type.
|
|
64
|
+
*
|
|
65
|
+
* Both ids are bound, not just the successor: a statement naming only the
|
|
66
|
+
* incoming key could be lifted onto a different predecessor, re-presenting the
|
|
67
|
+
* same signatures as though another group had approved it.
|
|
68
|
+
*/
|
|
69
|
+
export declare function buildKeyRotationRequestPayload(request: {
|
|
70
|
+
assertedTeamId: string;
|
|
71
|
+
prevKeyId: string;
|
|
72
|
+
nextKeyId: string;
|
|
73
|
+
}): Uint8Array;
|
|
74
|
+
//# sourceMappingURL=customer-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customer-keys.d.ts","sourceRoot":"","sources":["../../src/customer-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAShD,eAAO,MAAM,iCAAiC,uCAAuC,CAAC;AAEtF,+CAA+C;AAC/C,eAAO,MAAM,8BAA8B,KAAK,CAAC;AAIjD,2EAA2E;AAC3E,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,MAAM,WAAW,gBAAgB;IAC/B,6EAA6E;IAC7E,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,OAAO,EAAE,UAAU,EAAE,CAAC;CACvB;AAMD,sEAAsE;AACtE,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,UAAU,GACpB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wEAAwE;AACxE,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAAC,IAAI,CAAC,CAkCf;AAED,6EAA6E;AAC7E,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAAC,MAAM,EAAE,CAAC,CAMnB;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAAC,MAAM,CAAC,CAQjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE;IACtD,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,UAAU,CAiBb"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Customer key groups (ADR-025 §2), computed on the customer's own machine.
|
|
4
|
+
*
|
|
5
|
+
* WHY THIS IS CLIENT-SIDE AND NOT AN API CALL. The private halves never leave
|
|
6
|
+
* the customer's machines -- that is the entire point of the mechanism. What a
|
|
7
|
+
* customer needs from us is not a service that computes their key id, but the
|
|
8
|
+
* ability to compute it themselves and compare it against the id the enclave
|
|
9
|
+
* signed. An id returned over HTTP would be an id the parent could choose, and
|
|
10
|
+
* the one comparison this design rests on would be checking our answer against
|
|
11
|
+
* our answer.
|
|
12
|
+
*
|
|
13
|
+
* WHY IT MUST MATCH GO EXACTLY. `customer_key_id` is derived independently by
|
|
14
|
+
* the enclave and by the customer. If the two derivations disagree by so much
|
|
15
|
+
* as a JSON separator, enrollment SUCCEEDS, the enclave signs a statement
|
|
16
|
+
* naming an id, and the customer's comparison fails -- indistinguishable, from
|
|
17
|
+
* where they are standing, from a parent having substituted their key. Every
|
|
18
|
+
* expectation in tests/customer-key-parity.test.ts comes from a corpus the Go
|
|
19
|
+
* generator writes by calling core itself.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.InvalidKeyGroupError = exports.MAX_CUSTOMER_KEY_GROUP_MEMBERS = exports.PAYLOAD_TYPE_KEY_ROTATION_REQUEST = exports.CUSTOMER_KEY_ID_PREFIX = void 0;
|
|
23
|
+
exports.memberFingerprint = memberFingerprint;
|
|
24
|
+
exports.validateKeyGroup = validateKeyGroup;
|
|
25
|
+
exports.memberFingerprints = memberFingerprints;
|
|
26
|
+
exports.customerKeyId = customerKeyId;
|
|
27
|
+
exports.buildKeyRotationRequestPayload = buildKeyRotationRequestPayload;
|
|
28
|
+
const verify_js_1 = require("./verify.js");
|
|
29
|
+
/**
|
|
30
|
+
* Mirrors core.CustomerKeyIDPrefix. It distinguishes a customer's key id from
|
|
31
|
+
* an issuer key id, which are otherwise the same shape and would be confusable
|
|
32
|
+
* in a log line at exactly the wrong moment.
|
|
33
|
+
*/
|
|
34
|
+
exports.CUSTOMER_KEY_ID_PREFIX = "cust_k_";
|
|
35
|
+
/**
|
|
36
|
+
* Mirrors core.payloadTypeCustomerKeyGroup. Unexported in Go because it is
|
|
37
|
+
* never signed or transmitted -- only hashed -- but it IS inside the hash, so a
|
|
38
|
+
* reimplementation that omits it computes a different id for every group.
|
|
39
|
+
*/
|
|
40
|
+
const PAYLOAD_TYPE_CUSTOMER_KEY_GROUP = "burnledger.customer_key_group.v1";
|
|
41
|
+
exports.PAYLOAD_TYPE_KEY_ROTATION_REQUEST = "burnledger.key_rotation_request.v1";
|
|
42
|
+
/** Mirrors core.MaxCustomerKeyGroupMembers. */
|
|
43
|
+
exports.MAX_CUSTOMER_KEY_GROUP_MEMBERS = 16;
|
|
44
|
+
const ED25519_PUBLIC_KEY_SIZE = 32;
|
|
45
|
+
/** A group that cannot be enrolled, for a reason stated in the message. */
|
|
46
|
+
class InvalidKeyGroupError extends Error {
|
|
47
|
+
constructor(message) {
|
|
48
|
+
super(message);
|
|
49
|
+
this.name = "InvalidKeyGroupError";
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.InvalidKeyGroupError = InvalidKeyGroupError;
|
|
53
|
+
function toHex(bytes) {
|
|
54
|
+
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
55
|
+
}
|
|
56
|
+
/** hex(SHA-256(public key)) -- a member's identity inside a group. */
|
|
57
|
+
async function memberFingerprint(crypto, publicKey) {
|
|
58
|
+
return toHex(await crypto.sha256(publicKey));
|
|
59
|
+
}
|
|
60
|
+
/** Throws InvalidKeyGroupError unless this group could ever be used. */
|
|
61
|
+
async function validateKeyGroup(crypto, group) {
|
|
62
|
+
if (group.members.length === 0) {
|
|
63
|
+
throw new InvalidKeyGroupError("a customer key group needs at least one member");
|
|
64
|
+
}
|
|
65
|
+
if (group.members.length > exports.MAX_CUSTOMER_KEY_GROUP_MEMBERS) {
|
|
66
|
+
throw new InvalidKeyGroupError(`a customer key group may have at most ${exports.MAX_CUSTOMER_KEY_GROUP_MEMBERS} members, ` +
|
|
67
|
+
`got ${group.members.length}`);
|
|
68
|
+
}
|
|
69
|
+
if (!Number.isInteger(group.threshold) ||
|
|
70
|
+
group.threshold < 1 ||
|
|
71
|
+
group.threshold > group.members.length) {
|
|
72
|
+
throw new InvalidKeyGroupError(`threshold ${group.threshold} is not between 1 and the ${group.members.length} members`);
|
|
73
|
+
}
|
|
74
|
+
const seen = new Set();
|
|
75
|
+
for (const member of group.members) {
|
|
76
|
+
if (member.length !== ED25519_PUBLIC_KEY_SIZE) {
|
|
77
|
+
throw new InvalidKeyGroupError(`every member must be a ${ED25519_PUBLIC_KEY_SIZE}-byte Ed25519 key`);
|
|
78
|
+
}
|
|
79
|
+
const fingerprint = await memberFingerprint(crypto, member);
|
|
80
|
+
if (seen.has(fingerprint)) {
|
|
81
|
+
// A repeated member would let one holder satisfy a threshold meant to
|
|
82
|
+
// require several, which is the entire point of one.
|
|
83
|
+
throw new InvalidKeyGroupError("the same member key is listed twice");
|
|
84
|
+
}
|
|
85
|
+
seen.add(fingerprint);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** The members' fingerprints, sorted, so the id does not depend on order. */
|
|
89
|
+
async function memberFingerprints(crypto, group) {
|
|
90
|
+
const out = [];
|
|
91
|
+
for (const member of group.members) {
|
|
92
|
+
out.push(await memberFingerprint(crypto, member));
|
|
93
|
+
}
|
|
94
|
+
return out.sort();
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The id the enclave will compute for this group.
|
|
98
|
+
*
|
|
99
|
+
* Throws rather than returning an id for a group that could never be enrolled:
|
|
100
|
+
* an id for an unusable group is a value a caller would go on to compare
|
|
101
|
+
* against, and it would never match anything.
|
|
102
|
+
*/
|
|
103
|
+
async function customerKeyId(crypto, group) {
|
|
104
|
+
await validateKeyGroup(crypto, group);
|
|
105
|
+
const document = {
|
|
106
|
+
member_key_ids: await memberFingerprints(crypto, group),
|
|
107
|
+
payload_type: PAYLOAD_TYPE_CUSTOMER_KEY_GROUP,
|
|
108
|
+
threshold: group.threshold,
|
|
109
|
+
};
|
|
110
|
+
return exports.CUSTOMER_KEY_ID_PREFIX + toHex(await crypto.sha256((0, verify_js_1.canonicalJson)(document)));
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The canonical bytes the OUTGOING group's members sign to authorise a rotation.
|
|
114
|
+
*
|
|
115
|
+
* This is the only payload in the scheme signed by the customer rather than by
|
|
116
|
+
* the enclave, so it is the only one where a signature captured elsewhere could
|
|
117
|
+
* be replayed into the mechanism -- hence its own payload type.
|
|
118
|
+
*
|
|
119
|
+
* Both ids are bound, not just the successor: a statement naming only the
|
|
120
|
+
* incoming key could be lifted onto a different predecessor, re-presenting the
|
|
121
|
+
* same signatures as though another group had approved it.
|
|
122
|
+
*/
|
|
123
|
+
function buildKeyRotationRequestPayload(request) {
|
|
124
|
+
if (!request.prevKeyId || !request.nextKeyId) {
|
|
125
|
+
throw new Error("a rotation request names both the key being replaced and its replacement");
|
|
126
|
+
}
|
|
127
|
+
if (request.prevKeyId === request.nextKeyId) {
|
|
128
|
+
// A self-rotation is a cycle in the chain the enclave walks, and it walks
|
|
129
|
+
// without a visited set.
|
|
130
|
+
throw new Error("a rotation request cannot name the same key as both predecessor and successor");
|
|
131
|
+
}
|
|
132
|
+
return (0, verify_js_1.canonicalJson)({
|
|
133
|
+
asserted_team_id: request.assertedTeamId,
|
|
134
|
+
next_key_id: request.nextKeyId,
|
|
135
|
+
payload_type: exports.PAYLOAD_TYPE_KEY_ROTATION_REQUEST,
|
|
136
|
+
prev_key_id: request.prevKeyId,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=customer-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customer-keys.js","sourceRoot":"","sources":["../../src/customer-keys.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;;;;;;AAEH,2CAA4C;AAG5C;;;;GAIG;AACU,QAAA,sBAAsB,GAAG,SAAS,CAAC;AAEhD;;;;GAIG;AACH,MAAM,+BAA+B,GAAG,kCAAkC,CAAC;AAE9D,QAAA,iCAAiC,GAAG,oCAAoC,CAAC;AAEtF,+CAA+C;AAClC,QAAA,8BAA8B,GAAG,EAAE,CAAC;AAEjD,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAEnC,2EAA2E;AAC3E,0BAAkC,SAAQ,KAAK;IAC7C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;;AAaD,SAAS,KAAK,CAAC,KAAiB;IAC9B,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5E,CAAC;AAED,sEAAsE;AAC/D,KAAK,4BACV,MAAiB,EACjB,SAAqB;IAErB,OAAO,KAAK,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,wEAAwE;AACjE,KAAK,2BACV,MAAiB,EACjB,KAAuB;IAEvB,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,oBAAoB,CAAC,gDAAgD,CAAC,CAAC;IACnF,CAAC;IACD,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AM,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC;AAED;;;;;;GAMG;AACI,KAAK,wBACV,MAAiB,EACjB,KAAuB;IAEvB,MAAM,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG;QACf,cAAc,EAAE,MAAM,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC;QACvD,YAAY,EAAE,+BAA+B;QAC7C,SAAS,EAAE,KAAK,CAAC,SAAS;KAC3B,CAAC;IACF,OAAO,QAAA,sBAAsB,GAAG,KAAK,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,IAAA,yBAAa,EAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACtF,CAAC;AAED;;;;;;;;;;GAUG;AACH,wCAA+C,OAI9C;IACC,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QAC7C,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;IAC9F,CAAC;IACD,IAAI,OAAO,CAAC,SAAS,KAAK,OAAO,CAAC,SAAS,EAAE,CAAC;QAC5C,0EAA0E;QAC1E,yBAAyB;QACzB,MAAM,IAAI,KAAK,CACb,+EAA+E,CAChF,CAAC;IACJ,CAAC;IACD,OAAO,IAAA,yBAAa,EAAC;QACnB,gBAAgB,EAAE,OAAO,CAAC,cAAc;QACxC,WAAW,EAAE,OAAO,CAAC,SAAS;QAC9B,YAAY,EAAE,QAAA,iCAAiC;QAC/C,WAAW,EAAE,OAAO,CAAC,SAAS;KAC/B,CAAC,CAAC;AACL,CAAC"}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -48,4 +48,6 @@ export { verifyWebhookSignature, isTimestampFresh } from "./webhooks.js";
|
|
|
48
48
|
*/
|
|
49
49
|
export { EnclaveAttestationError, ENVELOPE_MAGIC, HEADER_SIZE, NITRO_ROOT_G1_PEM, sealConnectionConfig, sealToKey, verifyEnclaveConfigSealKey, } from "./enclave-seal.js";
|
|
50
50
|
export type { SealOptions } from "./enclave-seal.js";
|
|
51
|
+
export { CUSTOMER_KEY_ID_PREFIX, InvalidKeyGroupError, MAX_CUSTOMER_KEY_GROUP_MEMBERS, PAYLOAD_TYPE_KEY_ROTATION_REQUEST, buildKeyRotationRequestPayload, customerKeyId, memberFingerprint, memberFingerprints, validateKeyGroup, } from "./customer-keys.js";
|
|
52
|
+
export type { CustomerKeyGroup } from "./customer-keys.js";
|
|
51
53
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAEpE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC3D,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EACL,eAAe,EACf,QAAQ,EACR,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,YAAY,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,YAAY,EACV,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,MAAM,EACN,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,YAAY,E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+1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/** BurnLedger TypeScript SDK — public API (Node.js entry point). */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.verifyEnclaveConfigSealKey = exports.sealToKey = exports.sealConnectionConfig = exports.NITRO_ROOT_G1_PEM = exports.HEADER_SIZE = exports.ENVELOPE_MAGIC = exports.EnclaveAttestationError = exports.isTimestampFresh = exports.verifyWebhookSignature = exports.bytesToHex = exports.hexToBytes = exports.issuanceBytes = exports.Paginator = exports.parseWebhook = exports.parseCertificateResponse = exports.parseSystem = exports.Transport = exports.UNSUPPORTED_FORMAT_VERSION = exports.CERTIFICATE_REVOKED = exports.VerificationError = exports.TimeoutError = exports.ServerError = exports.RateLimitError = exports.ValidationError = exports.ConflictError = exports.NotFoundError = exports.AuthenticationError = exports.ApiError = exports.BurnLedgerError = exports.MAX_BATCH_REVOKE = exports.BurnLedger = void 0;
|
|
4
|
+
exports.validateKeyGroup = exports.memberFingerprints = exports.memberFingerprint = exports.customerKeyId = exports.buildKeyRotationRequestPayload = exports.PAYLOAD_TYPE_KEY_ROTATION_REQUEST = exports.MAX_CUSTOMER_KEY_GROUP_MEMBERS = exports.InvalidKeyGroupError = exports.CUSTOMER_KEY_ID_PREFIX = exports.verifyEnclaveConfigSealKey = exports.sealToKey = exports.sealConnectionConfig = exports.NITRO_ROOT_G1_PEM = exports.HEADER_SIZE = exports.ENVELOPE_MAGIC = exports.EnclaveAttestationError = exports.isTimestampFresh = exports.verifyWebhookSignature = exports.bytesToHex = exports.hexToBytes = exports.issuanceBytes = exports.Paginator = exports.parseWebhook = exports.parseCertificateResponse = exports.parseSystem = exports.Transport = exports.UNSUPPORTED_FORMAT_VERSION = exports.CERTIFICATE_REVOKED = exports.VerificationError = exports.TimeoutError = exports.ServerError = exports.RateLimitError = exports.ValidationError = exports.ConflictError = exports.NotFoundError = exports.AuthenticationError = exports.ApiError = exports.BurnLedgerError = exports.MAX_BATCH_REVOKE = exports.BurnLedger = void 0;
|
|
5
5
|
exports.verifyCertificate = verifyCertificate;
|
|
6
6
|
exports.verifyCertificateWithStatus = verifyCertificateWithStatus;
|
|
7
7
|
exports.verifyTransparency = verifyTransparency;
|
|
@@ -91,4 +91,14 @@ Object.defineProperty(exports, "NITRO_ROOT_G1_PEM", { enumerable: true, get: fun
|
|
|
91
91
|
Object.defineProperty(exports, "sealConnectionConfig", { enumerable: true, get: function () { return enclave_seal_js_1.sealConnectionConfig; } });
|
|
92
92
|
Object.defineProperty(exports, "sealToKey", { enumerable: true, get: function () { return enclave_seal_js_1.sealToKey; } });
|
|
93
93
|
Object.defineProperty(exports, "verifyEnclaveConfigSealKey", { enumerable: true, get: function () { return enclave_seal_js_1.verifyEnclaveConfigSealKey; } });
|
|
94
|
+
var customer_keys_js_1 = require("./customer-keys.js");
|
|
95
|
+
Object.defineProperty(exports, "CUSTOMER_KEY_ID_PREFIX", { enumerable: true, get: function () { return customer_keys_js_1.CUSTOMER_KEY_ID_PREFIX; } });
|
|
96
|
+
Object.defineProperty(exports, "InvalidKeyGroupError", { enumerable: true, get: function () { return customer_keys_js_1.InvalidKeyGroupError; } });
|
|
97
|
+
Object.defineProperty(exports, "MAX_CUSTOMER_KEY_GROUP_MEMBERS", { enumerable: true, get: function () { return customer_keys_js_1.MAX_CUSTOMER_KEY_GROUP_MEMBERS; } });
|
|
98
|
+
Object.defineProperty(exports, "PAYLOAD_TYPE_KEY_ROTATION_REQUEST", { enumerable: true, get: function () { return customer_keys_js_1.PAYLOAD_TYPE_KEY_ROTATION_REQUEST; } });
|
|
99
|
+
Object.defineProperty(exports, "buildKeyRotationRequestPayload", { enumerable: true, get: function () { return customer_keys_js_1.buildKeyRotationRequestPayload; } });
|
|
100
|
+
Object.defineProperty(exports, "customerKeyId", { enumerable: true, get: function () { return customer_keys_js_1.customerKeyId; } });
|
|
101
|
+
Object.defineProperty(exports, "memberFingerprint", { enumerable: true, get: function () { return customer_keys_js_1.memberFingerprint; } });
|
|
102
|
+
Object.defineProperty(exports, "memberFingerprints", { enumerable: true, get: function () { return customer_keys_js_1.memberFingerprints; } });
|
|
103
|
+
Object.defineProperty(exports, "validateKeyGroup", { enumerable: true, get: function () { return customer_keys_js_1.validateKeyGroup; } });
|
|
94
104
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,oEAAoE;;;;;;;;AAEpE,yCAA2D;AAAlD,uGAAA,UAAU,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AAGrC,yCAaqB;AAZnB,4GAAA,eAAe,OAAA;AACf,qGAAA,QAAQ,OAAA;AACR,gHAAA,mBAAmB,OAAA;AACnB,0GAAA,aAAa,OAAA;AACb,0GAAA,aAAa,OAAA;AACb,4GAAA,eAAe,OAAA;AACf,2GAAA,cAAc,OAAA;AACd,wGAAA,WAAW,OAAA;AACX,yGAAA,YAAY,OAAA;AACZ,8GAAA,iBAAiB,OAAA;AACjB,gHAAA,mBAAmB,OAAA;AACnB,uHAAA,0BAA0B,OAAA;AAG5B,qCAAsC;AAA7B,oGAAA,SAAS,OAAA;AA8ClB,2EAA2E;AAC3E,0EAA0E;AAC1E,yCAAkF;AAAzE,wGAAA,WAAW,OAAA;AAAE,qHAAA,wBAAwB,OAAA;AAAE,yGAAA,YAAY,OAAA;AAE5D,iDAA4C;AAAnC,0GAAA,SAAS,OAAA;AAIlB,yCAAoE;AAA3D,0GAAA,aAAa,OAAA;AAAE,uGAAA,UAAU,OAAA;AAAE,uGAAA,UAAU,OAAA;AAE9C,qDAA8C;AAC9C,2CAMqB;AAMrB,+DAA+D;AAC/D,2BACE,WAAiB,EACjB,UAAsC;IAEtC,OAAO,IAAA,6BAAkB,EAAC,2BAAU,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;AACjE,CAAC;AAED;;;;;GAKG;AACH,qCACE,WAA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EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACnF,CAAC;AAED,6CAAyE;AAAhE,qHAAA,sBAAsB,OAAA;AAAE,+GAAA,gBAAgB,OAAA;AAEjD;;;;;;;GAOG;AACH,qDAQ2B;AAPzB,0HAAA,uBAAuB,OAAA;AACvB,iHAAA,cAAc,OAAA;AACd,8GAAA,WAAW,OAAA;AACX,oHAAA,iBAAiB,OAAA;AACjB,uHAAA,oBAAoB,OAAA;AACpB,4GAAA,SAAS,OAAA;AACT,6HAAA,0BAA0B,OAAA;AAI5B,uDAU4B;AAT1B,0HAAA,sBAAsB,OAAA;AACtB,wHAAA,oBAAoB,OAAA;AACpB,kIAAA,8BAA8B,OAAA;AAC9B,qIAAA,iCAAiC,OAAA;AACjC,kIAAA,8BAA8B,OAAA;AAC9B,iHAAA,aAAa,OAAA;AACb,qHAAA,iBAAiB,OAAA;AACjB,sHAAA,kBAAkB,OAAA;AAClB,oHAAA,gBAAgB,OAAA"}
|
package/dist/cjs/verify.d.ts
CHANGED
|
@@ -125,6 +125,10 @@ export declare function verifyTransparency(crypto: CryptoOps, certificate: Cert,
|
|
|
125
125
|
* verification (#C-01).
|
|
126
126
|
*/
|
|
127
127
|
export declare function issuanceBytes(certificate: Cert): Uint8Array;
|
|
128
|
+
/** Exported for tests/verify.test.ts, which keeps a second implementation of
|
|
129
|
+
* this and must be able to prove the two agree. Not re-exported from index.ts,
|
|
130
|
+
* so it stays off the published API. */
|
|
131
|
+
export declare function canonicalJson(obj: unknown): Uint8Array;
|
|
128
132
|
/** Normalize a certificate timestamp to the UTC form Go signs.
|
|
129
133
|
*
|
|
130
134
|
* Go builds every payload timestamp as `t.UTC().Format("2006-01-02T15:04:05Z")`
|
package/dist/cjs/verify.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/verify.ts"],"names":[],"mappings":"AAAA;;;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|
27
27
|
exports.verifyCertificate = verifyCertificate;
|
|
28
28
|
exports.verifyTransparency = verifyTransparency;
|
|
29
29
|
exports.issuanceBytes = issuanceBytes;
|
|
30
|
+
exports.canonicalJson = canonicalJson;
|
|
30
31
|
exports.formatTimestamp = formatTimestamp;
|
|
31
32
|
exports.buildTreeHeadPayload = buildTreeHeadPayload;
|
|
32
33
|
exports.verifyConsistency = verifyConsistency;
|
|
@@ -80,6 +81,19 @@ const FORMAT_VERSION_V7 = "7.0";
|
|
|
80
81
|
const PAYLOAD_TYPE_ATTESTATION_V8 = "burnledger.attestation.v8";
|
|
81
82
|
const PAYLOAD_TYPE_VERIFICATION_RECORD_V8 = "burnledger.verification_record.v8";
|
|
82
83
|
const FORMAT_VERSION_V8 = "8.0";
|
|
84
|
+
// v9 adds two per-system fields, authorization and customer_key_id: whether the
|
|
85
|
+
// enclave checked this system against a customer-signed registration
|
|
86
|
+
// certificate (ADR-025 §4), and under which customer key group if it did.
|
|
87
|
+
//
|
|
88
|
+
// The attestation gains NO field at v9. Its tag still moves, because the tag
|
|
89
|
+
// follows the record's version and the record's bytes changed — a v9
|
|
90
|
+
// attestation rebuilt under burnledger.attestation.v8 is a different preimage.
|
|
91
|
+
//
|
|
92
|
+
// READ-ONLY IN THIS BUILD, mirroring core, for the same runbook-invariant-5
|
|
93
|
+
// reason spelled out for v8 above.
|
|
94
|
+
const PAYLOAD_TYPE_ATTESTATION_V9 = "burnledger.attestation.v9";
|
|
95
|
+
const PAYLOAD_TYPE_VERIFICATION_RECORD_V9 = "burnledger.verification_record.v9";
|
|
96
|
+
const FORMAT_VERSION_V9 = "9.0";
|
|
83
97
|
const FORMAT_VERSION_V3 = "3.0";
|
|
84
98
|
/**
|
|
85
99
|
* The only signature scheme this SDK can check. A v7 record names its own
|
|
@@ -104,6 +118,7 @@ exports.KNOWN_FORMAT_VERSIONS = Object.freeze([
|
|
|
104
118
|
FORMAT_VERSION_V6,
|
|
105
119
|
FORMAT_VERSION_V7,
|
|
106
120
|
FORMAT_VERSION_V8,
|
|
121
|
+
FORMAT_VERSION_V9,
|
|
107
122
|
]);
|
|
108
123
|
/**
|
|
109
124
|
* Returns the version, or throws if this SDK cannot read it.
|
|
@@ -160,6 +175,50 @@ function signatureCoversMeasuredTransport(version) {
|
|
|
160
175
|
function signatureCoversRecoverableState(version) {
|
|
161
176
|
return formatAtLeast(version, FORMAT_VERSION_V8);
|
|
162
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Does this format sign the per-system authorization and customer_key_id?
|
|
180
|
+
*
|
|
181
|
+
* v9 onward. `authorization` is always present on a v9 record; `customer_key_id`
|
|
182
|
+
* only when it is certified, and OMITTED rather than empty when it is not — a
|
|
183
|
+
* key id of "" would sign as a value, and a reader comparing against their own
|
|
184
|
+
* key id must not have to know that "" means "nobody".
|
|
185
|
+
*/
|
|
186
|
+
function signatureCoversAuthorization(version) {
|
|
187
|
+
return formatAtLeast(version, FORMAT_VERSION_V9);
|
|
188
|
+
}
|
|
189
|
+
/** The two values a v9 record's per-system authorization may take. */
|
|
190
|
+
const AUTHORIZATION_CERTIFIED = "certified";
|
|
191
|
+
const AUTHORIZATION_NONE = "none";
|
|
192
|
+
/**
|
|
193
|
+
* Read a v9 system's authorization and key id, refusing what core refuses.
|
|
194
|
+
*
|
|
195
|
+
* Port of checkAuthorization in core/payload.go. It runs on the VERIFY side
|
|
196
|
+
* too, and must: an unset or unrecognized value is not something to rebuild
|
|
197
|
+
* bytes from and report as a bad signature — the record is malformed. The two
|
|
198
|
+
* refused combinations are the ones that would be a lie rather than a shape
|
|
199
|
+
* error: certified naming nobody is ADR-025 §2's second-key attack with the
|
|
200
|
+
* evidence removed, and none naming somebody claims an authority that was
|
|
201
|
+
* never checked.
|
|
202
|
+
*/
|
|
203
|
+
function requireAuthorization(s, systemName) {
|
|
204
|
+
const a = s.authorization;
|
|
205
|
+
if (a !== AUTHORIZATION_CERTIFIED && a !== AUTHORIZATION_NONE) {
|
|
206
|
+
throw new errors_js_1.VerificationError(`system ${JSON.stringify(systemName)}: authorization is ${JSON.stringify(a ?? null)}, ` +
|
|
207
|
+
`which format ${FORMAT_VERSION_V9} requires to be one of certified, none`);
|
|
208
|
+
}
|
|
209
|
+
const raw = s.customer_key_id;
|
|
210
|
+
if (raw !== undefined && raw !== null && typeof raw !== "string") {
|
|
211
|
+
throw new errors_js_1.VerificationError(`system ${JSON.stringify(systemName)}: customer_key_id is not a string`);
|
|
212
|
+
}
|
|
213
|
+
const customerKeyId = typeof raw === "string" ? raw : "";
|
|
214
|
+
if (a === AUTHORIZATION_CERTIFIED && customerKeyId === "") {
|
|
215
|
+
throw new errors_js_1.VerificationError(`system ${JSON.stringify(systemName)}: authorization is certified but customer_key_id is empty`);
|
|
216
|
+
}
|
|
217
|
+
if (a === AUTHORIZATION_NONE && customerKeyId !== "") {
|
|
218
|
+
throw new errors_js_1.VerificationError(`system ${JSON.stringify(systemName)}: authorization is none but customer_key_id is set`);
|
|
219
|
+
}
|
|
220
|
+
return { authorization: a, customerKeyId };
|
|
221
|
+
}
|
|
163
222
|
const PAYLOAD_TYPE_TREE_HEAD = "burnledger.sth.v3";
|
|
164
223
|
// The domain for a tree head that names its log. See buildTreeHeadPayload.
|
|
165
224
|
const PAYLOAD_TYPE_TREE_HEAD_V7 = "burnledger.sth.v7";
|
|
@@ -594,6 +653,9 @@ function issuanceBytes(certificate) {
|
|
|
594
653
|
// ---------------------------------------------------------------------------
|
|
595
654
|
// RFC 8785 Canonical JSON
|
|
596
655
|
// ---------------------------------------------------------------------------
|
|
656
|
+
/** Exported for tests/verify.test.ts, which keeps a second implementation of
|
|
657
|
+
* this and must be able to prove the two agree. Not re-exported from index.ts,
|
|
658
|
+
* so it stays off the published API. */
|
|
597
659
|
function canonicalJson(obj) {
|
|
598
660
|
return textToBytes(canonicalStringify(obj));
|
|
599
661
|
}
|
|
@@ -867,6 +929,8 @@ function requireMeasured(value, field, systemName, version) {
|
|
|
867
929
|
/** Domain separator for the record itself, by certificate format version. */
|
|
868
930
|
function certificatePayloadType(version) {
|
|
869
931
|
checkFormatVersion(version);
|
|
932
|
+
if (version === FORMAT_VERSION_V9)
|
|
933
|
+
return PAYLOAD_TYPE_VERIFICATION_RECORD_V9;
|
|
870
934
|
if (version === FORMAT_VERSION_V8)
|
|
871
935
|
return PAYLOAD_TYPE_VERIFICATION_RECORD_V8;
|
|
872
936
|
if (version === FORMAT_VERSION_V7)
|
|
@@ -890,6 +954,8 @@ function attestationPayloadType(version) {
|
|
|
890
954
|
// Equality here, deliberately: each format has its OWN separator, so this is
|
|
891
955
|
// a lookup rather than a "this version onward" question. v3 and v4 share one
|
|
892
956
|
// because their attestation bytes are identical.
|
|
957
|
+
if (version === FORMAT_VERSION_V9)
|
|
958
|
+
return PAYLOAD_TYPE_ATTESTATION_V9;
|
|
893
959
|
if (version === FORMAT_VERSION_V8)
|
|
894
960
|
return PAYLOAD_TYPE_ATTESTATION_V8;
|
|
895
961
|
if (version === FORMAT_VERSION_V7)
|
|
@@ -910,6 +976,7 @@ function buildCertificatePayload(cert) {
|
|
|
910
976
|
const version = cert.certificate_format_version;
|
|
911
977
|
const coversMeasured = signatureCoversMeasuredTransport(version);
|
|
912
978
|
const coversRecoverable = signatureCoversRecoverableState(version);
|
|
979
|
+
const coversAuthorization = signatureCoversAuthorization(version);
|
|
913
980
|
const systems = (cert.systems ?? []).map((s) => {
|
|
914
981
|
const sys = {
|
|
915
982
|
attested_at: formatTimestamp(s.attested_at),
|
|
@@ -931,6 +998,12 @@ function buildCertificatePayload(cert) {
|
|
|
931
998
|
if (coversRecoverable) {
|
|
932
999
|
sys.recoverable_state = requireMeasured(s.recoverable_state, "recoverable_state", s.system_name, version);
|
|
933
1000
|
}
|
|
1001
|
+
if (coversAuthorization) {
|
|
1002
|
+
const { authorization, customerKeyId } = requireAuthorization(s, s.system_name);
|
|
1003
|
+
sys.authorization = authorization;
|
|
1004
|
+
if (customerKeyId !== "")
|
|
1005
|
+
sys.customer_key_id = customerKeyId;
|
|
1006
|
+
}
|
|
934
1007
|
return sys;
|
|
935
1008
|
});
|
|
936
1009
|
// The attestation block carries no system list of its own: the merged list
|