burnledger 0.4.0 → 0.6.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 +11 -4
- package/dist/cjs/anchor.d.ts +71 -0
- package/dist/cjs/anchor.d.ts.map +1 -0
- package/dist/cjs/anchor.js +279 -0
- package/dist/cjs/anchor.js.map +1 -0
- package/dist/cjs/client.d.ts +26 -2
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +27 -5
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/enclave-seal.d.ts +101 -0
- package/dist/cjs/enclave-seal.d.ts.map +1 -0
- package/dist/cjs/enclave-seal.js +479 -0
- package/dist/cjs/enclave-seal.js.map +1 -0
- package/dist/cjs/errors.d.ts +42 -1
- package/dist/cjs/errors.d.ts.map +1 -1
- package/dist/cjs/errors.js +44 -2
- package/dist/cjs/errors.js.map +1 -1
- package/dist/cjs/http.d.ts +21 -1
- package/dist/cjs/http.d.ts.map +1 -1
- package/dist/cjs/http.js +76 -12
- package/dist/cjs/http.js.map +1 -1
- package/dist/cjs/index.browser.d.ts +2 -4
- package/dist/cjs/index.browser.d.ts.map +1 -1
- package/dist/cjs/index.browser.js.map +1 -1
- package/dist/cjs/index.d.ts +16 -11
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +20 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/keys.d.ts +66 -0
- package/dist/cjs/keys.d.ts.map +1 -1
- package/dist/cjs/keys.js +128 -3
- package/dist/cjs/keys.js.map +1 -1
- package/dist/cjs/models.d.ts +41 -3
- package/dist/cjs/models.d.ts.map +1 -1
- package/dist/cjs/models.js +25 -4
- package/dist/cjs/models.js.map +1 -1
- package/dist/cjs/verify.d.ts +72 -6
- package/dist/cjs/verify.d.ts.map +1 -1
- package/dist/cjs/verify.js +392 -62
- package/dist/cjs/verify.js.map +1 -1
- package/dist/cjs/web-verifier.d.ts +54 -5
- package/dist/cjs/web-verifier.d.ts.map +1 -1
- package/dist/cjs/web-verifier.js +36 -3
- package/dist/cjs/web-verifier.js.map +1 -1
- package/dist/esm/anchor.d.ts +71 -0
- package/dist/esm/anchor.d.ts.map +1 -0
- package/dist/esm/anchor.js +275 -0
- package/dist/esm/anchor.js.map +1 -0
- package/dist/esm/cli.d.ts +45 -14
- package/dist/esm/cli.d.ts.map +1 -1
- package/dist/esm/cli.js +357 -50
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/client.d.ts +26 -2
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +27 -5
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/enclave-seal.d.ts +101 -0
- package/dist/esm/enclave-seal.d.ts.map +1 -0
- package/dist/esm/enclave-seal.js +472 -0
- package/dist/esm/enclave-seal.js.map +1 -0
- package/dist/esm/errors.d.ts +42 -1
- package/dist/esm/errors.d.ts.map +1 -1
- package/dist/esm/errors.js +43 -1
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/http.d.ts +21 -1
- package/dist/esm/http.d.ts.map +1 -1
- package/dist/esm/http.js +75 -12
- package/dist/esm/http.js.map +1 -1
- package/dist/esm/index.browser.d.ts +2 -4
- package/dist/esm/index.browser.d.ts.map +1 -1
- package/dist/esm/index.browser.js.map +1 -1
- package/dist/esm/index.d.ts +16 -11
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +11 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/keys.d.ts +66 -0
- package/dist/esm/keys.d.ts.map +1 -1
- package/dist/esm/keys.js +125 -3
- package/dist/esm/keys.js.map +1 -1
- package/dist/esm/models.d.ts +41 -3
- package/dist/esm/models.d.ts.map +1 -1
- package/dist/esm/models.js +24 -4
- package/dist/esm/models.js.map +1 -1
- package/dist/esm/verify.d.ts +72 -6
- package/dist/esm/verify.d.ts.map +1 -1
- package/dist/esm/verify.js +390 -63
- package/dist/esm/verify.js.map +1 -1
- package/dist/esm/web-verifier.d.ts +54 -5
- package/dist/esm/web-verifier.d.ts.map +1 -1
- package/dist/esm/web-verifier.js +40 -3
- package/dist/esm/web-verifier.js.map +1 -1
- package/package.json +1 -1
- package/src/anchor.ts +330 -0
- package/src/cli.ts +389 -54
- package/src/client.ts +46 -4
- package/src/enclave-seal.ts +582 -0
- package/src/errors.ts +47 -2
- package/src/http.ts +79 -12
- package/src/index.browser.ts +2 -2
- package/src/index.ts +28 -9
- package/src/keys.ts +176 -3
- package/src/models.ts +72 -7
- package/src/verify.ts +467 -72
- package/src/web-verifier.ts +58 -5
package/src/web-verifier.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Imports the leaf modules directly rather than re-exporting from
|
|
5
5
|
* `index.browser.ts`: that entry pulls in the HTTP client, which imports
|
|
6
6
|
* `node:fs/promises` and cannot be bundled for a browser at all. The page needs
|
|
7
|
-
*
|
|
8
|
-
* browser is handed is then something you can read in one
|
|
9
|
-
* inferring from a minified artifact.
|
|
7
|
+
* a handful of functions and two error codes, so that is what this exposes — the surface
|
|
8
|
+
* a relying party's browser is handed is then something you can read in one
|
|
9
|
+
* screen instead of inferring from a minified artifact.
|
|
10
10
|
*
|
|
11
11
|
* Built by `scripts/build-web-verifier.mjs`. The bundle this replaces was built
|
|
12
12
|
* by hand once and never regenerated, and had drifted into disagreeing with the
|
|
@@ -15,14 +15,24 @@
|
|
|
15
15
|
* offset (#457). It also contained `ed25519Supported`, which existed in no
|
|
16
16
|
* source file anywhere in the repository.
|
|
17
17
|
*/
|
|
18
|
+
import {
|
|
19
|
+
ANCHOR_CONFIRMED,
|
|
20
|
+
ANCHOR_INCONSISTENT,
|
|
21
|
+
ANCHOR_UNVERIFIED,
|
|
22
|
+
checkStatementAnchor as _checkStatementAnchor,
|
|
23
|
+
} from "./anchor.js";
|
|
24
|
+
import type { AnchorResult } from "./anchor.js";
|
|
18
25
|
import { browserCrypto } from "./crypto-browser.js";
|
|
26
|
+
import { CERTIFICATE_REVOKED, UNSUPPORTED_FORMAT_VERSION } from "./errors.js";
|
|
19
27
|
import {
|
|
20
28
|
verifyCertificate as _verifyCertificate,
|
|
21
29
|
verifyCertificateWithStatus as _verifyCertificateWithStatus,
|
|
22
30
|
verifyTransparency as _verifyTransparency,
|
|
23
31
|
publicKeyFromHex as _publicKeyFromHex,
|
|
24
32
|
} from "./verify.js";
|
|
25
|
-
import type { PublicKeyInfo } from "./verify.js";
|
|
33
|
+
import type { PublicKeyInfo, PublicKeyOptions } from "./verify.js";
|
|
34
|
+
import { parseKeyListDocument, verifyKeyList as _verifyKeyList } from "./keys.js";
|
|
35
|
+
import type { KeyListDocument, KeyListEvidence } from "./keys.js";
|
|
26
36
|
import type { VerificationResult, TransparencyResult } from "./models.js";
|
|
27
37
|
|
|
28
38
|
type Cert = Record<string, unknown>;
|
|
@@ -50,6 +60,33 @@ export function verifyCertificateWithStatus(
|
|
|
50
60
|
return _verifyCertificateWithStatus(browserCrypto, certificate, publicKeys, status, now);
|
|
51
61
|
}
|
|
52
62
|
|
|
63
|
+
/**
|
|
64
|
+
* The `code` a VerificationError carries when a status statement verified and
|
|
65
|
+
* says REVOKED. The page needs it to tell that fact apart from a statement it
|
|
66
|
+
* could not authenticate, which is a different claim and must not be painted
|
|
67
|
+
* as a revocation.
|
|
68
|
+
*/
|
|
69
|
+
export { CERTIFICATE_REVOKED, UNSUPPORTED_FORMAT_VERSION };
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Test a status statement's signed log anchor against the log's own signed
|
|
73
|
+
* head, exactly as `burnledger check --online` does (see anchor.ts). The page
|
|
74
|
+
* calls this after it has fetched and authenticated a statement, with `apiUrl`
|
|
75
|
+
* empty so the requests are same-origin like the status fetch itself. Until
|
|
76
|
+
* this was exported the browser re-verified the statement's signature and
|
|
77
|
+
* nothing else, so a statement anchored to a tree the log never had passed
|
|
78
|
+
* here and failed in every CLI.
|
|
79
|
+
*/
|
|
80
|
+
export function checkStatementAnchor(
|
|
81
|
+
apiUrl: string,
|
|
82
|
+
statement: Record<string, unknown>,
|
|
83
|
+
key: PublicKeyInfo,
|
|
84
|
+
): Promise<AnchorResult> {
|
|
85
|
+
return _checkStatementAnchor(browserCrypto, apiUrl, statement, key);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { ANCHOR_CONFIRMED, ANCHOR_INCONSISTENT, ANCHOR_UNVERIFIED };
|
|
89
|
+
|
|
53
90
|
/** Verify the transparency proof embedded in a certificate. */
|
|
54
91
|
export function verifyTransparency(
|
|
55
92
|
certificate: Cert,
|
|
@@ -58,10 +95,26 @@ export function verifyTransparency(
|
|
|
58
95
|
return _verifyTransparency(browserCrypto, certificate, publicKeys);
|
|
59
96
|
}
|
|
60
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Read the published key set in any shape the endpoint has served, keeping
|
|
100
|
+
* the signed key_list.v3 statement fields when present (ADR-017 §5a).
|
|
101
|
+
*/
|
|
102
|
+
export { parseKeyListDocument };
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* What the published key set establishes about the key STATUSES: whether it
|
|
106
|
+
* carried a signed statement, and how that statement verified at `now`
|
|
107
|
+
* against the key it names inside itself. The key identities are
|
|
108
|
+
* self-checking either way; this is about the mutable half.
|
|
109
|
+
*/
|
|
110
|
+
export function verifyKeyList(doc: KeyListDocument, now?: Date): Promise<KeyListEvidence> {
|
|
111
|
+
return _verifyKeyList(browserCrypto, doc, now ?? new Date());
|
|
112
|
+
}
|
|
113
|
+
|
|
61
114
|
/** Construct a PublicKeyInfo from a hex-encoded Ed25519 public key. */
|
|
62
115
|
export function publicKeyFromHex(
|
|
63
116
|
hexKey: string,
|
|
64
|
-
opts?:
|
|
117
|
+
opts?: PublicKeyOptions,
|
|
65
118
|
): Promise<PublicKeyInfo> {
|
|
66
119
|
return _publicKeyFromHex(browserCrypto, hexKey, opts);
|
|
67
120
|
}
|