@tinfoilsh/verifier 1.4.0 → 2.0.0-rc.2
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 +29 -17
- package/dist/document/collateral/collateral.d.ts +76 -0
- package/dist/document/collateral/collateral.d.ts.map +1 -0
- package/dist/document/collateral/collateral.js +175 -0
- package/dist/document/collateral/collateral.js.map +1 -0
- package/dist/document/collateral/config.d.ts +24 -0
- package/dist/document/collateral/config.d.ts.map +1 -0
- package/dist/document/collateral/config.js +46 -0
- package/dist/document/collateral/config.js.map +1 -0
- package/dist/document/collateral/runtime.d.ts +20 -0
- package/dist/document/collateral/runtime.d.ts.map +1 -0
- package/dist/document/collateral/runtime.js +37 -0
- package/dist/document/collateral/runtime.js.map +1 -0
- package/dist/document/collateral/sev.d.ts +13 -0
- package/dist/document/collateral/sev.d.ts.map +1 -0
- package/dist/document/collateral/sev.js +26 -0
- package/dist/document/collateral/sev.js.map +1 -0
- package/dist/document/collateral/sigstore.d.ts +19 -0
- package/dist/document/collateral/sigstore.d.ts.map +1 -0
- package/dist/document/collateral/sigstore.js +31 -0
- package/dist/document/collateral/sigstore.js.map +1 -0
- package/dist/document/collateral/tdx.d.ts +14 -0
- package/dist/document/collateral/tdx.d.ts.map +1 -0
- package/dist/document/collateral/tdx.js +44 -0
- package/dist/document/collateral/tdx.js.map +1 -0
- package/dist/document/document.d.ts +112 -0
- package/dist/document/document.d.ts.map +1 -0
- package/dist/document/document.js +387 -0
- package/dist/document/document.js.map +1 -0
- package/dist/errors.d.ts +44 -76
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +52 -81
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +31 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +70 -10
- package/dist/index.js.map +1 -1
- package/dist/internal/bytes.d.ts +13 -0
- package/dist/internal/bytes.d.ts.map +1 -0
- package/dist/internal/bytes.js +37 -0
- package/dist/internal/bytes.js.map +1 -0
- package/dist/internal/canonical.js +89 -0
- package/dist/internal/canonical.js.map +1 -0
- package/dist/internal/endorsement/approval.js +467 -0
- package/dist/internal/endorsement/approval.js.map +1 -0
- package/dist/internal/endorsement/freshness.js +122 -0
- package/dist/internal/endorsement/freshness.js.map +1 -0
- package/dist/internal/endorsement/provenance.js +256 -0
- package/dist/internal/endorsement/provenance.js.map +1 -0
- package/dist/internal/endorsement/reference.d.ts +32 -0
- package/dist/internal/endorsement/reference.d.ts.map +1 -0
- package/dist/internal/endorsement/reference.js +37 -0
- package/dist/internal/endorsement/reference.js.map +1 -0
- package/dist/internal/endorsement/registry-certificate.js +147 -0
- package/dist/internal/endorsement/registry-certificate.js.map +1 -0
- package/dist/internal/endorsement/runtime.js +52 -0
- package/dist/internal/endorsement/runtime.js.map +1 -0
- package/dist/internal/endorsement/time.js +26 -0
- package/dist/internal/endorsement/time.js.map +1 -0
- package/dist/internal/json/decode.js +151 -0
- package/dist/internal/json/decode.js.map +1 -0
- package/dist/internal/json/index.d.ts +68 -0
- package/dist/internal/json/index.d.ts.map +1 -0
- package/dist/internal/json/index.js +486 -0
- package/dist/internal/json/index.js.map +1 -0
- package/dist/internal/policy/artifact.js +191 -0
- package/dist/internal/policy/artifact.js.map +1 -0
- package/dist/internal/policy/sev.js +157 -0
- package/dist/internal/policy/sev.js.map +1 -0
- package/dist/internal/policy/shape.js +31 -0
- package/dist/internal/policy/shape.js.map +1 -0
- package/dist/internal/policy/tdx.js +55 -0
- package/dist/internal/policy/tdx.js.map +1 -0
- package/dist/internal/quote/config.js +53 -0
- package/dist/internal/quote/config.js.map +1 -0
- package/dist/internal/quote/legacy.js +67 -0
- package/dist/internal/quote/legacy.js.map +1 -0
- package/dist/internal/quote/quote.js +139 -0
- package/dist/internal/quote/quote.js.map +1 -0
- package/dist/internal/quote/resolve.js +88 -0
- package/dist/internal/quote/resolve.js.map +1 -0
- package/dist/internal/quote/sev/authenticate.js +125 -0
- package/dist/internal/quote/sev/authenticate.js.map +1 -0
- package/dist/internal/quote/sev/expectations.js +288 -0
- package/dist/internal/quote/sev/expectations.js.map +1 -0
- package/dist/internal/quote/sev/identity.js +13 -0
- package/dist/internal/quote/sev/identity.js.map +1 -0
- package/dist/internal/quote/sev/report.js +224 -0
- package/dist/internal/quote/sev/report.js.map +1 -0
- package/dist/internal/quote/sev/tcb.js +110 -0
- package/dist/internal/quote/sev/tcb.js.map +1 -0
- package/dist/internal/quote/sev/vcek.js +299 -0
- package/dist/internal/quote/sev/vcek.js.map +1 -0
- package/dist/internal/quote/tdx/abi.js +161 -0
- package/dist/internal/quote/tdx/abi.js.map +1 -0
- package/dist/internal/quote/tdx/authenticate.js +343 -0
- package/dist/internal/quote/tdx/authenticate.js.map +1 -0
- package/dist/internal/quote/tdx/identity.js +11 -0
- package/dist/internal/quote/tdx/identity.js.map +1 -0
- package/dist/internal/quote/tdx/pck.js +133 -0
- package/dist/internal/quote/tdx/pck.js.map +1 -0
- package/dist/internal/quote/tdx/pcs.js +482 -0
- package/dist/internal/quote/tdx/pcs.js.map +1 -0
- package/dist/internal/rfc3339.js +24 -0
- package/dist/internal/rfc3339.js.map +1 -0
- package/dist/internal/runtime/config.js +61 -0
- package/dist/internal/runtime/config.js.map +1 -0
- package/dist/internal/runtime/manifest.js +82 -0
- package/dist/internal/runtime/manifest.js.map +1 -0
- package/dist/internal/semver.js +124 -0
- package/dist/internal/semver.js.map +1 -0
- package/dist/internal/sigstore/bundle.js +205 -0
- package/dist/internal/sigstore/bundle.js.map +1 -0
- package/dist/internal/sigstore/certificate.js +308 -0
- package/dist/internal/sigstore/certificate.js.map +1 -0
- package/dist/internal/sigstore/certified.js +56 -0
- package/dist/internal/sigstore/certified.js.map +1 -0
- package/dist/internal/sigstore/keyed.js +556 -0
- package/dist/internal/sigstore/keyed.js.map +1 -0
- package/dist/internal/sigstore/timestamp.js +421 -0
- package/dist/internal/sigstore/timestamp.js.map +1 -0
- package/dist/internal/sigstore/trusted-root.js +144 -0
- package/dist/internal/sigstore/trusted-root.js.map +1 -0
- package/dist/internal/x509/certificate.js +521 -0
- package/dist/internal/x509/certificate.js.map +1 -0
- package/dist/internal/x509/crl.js +116 -0
- package/dist/internal/x509/crl.js.map +1 -0
- package/dist/internal/x509/der.js +409 -0
- package/dist/internal/x509/der.js.map +1 -0
- package/dist/measurement.d.ts +47 -0
- package/dist/measurement.d.ts.map +1 -0
- package/dist/measurement.js +92 -0
- package/dist/measurement.js.map +1 -0
- package/dist/trust/amd-genoa-chain.js +4 -0
- package/dist/trust/amd-genoa-chain.js.map +1 -0
- package/dist/trust/amd-turin-chain.js +4 -0
- package/dist/trust/amd-turin-chain.js.map +1 -0
- package/dist/trust/intel-sgx-root.js +4 -0
- package/dist/trust/intel-sgx-root.js.map +1 -0
- package/dist/trust/signing-keys.js +7 -0
- package/dist/trust/signing-keys.js.map +1 -0
- package/dist/trust/sigstore-trusted-root.js +4 -0
- package/dist/trust/sigstore-trusted-root.js.map +1 -0
- package/dist/verification.d.ts +134 -0
- package/dist/verification.d.ts.map +1 -0
- package/dist/verification.js +129 -0
- package/dist/verification.js.map +1 -0
- package/dist/verifier.d.ts +115 -0
- package/dist/verifier.d.ts.map +1 -0
- package/dist/verifier.js +565 -0
- package/dist/verifier.js.map +1 -0
- package/dist/version.js +2 -3
- package/dist/version.js.map +1 -1
- package/package.json +21 -13
- package/dist/attestation.d.ts +0 -14
- package/dist/attestation.d.ts.map +0 -1
- package/dist/attestation.js +0 -117
- package/dist/attestation.js.map +0 -1
- package/dist/bundle.d.ts +0 -15
- package/dist/bundle.d.ts.map +0 -1
- package/dist/bundle.js +0 -134
- package/dist/bundle.js.map +0 -1
- package/dist/cert-verify.d.ts +0 -30
- package/dist/cert-verify.d.ts.map +0 -1
- package/dist/cert-verify.js +0 -132
- package/dist/cert-verify.js.map +0 -1
- package/dist/client.d.ts +0 -17
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -135
- package/dist/client.js.map +0 -1
- package/dist/dcode.d.ts +0 -7
- package/dist/dcode.d.ts.map +0 -1
- package/dist/dcode.js +0 -35
- package/dist/dcode.js.map +0 -1
- package/dist/json.d.ts +0 -3
- package/dist/json.d.ts.map +0 -1
- package/dist/json.js +0 -4
- package/dist/json.js.map +0 -1
- package/dist/sev/cert-chain.d.ts +0 -22
- package/dist/sev/cert-chain.d.ts.map +0 -1
- package/dist/sev/cert-chain.js +0 -253
- package/dist/sev/cert-chain.js.map +0 -1
- package/dist/sev/certs.d.ts +0 -3
- package/dist/sev/certs.d.ts.map +0 -1
- package/dist/sev/certs.js +0 -77
- package/dist/sev/certs.js.map +0 -1
- package/dist/sev/constants.d.ts +0 -20
- package/dist/sev/constants.d.ts.map +0 -1
- package/dist/sev/constants.js +0 -22
- package/dist/sev/constants.js.map +0 -1
- package/dist/sev/report.d.ts +0 -52
- package/dist/sev/report.d.ts.map +0 -1
- package/dist/sev/report.js +0 -228
- package/dist/sev/report.js.map +0 -1
- package/dist/sev/types.d.ts +0 -35
- package/dist/sev/types.d.ts.map +0 -1
- package/dist/sev/types.js +0 -2
- package/dist/sev/types.js.map +0 -1
- package/dist/sev/utils.d.ts +0 -7
- package/dist/sev/utils.d.ts.map +0 -1
- package/dist/sev/utils.js +0 -59
- package/dist/sev/utils.js.map +0 -1
- package/dist/sev/validation.d.ts +0 -39
- package/dist/sev/validation.d.ts.map +0 -1
- package/dist/sev/validation.js +0 -324
- package/dist/sev/validation.js.map +0 -1
- package/dist/sev/verify.d.ts +0 -11
- package/dist/sev/verify.d.ts.map +0 -1
- package/dist/sev/verify.js +0 -141
- package/dist/sev/verify.js.map +0 -1
- package/dist/sigstore-trusted-root.d.ts +0 -94
- package/dist/sigstore-trusted-root.d.ts.map +0 -1
- package/dist/sigstore-trusted-root.js +0 -127
- package/dist/sigstore-trusted-root.js.map +0 -1
- package/dist/sigstore.d.ts +0 -18
- package/dist/sigstore.d.ts.map +0 -1
- package/dist/sigstore.js +0 -119
- package/dist/sigstore.js.map +0 -1
- package/dist/types.d.ts +0 -94
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -73
- package/dist/types.js.map +0 -1
- package/dist/version.d.ts +0 -4
- package/dist/version.d.ts.map +0 -1
package/dist/errors.d.ts
CHANGED
|
@@ -1,91 +1,59 @@
|
|
|
1
|
+
/** The verification layers today, in the order a document passes through them. */
|
|
2
|
+
export type KnownLayer =
|
|
3
|
+
/** The document can't be parsed, isn't bound to the nonce, or contradicts itself. */
|
|
4
|
+
"envelope"
|
|
5
|
+
/** Reference values failed to authenticate or don't match the requested workload. */
|
|
6
|
+
| "provenance"
|
|
7
|
+
/** Hardware evidence isn't authentic. */
|
|
8
|
+
| "quote"
|
|
9
|
+
/** Authentic evidence doesn't satisfy the policy. */
|
|
10
|
+
| "policy";
|
|
1
11
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* ├── ConfigurationError - Client misconfigured or used incorrectly
|
|
8
|
-
* ├── FetchError - Couldn't fetch attestation materials
|
|
9
|
-
* └── AttestationError - Attestation failed (security issue)
|
|
10
|
-
* ```
|
|
12
|
+
* Names the verification layer that rejected a document: one of the
|
|
13
|
+
* {@link KnownLayer} values today, and a later version may add more. The
|
|
14
|
+
* type is open so a caller compiles against the names it knows; a value it
|
|
15
|
+
* doesn't recognize is still a rejection, at a stage it has no name for,
|
|
16
|
+
* and must be treated as one.
|
|
11
17
|
*/
|
|
18
|
+
export type Layer = KnownLayer | (string & {});
|
|
12
19
|
/**
|
|
13
|
-
* Base
|
|
20
|
+
* Base class for every error this package throws. `instanceof` holds for
|
|
21
|
+
* an error from another loaded copy of the package too: each error carries
|
|
22
|
+
* a brand under a globally registered key, which the three classes of this
|
|
23
|
+
* module check after the prototype chain. `Symbol.hasInstance` is
|
|
24
|
+
* inherited, so each check applies only when `this` is that class itself;
|
|
25
|
+
* a subclass defined elsewhere matches by its prototype chain alone.
|
|
14
26
|
*/
|
|
15
|
-
export declare class
|
|
16
|
-
cause?:
|
|
27
|
+
export declare abstract class VerifyError extends Error {
|
|
28
|
+
readonly cause?: unknown;
|
|
17
29
|
constructor(message: string, options?: {
|
|
18
|
-
cause?:
|
|
30
|
+
cause?: unknown;
|
|
19
31
|
});
|
|
32
|
+
static [Symbol.hasInstance](value: unknown): boolean;
|
|
20
33
|
}
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
*
|
|
24
|
-
* Examples:
|
|
25
|
-
* - Missing required options (serverURL, configRepo, apiKey)
|
|
26
|
-
* - Invalid option values
|
|
27
|
-
* - Calling methods before client is ready
|
|
28
|
-
* - Using the wrong client type
|
|
29
|
-
*
|
|
30
|
-
* Action: Fix your code
|
|
31
|
-
*/
|
|
32
|
-
export declare class ConfigurationError extends TinfoilError {
|
|
33
|
-
constructor(message: string, options?: {
|
|
34
|
-
cause?: Error;
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Thrown when fetching attestation materials fails.
|
|
39
|
-
*
|
|
40
|
-
* Examples:
|
|
41
|
-
* - Network unreachable
|
|
42
|
-
* - HTTP errors (404, 500, etc.)
|
|
43
|
-
* - Invalid response format (bad JSON, wrong schema)
|
|
44
|
-
* - Timeout
|
|
45
|
-
*
|
|
46
|
-
* Action: Retry, check network connectivity
|
|
47
|
-
*/
|
|
48
|
-
export declare class FetchError extends TinfoilError {
|
|
34
|
+
/** The verifier was built or called with invalid inputs. Retrying won't help. */
|
|
35
|
+
export declare class UsageError extends VerifyError {
|
|
49
36
|
constructor(message: string, options?: {
|
|
50
|
-
cause?:
|
|
37
|
+
cause?: unknown;
|
|
51
38
|
});
|
|
39
|
+
static [Symbol.hasInstance](value: unknown): boolean;
|
|
52
40
|
}
|
|
53
41
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* - Sigstore signature invalid
|
|
63
|
-
* - Hardware certificate chain invalid
|
|
64
|
-
* - Report signature invalid
|
|
65
|
-
* - Measurement mismatch (enclave code doesn't match signed release)
|
|
66
|
-
* - Policy violation (debug enabled, TCB too low)
|
|
67
|
-
* - Key binding mismatch (transport keys don't match attested keys)
|
|
68
|
-
*
|
|
69
|
-
* Action: Stop - security issue - you should retry the entire attestation protocol.
|
|
42
|
+
* A document that must not be trusted, and the layer that rejected it. The
|
|
43
|
+
* verifier fails closed: a failure inside a layer that is not itself a
|
|
44
|
+
* VerifyError, such as a bug or an exhausted resource, is reported as a
|
|
45
|
+
* rejection at that layer with the underlying error as `cause`. An
|
|
46
|
+
* unfamiliar message at a layer may therefore be the verifier failing
|
|
47
|
+
* rather than the document, and `cause` says which. The message reads
|
|
48
|
+
* `verification error: <layer>: <message>`; the layer is given in the
|
|
49
|
+
* options, with the cause.
|
|
70
50
|
*/
|
|
71
|
-
export declare class
|
|
72
|
-
|
|
73
|
-
|
|
51
|
+
export declare class VerificationError extends VerifyError {
|
|
52
|
+
readonly layer: Layer;
|
|
53
|
+
constructor(message: string, options: {
|
|
54
|
+
layer: Layer;
|
|
55
|
+
cause?: unknown;
|
|
74
56
|
});
|
|
57
|
+
static [Symbol.hasInstance](value: unknown): boolean;
|
|
75
58
|
}
|
|
76
|
-
/**
|
|
77
|
-
* Helper to handle errors in catch blocks.
|
|
78
|
-
* - If the error is already a TinfoilError, rethrow it as-is
|
|
79
|
-
* - Otherwise, wrap it in the specified error class
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* ```typescript
|
|
83
|
-
* try {
|
|
84
|
-
* await someOperation();
|
|
85
|
-
* } catch (e) {
|
|
86
|
-
* wrapOrThrow(e, AttestationError, 'Operation failed');
|
|
87
|
-
* }
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
export declare function wrapOrThrow(e: unknown, ErrorClass: typeof AttestationError | typeof FetchError | typeof ConfigurationError, message: string): never;
|
|
91
59
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,MAAM,UAAU;AACpB,qFAAqF;AACnF,UAAU;AACZ,qFAAqF;GACnF,YAAY;AACd,yCAAyC;GACvC,OAAO;AACT,qDAAqD;GACnD,QAAQ,CAAC;AAEb;;;;;;GAMG;AACH,MAAM,MAAM,KAAK,GAAG,UAAU,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AA6B/C;;;;;;;GAOG;AACH,8BAAsB,WAAY,SAAQ,KAAK;IAC7C,SAAiB,KAAK,CAAC,EAAE,OAAO,CAAC;gBAErB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;IAO1D,MAAM,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;CAGrD;AAED,iFAAiF;AACjF,qBAAa,UAAW,SAAQ,WAAW;gBAC7B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;WAM1C,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;CAG9D;AAED;;;;;;;;;GASG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;gBAEV,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;WAOvD,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;CAG9D"}
|
package/dist/errors.js
CHANGED
|
@@ -1,102 +1,73 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* ├── ConfigurationError - Client misconfigured or used incorrectly
|
|
8
|
-
* ├── FetchError - Couldn't fetch attestation materials
|
|
9
|
-
* └── AttestationError - Attestation failed (security issue)
|
|
10
|
-
* ```
|
|
2
|
+
* The key under which every error of this package carries its brand: its
|
|
3
|
+
* class name, stamped by the constructor. The key is registered globally, so
|
|
4
|
+
* two copies of the package loaded side by side (two versions installed, or
|
|
5
|
+
* a bundle that failed to dedupe) share it, and `instanceof` against one
|
|
6
|
+
* copy's classes recognizes the other copy's errors.
|
|
11
7
|
*/
|
|
8
|
+
const BRAND = Symbol.for("@tinfoilsh/verifier.error");
|
|
9
|
+
/** The brand `value` carries, or undefined for anything this package didn't construct. */
|
|
10
|
+
function brandOf(value) {
|
|
11
|
+
if (typeof value !== "object" || value === null)
|
|
12
|
+
return undefined;
|
|
13
|
+
const brand = value[BRAND];
|
|
14
|
+
return brand === "UsageError" || brand === "VerificationError" ? brand : undefined;
|
|
15
|
+
}
|
|
16
|
+
/** Stamps `err` with its brand, as a non-enumerable property so serializing or logging the error doesn't show it. */
|
|
17
|
+
function stamp(err, brand) {
|
|
18
|
+
Object.defineProperty(err, BRAND, { value: brand, enumerable: false, writable: false, configurable: false });
|
|
19
|
+
}
|
|
20
|
+
/** Whether `value` is an instance of `cls` by its prototype chain: the usual `instanceof`, which a subclass defined outside this package relies on. */
|
|
21
|
+
const byPrototype = (cls, value) => Function.prototype[Symbol.hasInstance].call(cls, value);
|
|
12
22
|
/**
|
|
13
|
-
* Base
|
|
23
|
+
* Base class for every error this package throws. `instanceof` holds for
|
|
24
|
+
* an error from another loaded copy of the package too: each error carries
|
|
25
|
+
* a brand under a globally registered key, which the three classes of this
|
|
26
|
+
* module check after the prototype chain. `Symbol.hasInstance` is
|
|
27
|
+
* inherited, so each check applies only when `this` is that class itself;
|
|
28
|
+
* a subclass defined elsewhere matches by its prototype chain alone.
|
|
14
29
|
*/
|
|
15
|
-
export class
|
|
30
|
+
export class VerifyError extends Error {
|
|
16
31
|
constructor(message, options) {
|
|
17
32
|
super(message);
|
|
18
|
-
|
|
19
|
-
if (options?.cause) {
|
|
33
|
+
if (options?.cause !== undefined) {
|
|
20
34
|
this.cause = options.cause;
|
|
21
35
|
}
|
|
22
36
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* Thrown when the client is misconfigured or used incorrectly.
|
|
26
|
-
*
|
|
27
|
-
* Examples:
|
|
28
|
-
* - Missing required options (serverURL, configRepo, apiKey)
|
|
29
|
-
* - Invalid option values
|
|
30
|
-
* - Calling methods before client is ready
|
|
31
|
-
* - Using the wrong client type
|
|
32
|
-
*
|
|
33
|
-
* Action: Fix your code
|
|
34
|
-
*/
|
|
35
|
-
export class ConfigurationError extends TinfoilError {
|
|
36
|
-
constructor(message, options) {
|
|
37
|
-
super(message, options);
|
|
38
|
-
this.name = 'ConfigurationError';
|
|
37
|
+
static [Symbol.hasInstance](value) {
|
|
38
|
+
return byPrototype(this, value) || (this === VerifyError && brandOf(value) !== undefined);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
-
*
|
|
44
|
-
* Examples:
|
|
45
|
-
* - Network unreachable
|
|
46
|
-
* - HTTP errors (404, 500, etc.)
|
|
47
|
-
* - Invalid response format (bad JSON, wrong schema)
|
|
48
|
-
* - Timeout
|
|
49
|
-
*
|
|
50
|
-
* Action: Retry, check network connectivity
|
|
51
|
-
*/
|
|
52
|
-
export class FetchError extends TinfoilError {
|
|
41
|
+
/** The verifier was built or called with invalid inputs. Retrying won't help. */
|
|
42
|
+
export class UsageError extends VerifyError {
|
|
53
43
|
constructor(message, options) {
|
|
54
|
-
super(message
|
|
55
|
-
this.name =
|
|
44
|
+
super(`usage error: ${message}`, options);
|
|
45
|
+
this.name = "UsageError";
|
|
46
|
+
stamp(this, "UsageError");
|
|
47
|
+
}
|
|
48
|
+
static [Symbol.hasInstance](value) {
|
|
49
|
+
return byPrototype(this, value) || (this === UsageError && brandOf(value) === "UsageError");
|
|
56
50
|
}
|
|
57
51
|
}
|
|
58
52
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* - Sigstore signature invalid
|
|
68
|
-
* - Hardware certificate chain invalid
|
|
69
|
-
* - Report signature invalid
|
|
70
|
-
* - Measurement mismatch (enclave code doesn't match signed release)
|
|
71
|
-
* - Policy violation (debug enabled, TCB too low)
|
|
72
|
-
* - Key binding mismatch (transport keys don't match attested keys)
|
|
73
|
-
*
|
|
74
|
-
* Action: Stop - security issue - you should retry the entire attestation protocol.
|
|
53
|
+
* A document that must not be trusted, and the layer that rejected it. The
|
|
54
|
+
* verifier fails closed: a failure inside a layer that is not itself a
|
|
55
|
+
* VerifyError, such as a bug or an exhausted resource, is reported as a
|
|
56
|
+
* rejection at that layer with the underlying error as `cause`. An
|
|
57
|
+
* unfamiliar message at a layer may therefore be the verifier failing
|
|
58
|
+
* rather than the document, and `cause` says which. The message reads
|
|
59
|
+
* `verification error: <layer>: <message>`; the layer is given in the
|
|
60
|
+
* options, with the cause.
|
|
75
61
|
*/
|
|
76
|
-
export class
|
|
62
|
+
export class VerificationError extends VerifyError {
|
|
77
63
|
constructor(message, options) {
|
|
78
|
-
super(message
|
|
79
|
-
this.name =
|
|
64
|
+
super(`verification error: ${options.layer}: ${message}`, options);
|
|
65
|
+
this.name = "VerificationError";
|
|
66
|
+
this.layer = options.layer;
|
|
67
|
+
stamp(this, "VerificationError");
|
|
80
68
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
* Helper to handle errors in catch blocks.
|
|
84
|
-
* - If the error is already a TinfoilError, rethrow it as-is
|
|
85
|
-
* - Otherwise, wrap it in the specified error class
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* ```typescript
|
|
89
|
-
* try {
|
|
90
|
-
* await someOperation();
|
|
91
|
-
* } catch (e) {
|
|
92
|
-
* wrapOrThrow(e, AttestationError, 'Operation failed');
|
|
93
|
-
* }
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
export function wrapOrThrow(e, ErrorClass, message) {
|
|
97
|
-
if (e instanceof TinfoilError) {
|
|
98
|
-
throw e;
|
|
69
|
+
static [Symbol.hasInstance](value) {
|
|
70
|
+
return byPrototype(this, value) || (this === VerificationError && brandOf(value) === "VerificationError");
|
|
99
71
|
}
|
|
100
|
-
throw new ErrorClass(message, { cause: e });
|
|
101
72
|
}
|
|
102
73
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAoBA;;;;;;GAMG;AACH,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;AAKtD,0FAA0F;AAC1F,SAAS,OAAO,CAAC,KAAc;IAC7B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAClE,MAAM,KAAK,GAAI,KAA+B,CAAC,KAAK,CAAC,CAAC;IACtD,OAAO,KAAK,KAAK,YAAY,IAAI,KAAK,KAAK,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACrF,CAAC;AAED,qHAAqH;AACrH,SAAS,KAAK,CAAC,GAAgB,EAAE,KAAY;IAC3C,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,KAAK,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;;;;GASG;AACH,MAAM,OAAO,iBAAkB,SAAQ,WAAW;IAGhD,YAAY,OAAe,EAAE,OAA0C;QACrE,KAAK,CAAC,uBAAuB,OAAO,CAAC,KAAK,KAAK,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;QACnE,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,KAAK,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,CAAU,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAc;QACjD,OAAO,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,iBAAiB,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,mBAAmB,CAAC,CAAC;IAC5G,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export
|
|
9
|
-
export type
|
|
10
|
-
export {
|
|
1
|
+
import { type Reference } from "./internal/endorsement/reference.js";
|
|
2
|
+
import { type ExpectedSevSnp, type ExpectedTdx, type Register } from "./measurement.js";
|
|
3
|
+
export { Verifier, type EmbeddedConfigBytes, type EmbeddedConfigReference, type EmbeddedReferences, type VerifierOptions } from "./verifier.js";
|
|
4
|
+
export { cryptoMaterialData, Verification, type ArtifactVerification, type ArtifactVerificationJSON, type ConfigVerification, type ConfigVerificationJSON, type MeasurementJSON, type ReferenceSource, type VerificationJSON, type VerificationMetadata, } from "./verification.js";
|
|
5
|
+
export type { ConfigEndorsement } from "./document/collateral/config.js";
|
|
6
|
+
export type { RuntimeReference } from "./document/collateral/runtime.js";
|
|
7
|
+
export { UsageError, VerificationError, VerifyError, type Layer } from "./errors.js";
|
|
8
|
+
export { ATTESTATION_V3_FORMAT, CRYPTO_MATERIAL_ID_HPKE, CRYPTO_MATERIAL_ID_TLS, CRYPTO_MATERIAL_V1_FORMAT, DEVICE_EVIDENCE_V1_FORMAT, KEY_SPKI_FP_SHA256_V1_FORMAT, KEY_SPKI_V1_FORMAT, KEY_X25519_HPKE_V1_FORMAT, NONCE_SIZE, NVIDIA_GPU_EVIDENCE_V1_FORMAT, randomNonce, REPORT_DATA_V1_ALGORITHM, SEV_SNP_REPORT_V1_FORMAT, TDX_QUOTE_V1_FORMAT, type CryptoMaterialItem, } from "./document/document.js";
|
|
9
|
+
export { formatMeasurement, REGISTER_SIZE, registerHex, type Expected, type ExpectedSevSnp, type ExpectedTdx, type Measurement, type Register, type SevSnpMeasurement, type TdxMeasurement, } from "./measurement.js";
|
|
10
|
+
export type { Reference };
|
|
11
|
+
export { fromHex, toHex } from "./internal/bytes.js";
|
|
12
|
+
/**
|
|
13
|
+
* The public registry's ID, the one accepted by default. `configRegistryIDs`
|
|
14
|
+
* names the exact accepted set, so a policy that accepts the public registry
|
|
15
|
+
* alongside others lists it: `[PUBLIC_REGISTRY_ID, ...mine]`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const PUBLIC_REGISTRY_ID: string;
|
|
18
|
+
/** Validates `owner/name[@tag][@sha256:digest]` and returns its parts, "" for an absent part. Throws UsageError. */
|
|
19
|
+
export declare function parseReference(ref: string): Reference;
|
|
20
|
+
/** Decodes a register from hex in either case. Throws UsageError for bad hex or length. */
|
|
21
|
+
export declare function parseRegister(s: string): Register;
|
|
22
|
+
/** Parses an SEV-SNP expectation; "" leaves the launch register unconstrained. Throws UsageError for a bad register. */
|
|
23
|
+
export declare function parseExpectedSevSnp(launch: string): ExpectedSevSnp;
|
|
24
|
+
/** Parses a TDX expectation; "" leaves that register unconstrained. Throws UsageError for a bad register. */
|
|
25
|
+
export declare function parseExpectedTdx(mrtd: string, rtmr0: string, rtmr1: string, rtmr2: string, rtmr3: string): ExpectedTdx;
|
|
26
|
+
/**
|
|
27
|
+
* The SHA-256 of a DER certificate's SubjectPublicKeyInfo, lowercase hex: the
|
|
28
|
+
* form the endorsed TLS key takes, for pinning a connection to it. Throws
|
|
29
|
+
* UsageError for bytes that are not a certificate.
|
|
30
|
+
*/
|
|
31
|
+
export declare function certPubkeyFP(certDer: Uint8Array): Promise<string>;
|
|
11
32
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAA4C,KAAK,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAG/G,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACd,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,KAAK,mBAAmB,EAAE,KAAK,uBAAuB,EAAE,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAChJ,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,GAC1B,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACzE,YAAY,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB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
* The public surface of the v3 verifier: the verifier and its options, the
|
|
3
|
+
* facts a verification proves, the error types, the measurement types, the
|
|
4
|
+
* document constants a caller needs to fetch a document and read endorsed
|
|
5
|
+
* keys, the TLS fingerprint helper, and the hex helpers for the nonce and
|
|
6
|
+
* the keys. Nothing else in this package is supported for direct use.
|
|
7
|
+
*/
|
|
8
|
+
import { UsageError } from "./errors.js";
|
|
9
|
+
import { PUBLIC_REGISTRY_ID as PUBLIC_REGISTRY_ID_INTERNAL } from "./internal/endorsement/approval.js";
|
|
10
|
+
import { parseReference as parseReferenceInternal } from "./internal/endorsement/reference.js";
|
|
11
|
+
import { parseCertificate, spkiFingerprint, X509Error } from "./internal/x509/certificate.js";
|
|
12
|
+
import { DerError } from "./internal/x509/der.js";
|
|
13
|
+
import { parseExpectedSevSnp as parseExpectedSevSnpInternal, parseExpectedTdx as parseExpectedTdxInternal, parseRegister as parseRegisterInternal, } from "./measurement.js";
|
|
14
|
+
export { Verifier } from "./verifier.js";
|
|
15
|
+
export { cryptoMaterialData, Verification, } from "./verification.js";
|
|
16
|
+
export { UsageError, VerificationError, VerifyError } from "./errors.js";
|
|
17
|
+
export { ATTESTATION_V3_FORMAT, CRYPTO_MATERIAL_ID_HPKE, CRYPTO_MATERIAL_ID_TLS, CRYPTO_MATERIAL_V1_FORMAT, DEVICE_EVIDENCE_V1_FORMAT, KEY_SPKI_FP_SHA256_V1_FORMAT, KEY_SPKI_V1_FORMAT, KEY_X25519_HPKE_V1_FORMAT, NONCE_SIZE, NVIDIA_GPU_EVIDENCE_V1_FORMAT, randomNonce, REPORT_DATA_V1_ALGORITHM, SEV_SNP_REPORT_V1_FORMAT, TDX_QUOTE_V1_FORMAT, } from "./document/document.js";
|
|
18
|
+
// The measurement module's parse functions throw bare errors for the
|
|
19
|
+
// pipeline to classify; the entry exports versions that throw UsageError.
|
|
20
|
+
export { formatMeasurement, REGISTER_SIZE, registerHex, } from "./measurement.js";
|
|
21
|
+
// The hex the document endpoint takes its nonce in, and the keys are reported in.
|
|
22
|
+
export { fromHex, toHex } from "./internal/bytes.js";
|
|
23
|
+
/**
|
|
24
|
+
* The public registry's ID, the one accepted by default. `configRegistryIDs`
|
|
25
|
+
* names the exact accepted set, so a policy that accepts the public registry
|
|
26
|
+
* alongside others lists it: `[PUBLIC_REGISTRY_ID, ...mine]`.
|
|
27
|
+
*/
|
|
28
|
+
export const PUBLIC_REGISTRY_ID = PUBLIC_REGISTRY_ID_INTERNAL;
|
|
29
|
+
/** Runs a check on caller input; its failure is a UsageError with the original error as `cause`. */
|
|
30
|
+
function usage(check) {
|
|
31
|
+
try {
|
|
32
|
+
return check();
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
throw new UsageError(err instanceof Error ? err.message : String(err), { cause: err });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** Validates `owner/name[@tag][@sha256:digest]` and returns its parts, "" for an absent part. Throws UsageError. */
|
|
39
|
+
export function parseReference(ref) {
|
|
40
|
+
return usage(() => parseReferenceInternal(ref));
|
|
41
|
+
}
|
|
42
|
+
/** Decodes a register from hex in either case. Throws UsageError for bad hex or length. */
|
|
43
|
+
export function parseRegister(s) {
|
|
44
|
+
return usage(() => parseRegisterInternal(s));
|
|
45
|
+
}
|
|
46
|
+
/** Parses an SEV-SNP expectation; "" leaves the launch register unconstrained. Throws UsageError for a bad register. */
|
|
47
|
+
export function parseExpectedSevSnp(launch) {
|
|
48
|
+
return usage(() => parseExpectedSevSnpInternal(launch));
|
|
49
|
+
}
|
|
50
|
+
/** Parses a TDX expectation; "" leaves that register unconstrained. Throws UsageError for a bad register. */
|
|
51
|
+
export function parseExpectedTdx(mrtd, rtmr0, rtmr1, rtmr2, rtmr3) {
|
|
52
|
+
return usage(() => parseExpectedTdxInternal(mrtd, rtmr0, rtmr1, rtmr2, rtmr3));
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The SHA-256 of a DER certificate's SubjectPublicKeyInfo, lowercase hex: the
|
|
56
|
+
* form the endorsed TLS key takes, for pinning a connection to it. Throws
|
|
57
|
+
* UsageError for bytes that are not a certificate.
|
|
58
|
+
*/
|
|
59
|
+
export async function certPubkeyFP(certDer) {
|
|
60
|
+
let spki;
|
|
61
|
+
try {
|
|
62
|
+
spki = parseCertificate(certDer).spki;
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
if (err instanceof X509Error || err instanceof DerError)
|
|
66
|
+
throw new UsageError(`parsing certificate: ${err.message}`, { cause: err });
|
|
67
|
+
throw err;
|
|
68
|
+
}
|
|
69
|
+
return spkiFingerprint(spki);
|
|
70
|
+
}
|
|
11
71
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,kBAAkB,IAAI,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACvG,OAAO,EAAE,cAAc,IAAI,sBAAsB,EAAkB,MAAM,qCAAqC,CAAC;AAC/G,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC9F,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EACL,mBAAmB,IAAI,2BAA2B,EAClD,gBAAgB,IAAI,wBAAwB,EAC5C,aAAa,IAAI,qBAAqB,GAIvC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAyG,MAAM,eAAe,CAAC;AAChJ,OAAO,EACL,kBAAkB,EAClB,YAAY,GASb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,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AA2B,CAAC,MAAM,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED,6GAA6G;AAC7G,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,KAAa,EAAE,KAAa,EAAE,KAAa,EAAE,KAAa;IACvG,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC,wBAAwB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AACjF,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAmB;IACpD,IAAI,IAAgB,CAAC;IACrB,IAAI,CAAC;QACH,IAAI,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC;IACxC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,SAAS,IAAI,GAAG,YAAY,QAAQ;YAAE,MAAM,IAAI,UAAU,CAAC,wBAAwB,GAAG,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;QACrI,MAAM,GAAG,CAAC;IACZ,CAAC;IACD,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Small byte helpers shared across the verifier. WebCrypto only; no node: imports. */
|
|
2
|
+
/** `b` as lowercase hex, two digits per byte. */
|
|
3
|
+
export declare function toHex(b: Uint8Array): string;
|
|
4
|
+
/**
|
|
5
|
+
* The bytes that `s` spells in lowercase hex: the form {@link toHex}
|
|
6
|
+
* writes. Only lowercase digits of even length are accepted; anything else
|
|
7
|
+
* throws a plain `Error`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function fromHex(s: string): Uint8Array;
|
|
10
|
+
export declare function concat(...parts: Uint8Array[]): Uint8Array;
|
|
11
|
+
export declare function utf8(s: string): Uint8Array;
|
|
12
|
+
export declare function sha256(data: Uint8Array): Promise<Uint8Array>;
|
|
13
|
+
//# sourceMappingURL=bytes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../src/internal/bytes.ts"],"names":[],"mappings":"AAAA,uFAAuF;AAEvF,iDAAiD;AACjD,wBAAgB,KAAK,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,CAI3C;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,CAK7C;AAED,wBAAgB,MAAM,CAAC,GAAG,KAAK,EAAE,UAAU,EAAE,GAAG,UAAU,CAQzD;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,CAE1C;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAElE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Small byte helpers shared across the verifier. WebCrypto only; no node: imports. */
|
|
2
|
+
/** `b` as lowercase hex, two digits per byte. */
|
|
3
|
+
export function toHex(b) {
|
|
4
|
+
let s = "";
|
|
5
|
+
for (const x of b)
|
|
6
|
+
s += x.toString(16).padStart(2, "0");
|
|
7
|
+
return s;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The bytes that `s` spells in lowercase hex: the form {@link toHex}
|
|
11
|
+
* writes. Only lowercase digits of even length are accepted; anything else
|
|
12
|
+
* throws a plain `Error`.
|
|
13
|
+
*/
|
|
14
|
+
export function fromHex(s) {
|
|
15
|
+
if (s.length % 2 !== 0 || !/^[0-9a-f]*$/.test(s))
|
|
16
|
+
throw new Error(`not lowercase hex of even length: ${JSON.stringify(s)}`);
|
|
17
|
+
const out = new Uint8Array(s.length / 2);
|
|
18
|
+
for (let i = 0; i < out.length; i++)
|
|
19
|
+
out[i] = parseInt(s.slice(2 * i, 2 * i + 2), 16);
|
|
20
|
+
return out;
|
|
21
|
+
}
|
|
22
|
+
export function concat(...parts) {
|
|
23
|
+
const out = new Uint8Array(parts.reduce((n, p) => n + p.length, 0));
|
|
24
|
+
let off = 0;
|
|
25
|
+
for (const p of parts) {
|
|
26
|
+
out.set(p, off);
|
|
27
|
+
off += p.length;
|
|
28
|
+
}
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
export function utf8(s) {
|
|
32
|
+
return new TextEncoder().encode(s);
|
|
33
|
+
}
|
|
34
|
+
export async function sha256(data) {
|
|
35
|
+
return new Uint8Array(await crypto.subtle.digest("SHA-256", data));
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=bytes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../src/internal/bytes.ts"],"names":[],"mappings":"AAAA,uFAAuF;AAEvF,iDAAiD;AACjD,MAAM,UAAU,KAAK,CAAC,CAAa;IACjC,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,KAAK,MAAM,CAAC,IAAI,CAAC;QAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACxD,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,CAAS;IAC/B,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC5H,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,GAAG,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACtF,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,GAAG,KAAmB;IAC3C,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;IACpE,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAChB,GAAG,IAAI,CAAC,CAAC,MAAM,CAAC;IAClB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,CAAS;IAC5B,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAgB;IAC3C,OAAO,IAAI,UAAU,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,IAA+B,CAAC,CAAC,CAAC;AAChG,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/** Binary field encodings of the attestation document, accepting exactly one encoding per byte string. */
|
|
2
|
+
const LOWER_HEX_RE = /^[0-9a-f]*$/;
|
|
3
|
+
/** Reports whether s contains only lowercase hex digits. Does not check length parity. */
|
|
4
|
+
export function isLowerHex(s) {
|
|
5
|
+
return LOWER_HEX_RE.test(s);
|
|
6
|
+
}
|
|
7
|
+
/** Decodes a required lowercase hex field of exactly `wantLen` bytes. */
|
|
8
|
+
export function decodeLowerHex(name, value, wantLen) {
|
|
9
|
+
if (!isLowerHex(value)) {
|
|
10
|
+
throw new Error(`${name} is not lowercase hex`);
|
|
11
|
+
}
|
|
12
|
+
if (value.length % 2 !== 0) {
|
|
13
|
+
throw new Error(`${name} is not hex: encoding/hex: odd length hex string`);
|
|
14
|
+
}
|
|
15
|
+
const b = new Uint8Array(value.length / 2);
|
|
16
|
+
for (let i = 0; i < b.length; i++) {
|
|
17
|
+
b[i] = parseInt(value.slice(i * 2, i * 2 + 2), 16);
|
|
18
|
+
}
|
|
19
|
+
if (b.length !== wantLen) {
|
|
20
|
+
throw new Error(`${name} must be ${wantLen} bytes, got ${b.length}`);
|
|
21
|
+
}
|
|
22
|
+
return b;
|
|
23
|
+
}
|
|
24
|
+
const B64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
25
|
+
const B64_INDEX = Object.create(null);
|
|
26
|
+
for (let i = 0; i < B64.length; i++)
|
|
27
|
+
B64_INDEX[B64[i]] = i;
|
|
28
|
+
/** Decodes a standard-base64 field, rejecting any non-canonical encoding (re-encode round trip). */
|
|
29
|
+
export function decodeBase64(name, value) {
|
|
30
|
+
const b = strictDecode(value);
|
|
31
|
+
if (b === undefined) {
|
|
32
|
+
throw new Error(`decoding ${name}: illegal base64 data`);
|
|
33
|
+
}
|
|
34
|
+
if (encode(b) !== value) {
|
|
35
|
+
throw new Error(`${name} is not canonical base64`);
|
|
36
|
+
}
|
|
37
|
+
return b;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Strict standard base64: skips '\r' and '\n', requires padding to a
|
|
41
|
+
* multiple of 4, and rejects non-zero padding bits. Returns undefined on any
|
|
42
|
+
* other malformed input.
|
|
43
|
+
*/
|
|
44
|
+
function strictDecode(input) {
|
|
45
|
+
const s = input.replace(/[\r\n]/g, "");
|
|
46
|
+
if (s.length % 4 !== 0)
|
|
47
|
+
return undefined;
|
|
48
|
+
const out = new Uint8Array((s.length / 4) * 3);
|
|
49
|
+
let n = 0;
|
|
50
|
+
for (let q = 0; q < s.length; q += 4) {
|
|
51
|
+
const last = q + 4 === s.length;
|
|
52
|
+
let pad = 0;
|
|
53
|
+
if (last && s[q + 3] === "=")
|
|
54
|
+
pad = s[q + 2] === "=" ? 2 : 1;
|
|
55
|
+
const v = [];
|
|
56
|
+
for (let k = 0; k < 4 - pad; k++) {
|
|
57
|
+
const d = B64_INDEX[s[q + k]];
|
|
58
|
+
if (d === undefined)
|
|
59
|
+
return undefined;
|
|
60
|
+
v.push(d);
|
|
61
|
+
}
|
|
62
|
+
const [a, b, c = 0, d = 0] = v;
|
|
63
|
+
const word = (a << 18) | (b << 12) | (c << 6) | d;
|
|
64
|
+
// Strict: the bits dropped by padding must be zero.
|
|
65
|
+
if (pad === 2 && (word & 0xffff) !== 0)
|
|
66
|
+
return undefined;
|
|
67
|
+
if (pad === 1 && (word & 0xff) !== 0)
|
|
68
|
+
return undefined;
|
|
69
|
+
out[n++] = word >> 16;
|
|
70
|
+
if (pad < 2)
|
|
71
|
+
out[n++] = (word >> 8) & 0xff;
|
|
72
|
+
if (pad < 1)
|
|
73
|
+
out[n++] = word & 0xff;
|
|
74
|
+
}
|
|
75
|
+
return out.slice(0, n);
|
|
76
|
+
}
|
|
77
|
+
/** base64.StdEncoding.EncodeToString. */
|
|
78
|
+
function encode(b) {
|
|
79
|
+
let s = "";
|
|
80
|
+
for (let i = 0; i < b.length; i += 3) {
|
|
81
|
+
const rem = b.length - i;
|
|
82
|
+
const word = (b[i] << 16) | ((rem > 1 ? b[i + 1] : 0) << 8) | (rem > 2 ? b[i + 2] : 0);
|
|
83
|
+
s += B64[word >> 18] + B64[(word >> 12) & 63];
|
|
84
|
+
s += rem > 1 ? B64[(word >> 6) & 63] : "=";
|
|
85
|
+
s += rem > 2 ? B64[word & 63] : "=";
|
|
86
|
+
}
|
|
87
|
+
return s;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=canonical.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical.js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