burnledger 0.2.2 → 0.3.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/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/cjs/index.browser.d.ts +2 -1
- package/dist/cjs/index.browser.d.ts.map +1 -1
- package/dist/cjs/index.browser.js +7 -1
- package/dist/cjs/index.browser.js.map +1 -1
- package/dist/cjs/index.d.ts +9 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +17 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/models.d.ts +28 -1
- package/dist/cjs/models.d.ts.map +1 -1
- package/dist/cjs/models.js +8 -0
- package/dist/cjs/models.js.map +1 -1
- package/dist/cjs/verify.d.ts +55 -1
- package/dist/cjs/verify.d.ts.map +1 -1
- package/dist/cjs/verify.js +414 -104
- package/dist/cjs/verify.js.map +1 -1
- package/dist/cjs/web-verifier.d.ts +29 -0
- package/dist/cjs/web-verifier.d.ts.map +1 -0
- package/dist/cjs/web-verifier.js +70 -0
- package/dist/cjs/web-verifier.js.map +1 -0
- package/dist/esm/cli.d.ts.map +1 -1
- package/dist/esm/cli.js +12 -5
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/index.browser.d.ts +2 -1
- package/dist/esm/index.browser.d.ts.map +1 -1
- package/dist/esm/index.browser.js +3 -0
- package/dist/esm/index.browser.js.map +1 -1
- package/dist/esm/index.d.ts +9 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +13 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/models.d.ts +28 -1
- package/dist/esm/models.d.ts.map +1 -1
- package/dist/esm/models.js +8 -0
- package/dist/esm/models.js.map +1 -1
- package/dist/esm/verify.d.ts +55 -1
- package/dist/esm/verify.d.ts.map +1 -1
- package/dist/esm/verify.js +411 -105
- package/dist/esm/verify.js.map +1 -1
- package/dist/esm/web-verifier.d.ts +29 -0
- package/dist/esm/web-verifier.d.ts.map +1 -0
- package/dist/esm/web-verifier.js +63 -0
- package/dist/esm/web-verifier.js.map +1 -0
- package/package.json +12 -11
- package/src/cli.ts +207 -0
- package/src/client.ts +555 -0
- package/src/crypto-browser.ts +49 -0
- package/src/crypto-node.ts +40 -0
- package/src/crypto.ts +10 -0
- package/src/errors.ts +154 -0
- package/src/http.ts +209 -0
- package/src/index.browser.ts +110 -0
- package/src/index.ts +134 -0
- package/src/keys.ts +18 -0
- package/src/models.ts +558 -0
- package/src/pagination.ts +64 -0
- package/src/verify.ts +956 -0
- package/src/web-verifier.ts +89 -0
- package/src/webhooks.ts +76 -0
package/dist/esm/verify.d.ts
CHANGED
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
* - The payload builders normalize both formats to lowercase hex strings.
|
|
10
10
|
* - Timestamps in payloads use second-precision UTC: "YYYY-MM-DDTHH:MM:SSZ".
|
|
11
11
|
* - RFC 8785 canonical JSON: sorted keys recursively, no whitespace.
|
|
12
|
-
* - Transparency leaf = SHA-256(0x00 ||
|
|
12
|
+
* - Transparency leaf = SHA-256(0x00 || logLeafPayload), where the payload
|
|
13
|
+
* commits to entry_type, certificate_id, SHA-256(issuanceBytes(cert)) and
|
|
14
|
+
* appended_at (ADR-016 §4). NOT the
|
|
13
15
|
* certificate signing payload. issuanceBytes reconstructs json.Marshal
|
|
14
16
|
* output at issuance time (transparency_status=PENDING, no transparency).
|
|
15
17
|
*/
|
|
@@ -41,10 +43,62 @@ export declare function verifyTransparency(crypto: CryptoOps, certificate: Cert,
|
|
|
41
43
|
* verification (#C-01).
|
|
42
44
|
*/
|
|
43
45
|
export declare function issuanceBytes(certificate: Cert): Uint8Array;
|
|
46
|
+
/** Normalize a certificate timestamp to the UTC form Go signs.
|
|
47
|
+
*
|
|
48
|
+
* Go builds every payload timestamp as `t.UTC().Format("2006-01-02T15:04:05Z")`
|
|
49
|
+
* (core/payload.go) on a value encoding/json already parsed as strict RFC 3339.
|
|
50
|
+
* This reproduces both halves — the same acceptance rules and the same
|
|
51
|
+
* conversion — because the two are one contract, not two.
|
|
52
|
+
*
|
|
53
|
+
* It must convert, never truncate. `12:00:00+05:00` and `12:00:00Z` are six
|
|
54
|
+
* hours apart; treating them as the same string made this verifier accept a
|
|
55
|
+
* certificate whose attestation window had been re-labelled to a different
|
|
56
|
+
* instant, and reject genuine certificates issued by a server on local time
|
|
57
|
+
* (#452). Input Go would refuse to parse is refused here rather than
|
|
58
|
+
* string-surgered into something that verifies.
|
|
59
|
+
*
|
|
60
|
+
* `null`/`undefined` — an explicit JSON null, or a key Go's struct has and the
|
|
61
|
+
* document does not — is Go's zero time, not an error.
|
|
62
|
+
*
|
|
63
|
+
* Exported from this module so the timestamp_vectors.json suite can diff it
|
|
64
|
+
* against Go directly. It is deliberately not re-exported from index.ts, so it
|
|
65
|
+
* is not part of the published package surface.
|
|
66
|
+
*/
|
|
67
|
+
export declare function formatTimestamp(ts: unknown): string;
|
|
44
68
|
/** Verify a Merkle consistency proof (RFC 6962 Section 2.1.4).
|
|
45
69
|
*
|
|
46
70
|
* Port of Go's VerifyConsistency / Python's _verify_consistency.
|
|
47
71
|
*/
|
|
48
72
|
export declare function verifyConsistency(crypto: CryptoOps, oldSize: number, newSize: number, oldRoot: Uint8Array, newRoot: Uint8Array, proof: Uint8Array[]): Promise<boolean>;
|
|
73
|
+
/**
|
|
74
|
+
* Port of Go's BuildCertificateStatusPayload.
|
|
75
|
+
*
|
|
76
|
+
* Optional fields are omitted, never emitted as null: the issuer omits them, so
|
|
77
|
+
* a verifier that emitted nulls would rebuild different bytes and reject a
|
|
78
|
+
* genuine statement.
|
|
79
|
+
*/
|
|
80
|
+
export declare function buildCertificateStatusPayload(stmt: Record<string, unknown>): Uint8Array;
|
|
81
|
+
/** The verdict when a certificate verified but nothing said whether it was revoked. */
|
|
82
|
+
export declare const VALID_REVOCATION_UNKNOWN = "VALID_REVOCATION_UNKNOWN";
|
|
83
|
+
/**
|
|
84
|
+
* Verify a certificate and, separately, what a statement says about its
|
|
85
|
+
* revocation.
|
|
86
|
+
*
|
|
87
|
+
* A signature commits to bytes at an instant; revocation is discovered later,
|
|
88
|
+
* so no edit to the signed certificate can express it. The statement is a
|
|
89
|
+
* separate short-lived document — fetch it from
|
|
90
|
+
* `GET /v1/certificates/{id}/status`, or read `status_statement` from the
|
|
91
|
+
* certificate response, where it is stapled for exactly this purpose.
|
|
92
|
+
*
|
|
93
|
+
* | input | result |
|
|
94
|
+
* |---|---|
|
|
95
|
+
* | fresh statement, REVOKED | throws VerificationError |
|
|
96
|
+
* | fresh statement, ACTIVE | `"VALID"` |
|
|
97
|
+
* | absent or expired statement | `"VALID_REVOCATION_UNKNOWN"` |
|
|
98
|
+
*
|
|
99
|
+
* The last row is the point: `verifyCertificate` answers VALID there, which
|
|
100
|
+
* reads as "not revoked" and is not something it checked.
|
|
101
|
+
*/
|
|
102
|
+
export declare function verifyCertificateWithStatus(crypto: CryptoOps, certificate: Cert, publicKeys: Map<string, PublicKeyInfo>, status?: Record<string, unknown> | null, now?: Date): Promise<string>;
|
|
49
103
|
export {};
|
|
50
104
|
//# sourceMappingURL=verify.d.ts.map
|
package/dist/esm/verify.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/verify.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAkB1E,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CASlD;AAYD,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAQpD;AAoCD,MAAM,WAAW,aAAa;IAC5B,QAAQ,C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