@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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinfoilsh/verifier",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "AMD SEV-SNP
|
|
3
|
+
"version": "2.0.0-rc.2",
|
|
4
|
+
"description": "Tinfoil attestation document verifier (AMD SEV-SNP and Intel TDX) for Node.js and browsers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -14,19 +14,25 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "tsc",
|
|
17
|
+
"build": "tsc && node ../../scripts/prune-declarations.mjs dist dist/index.d.ts",
|
|
18
|
+
"build:conformance": "tsc -p conformance/tsconfig.json",
|
|
19
|
+
"check:types": "tsc -p tsconfig.test.json",
|
|
20
|
+
"lint": "eslint src conformance test scripts",
|
|
18
21
|
"test": "vitest run",
|
|
19
|
-
"test:
|
|
22
|
+
"test:conformance": "npm run build:conformance && TINFOIL_CONFORMANCE_FIXTURES=${TINFOIL_CONFORMANCE_FIXTURES:-../../../tinfoil-conformance/vectors/v3} vitest run test/conformance.test.ts",
|
|
20
23
|
"test:browser": "vitest run --config vite.config.playwright.ts",
|
|
21
|
-
"test:browser:integration": "vitest run --config vite.config.integration.ts",
|
|
22
|
-
"check:es2020": "acorn --ecma2020 --module --silent
|
|
23
|
-
"clean": "rm -rf dist",
|
|
24
|
-
"prepublishOnly": "npm run build"
|
|
24
|
+
"test:browser:integration": "RUN_TINFOIL_INTEGRATION=true vitest run --config vite.config.integration.ts",
|
|
25
|
+
"check:es2020": "test -n \"$(find dist -name '*.js')\" && find dist -name '*.js' -exec acorn --ecma2020 --module --silent {} +",
|
|
26
|
+
"clean": "rm -rf dist dist-conformance",
|
|
27
|
+
"prepublishOnly": "npm run build",
|
|
28
|
+
"sync:trust": "node scripts/sync-trust.mjs"
|
|
25
29
|
},
|
|
26
30
|
"keywords": [
|
|
27
31
|
"attestation",
|
|
28
32
|
"amd",
|
|
29
33
|
"sev-snp",
|
|
34
|
+
"intel",
|
|
35
|
+
"tdx",
|
|
30
36
|
"verifier"
|
|
31
37
|
],
|
|
32
38
|
"author": "Tinfoil",
|
|
@@ -39,12 +45,13 @@
|
|
|
39
45
|
"@types/node": "^26.1.1",
|
|
40
46
|
"@typescript-eslint/eslint-plugin": "^8.63.0",
|
|
41
47
|
"@typescript-eslint/parser": "^8.63.0",
|
|
42
|
-
"@vitest/browser": "^4.1.
|
|
43
|
-
"@vitest/browser-playwright": "^4.1.
|
|
44
|
-
"
|
|
48
|
+
"@vitest/browser": "^4.1.12",
|
|
49
|
+
"@vitest/browser-playwright": "^4.1.12",
|
|
50
|
+
"eslint": "^10.6.0",
|
|
45
51
|
"playwright": "^1.61.1",
|
|
52
|
+
"typescript-eslint": "^8.63.0",
|
|
46
53
|
"vite": "^8.1.4",
|
|
47
|
-
"vitest": "^4.1.
|
|
54
|
+
"vitest": "^4.1.12"
|
|
48
55
|
},
|
|
49
56
|
"files": [
|
|
50
57
|
"dist"
|
|
@@ -52,7 +59,8 @@
|
|
|
52
59
|
"dependencies": {
|
|
53
60
|
"@freedomofpress/crypto-browser": "^0.3.0",
|
|
54
61
|
"@freedomofpress/sigstore-browser": "^0.3.0",
|
|
55
|
-
"@freedomofpress/tuf-browser": "^0.3.0"
|
|
62
|
+
"@freedomofpress/tuf-browser": "^0.3.0",
|
|
63
|
+
"yaml": "^2.9.1"
|
|
56
64
|
},
|
|
57
65
|
"engines": {
|
|
58
66
|
"node": "^22.23.4 || ^24.22.1 || >=26.12.1"
|
package/dist/attestation.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { AttestationDocument, AttestationResponse } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Checks the attestation document against its trust root
|
|
4
|
-
* and returns the inner measurements.
|
|
5
|
-
*
|
|
6
|
-
* @param doc - The attestation document to verify
|
|
7
|
-
* @param vcekBase64 - VCEK certificate in base64-encoded DER format
|
|
8
|
-
* @returns The verification result
|
|
9
|
-
* @throws Error if verification fails or format is unsupported
|
|
10
|
-
*/
|
|
11
|
-
export declare function verifyAttestation(doc: AttestationDocument, vcekBase64: string): Promise<AttestationResponse>;
|
|
12
|
-
export declare function base64ToBytes(base64: string): Uint8Array;
|
|
13
|
-
export declare function decompressGzip(data: Uint8Array): Promise<Uint8Array>;
|
|
14
|
-
//# sourceMappingURL=attestation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attestation.d.ts","sourceRoot":"","sources":["../src/attestation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAS3E;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAMlH;AA+ED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAOxD;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAgB1E"}
|
package/dist/attestation.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { PredicateType } from './types.js';
|
|
2
|
-
import { Report } from './sev/report.js';
|
|
3
|
-
import { CertificateChain } from './sev/cert-chain.js';
|
|
4
|
-
import { verifyAttestation as verifyAttestationInternal } from './sev/verify.js';
|
|
5
|
-
import { bytesToHex } from './sev/utils.js';
|
|
6
|
-
import { validateReport, defaultValidationOptions } from './sev/validation.js';
|
|
7
|
-
import { AttestationError, wrapOrThrow } from './errors.js';
|
|
8
|
-
/**
|
|
9
|
-
* Checks the attestation document against its trust root
|
|
10
|
-
* and returns the inner measurements.
|
|
11
|
-
*
|
|
12
|
-
* @param doc - The attestation document to verify
|
|
13
|
-
* @param vcekBase64 - VCEK certificate in base64-encoded DER format
|
|
14
|
-
* @returns The verification result
|
|
15
|
-
* @throws Error if verification fails or format is unsupported
|
|
16
|
-
*/
|
|
17
|
-
export async function verifyAttestation(doc, vcekBase64) {
|
|
18
|
-
if (doc.format === PredicateType.SevGuestV2) {
|
|
19
|
-
return verifySevAttestationV2(doc.body, base64ToBytes(vcekBase64));
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
throw new AttestationError(`Unsupported attestation document format: "${doc.format}". Only SEV-SNP Guest V2 format is supported`);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Verify SEV attestation document and return verification result.
|
|
27
|
-
*
|
|
28
|
-
* @param attestationDoc - Base64 encoded attestation document
|
|
29
|
-
* @param vcekDer - Optional pre-fetched VCEK certificate in DER format
|
|
30
|
-
* @returns Verification result
|
|
31
|
-
* @throws Error if verification fails
|
|
32
|
-
*/
|
|
33
|
-
async function verifySevAttestationV2(attestationDoc, vcekDer) {
|
|
34
|
-
const report = await verifySevReport(attestationDoc, true, vcekDer);
|
|
35
|
-
const measurement = {
|
|
36
|
-
type: PredicateType.SevGuestV2,
|
|
37
|
-
registers: [bytesToHex(report.measurement)],
|
|
38
|
-
};
|
|
39
|
-
const keys = report.reportData;
|
|
40
|
-
const tlsKeyFp = bytesToHex(keys.slice(0, 32));
|
|
41
|
-
const hpkePublicKey = bytesToHex(keys.slice(32, 64));
|
|
42
|
-
return {
|
|
43
|
-
measurement,
|
|
44
|
-
tlsPublicKeyFingerprint: tlsKeyFp,
|
|
45
|
-
hpkePublicKey,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Verify SEV attestation document and return verification result.
|
|
50
|
-
*
|
|
51
|
-
* @param attestationDoc - Base64 encoded attestation document
|
|
52
|
-
* @param isCompressed - Whether the document is gzip compressed
|
|
53
|
-
* @param vcekDer - Optional pre-fetched VCEK certificate in DER format
|
|
54
|
-
* @returns The parsed and verified report
|
|
55
|
-
* @throws Error if verification fails
|
|
56
|
-
*/
|
|
57
|
-
async function verifySevReport(attestationDoc, isCompressed, vcekDer) {
|
|
58
|
-
let attDocBytes;
|
|
59
|
-
try {
|
|
60
|
-
attDocBytes = base64ToBytes(attestationDoc);
|
|
61
|
-
}
|
|
62
|
-
catch (e) {
|
|
63
|
-
throw new AttestationError('Failed to decode attestation document: Invalid base64 encoding', { cause: e });
|
|
64
|
-
}
|
|
65
|
-
if (isCompressed) {
|
|
66
|
-
attDocBytes = await decompressGzip(attDocBytes);
|
|
67
|
-
}
|
|
68
|
-
let report;
|
|
69
|
-
try {
|
|
70
|
-
report = new Report(attDocBytes);
|
|
71
|
-
}
|
|
72
|
-
catch (e) {
|
|
73
|
-
throw new AttestationError('Failed to parse SEV-SNP attestation report', { cause: e });
|
|
74
|
-
}
|
|
75
|
-
const chain = await CertificateChain.fromReport(report, vcekDer);
|
|
76
|
-
let res;
|
|
77
|
-
try {
|
|
78
|
-
res = await verifyAttestationInternal(chain, report);
|
|
79
|
-
}
|
|
80
|
-
catch (e) {
|
|
81
|
-
wrapOrThrow(e, AttestationError, 'Attestation cryptographic verification failed');
|
|
82
|
-
}
|
|
83
|
-
if (!res) {
|
|
84
|
-
throw new AttestationError('Attestation verification failed: Report signature or certificate chain is invalid');
|
|
85
|
-
}
|
|
86
|
-
try {
|
|
87
|
-
validateReport(report, chain, defaultValidationOptions);
|
|
88
|
-
}
|
|
89
|
-
catch (e) {
|
|
90
|
-
wrapOrThrow(e, AttestationError, 'Attestation policy validation failed');
|
|
91
|
-
}
|
|
92
|
-
return report;
|
|
93
|
-
}
|
|
94
|
-
export function base64ToBytes(base64) {
|
|
95
|
-
const binaryString = atob(base64);
|
|
96
|
-
const bytes = new Uint8Array(binaryString.length);
|
|
97
|
-
for (let i = 0; i < binaryString.length; i++) {
|
|
98
|
-
bytes[i] = binaryString.charCodeAt(i);
|
|
99
|
-
}
|
|
100
|
-
return bytes;
|
|
101
|
-
}
|
|
102
|
-
export async function decompressGzip(data) {
|
|
103
|
-
// Use DecompressionStream if available (browsers, Node.js 18+)
|
|
104
|
-
if (typeof DecompressionStream !== 'undefined') {
|
|
105
|
-
const stream = new Response(data.buffer).body;
|
|
106
|
-
if (!stream) {
|
|
107
|
-
throw new Error('Failed to create stream from data');
|
|
108
|
-
}
|
|
109
|
-
const decompressedStream = stream.pipeThrough(new DecompressionStream('gzip'));
|
|
110
|
-
const decompressed = await new Response(decompressedStream).arrayBuffer();
|
|
111
|
-
return new Uint8Array(decompressed);
|
|
112
|
-
}
|
|
113
|
-
// Fallback to Node.js/Bun zlib
|
|
114
|
-
const { gunzipSync } = await import('zlib');
|
|
115
|
-
return new Uint8Array(gunzipSync(data));
|
|
116
|
-
}
|
|
117
|
-
//# sourceMappingURL=attestation.js.map
|
package/dist/attestation.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attestation.js","sourceRoot":"","sources":["../src/attestation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,IAAI,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,GAAwB,EAAE,UAAkB;IAClF,IAAI,GAAG,CAAC,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,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAgB;IACnD,+DAA+D;IAC/D,IAAI,OAAO,mBAAmB,KAAK,WAAW,EAAE,CAAC;QAC/C,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAqB,CAAC,CAAC,IAAI,CAAC;QAC7D,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;QAED,MAAM,kBAAkB,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;QAC/E,MAAM,YAAY,GAAG,MAAM,IAAI,QAAQ,CAAC,kBAAkB,CAAC,CAAC,WAAW,EAAE,CAAC;QAC1E,OAAO,IAAI,UAAU,CAAC,YAAY,CAAC,CAAC;IACtC,CAAC;IAED,+BAA+B;IAC/B,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5C,OAAO,IAAI,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1C,CAAC"}
|
package/dist/bundle.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bundle assembler — fetches all attestation components and packages them
|
|
3
|
-
* into an AttestationBundle for verification.
|
|
4
|
-
*/
|
|
5
|
-
import type { AttestationBundle } from './types.js';
|
|
6
|
-
/**
|
|
7
|
-
* Assemble a complete attestation bundle by fetching all components
|
|
8
|
-
* directly from the enclave and public infrastructure.
|
|
9
|
-
* Each network call is retried up to 2 times on transient failure.
|
|
10
|
-
*
|
|
11
|
-
* @throws FetchError on I/O failure (after retries)
|
|
12
|
-
* @throws AttestationError if the attestation report cannot be parsed
|
|
13
|
-
*/
|
|
14
|
-
export declare function assembleAttestationBundle(enclaveHost: string, configRepo: string): Promise<AttestationBundle>;
|
|
15
|
-
//# sourceMappingURL=bundle.d.ts.map
|
package/dist/bundle.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,YAAY,CAAC;AAUzE;;;;;;;GAOG;AACH,wBAAsB,yBAAyB,CAC7C,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,iBAAiB,CAAC,CAyD5B"}
|
package/dist/bundle.js
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bundle assembler — fetches all attestation components and packages them
|
|
3
|
-
* into an AttestationBundle for verification.
|
|
4
|
-
*/
|
|
5
|
-
import { base64ToBytes, decompressGzip } from './attestation.js';
|
|
6
|
-
import { Report } from './sev/report.js';
|
|
7
|
-
import { tcbFromInt, bytesToHex } from './sev/utils.js';
|
|
8
|
-
import { AttestationError, FetchError, wrapOrThrow } from './errors.js';
|
|
9
|
-
import { PredicateType } from './types.js';
|
|
10
|
-
import { VERIFIER_NAME, VERIFIER_VERSION } from './version.js';
|
|
11
|
-
const GITHUB_PROXY = 'https://github-proxy.tinfoil.sh';
|
|
12
|
-
const KDS = 'https://kds-proxy.tinfoil.sh';
|
|
13
|
-
const ATTESTATION_HEADERS = {
|
|
14
|
-
'Tinfoil-SDK': VERIFIER_NAME,
|
|
15
|
-
'Tinfoil-SDK-Version': VERIFIER_VERSION,
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Assemble a complete attestation bundle by fetching all components
|
|
19
|
-
* directly from the enclave and public infrastructure.
|
|
20
|
-
* Each network call is retried up to 2 times on transient failure.
|
|
21
|
-
*
|
|
22
|
-
* @throws FetchError on I/O failure (after retries)
|
|
23
|
-
* @throws AttestationError if the attestation report cannot be parsed
|
|
24
|
-
*/
|
|
25
|
-
export async function assembleAttestationBundle(enclaveHost, configRepo) {
|
|
26
|
-
// 1. Fetch independent resources in parallel
|
|
27
|
-
const [attestation, release, enclaveCert] = await Promise.all([
|
|
28
|
-
withRetry(async () => {
|
|
29
|
-
const doc = await fetchJson(`https://${enclaveHost}/.well-known/tinfoil-attestation`, { headers: ATTESTATION_HEADERS });
|
|
30
|
-
return { format: doc.format, body: doc.body };
|
|
31
|
-
}),
|
|
32
|
-
withRetry(async () => {
|
|
33
|
-
const { tag_name } = await fetchJson(`${GITHUB_PROXY}/repos/${configRepo}/releases/latest`);
|
|
34
|
-
const digest = (await fetchText(`${GITHUB_PROXY}/${configRepo}/releases/download/${tag_name}/tinfoil.hash`)).trim();
|
|
35
|
-
return { tag: tag_name, digest };
|
|
36
|
-
}),
|
|
37
|
-
withRetry(async () => {
|
|
38
|
-
const data = await fetchJson(`https://${enclaveHost}/.well-known/tinfoil-certificate`);
|
|
39
|
-
return data.certificate;
|
|
40
|
-
}),
|
|
41
|
-
]);
|
|
42
|
-
// 2. Fetch Sigstore bundle (needs digest)
|
|
43
|
-
const sigstoreBundle = await withRetry(async () => {
|
|
44
|
-
const data = await fetchJson(`${GITHUB_PROXY}/repos/${configRepo}/attestations/sha256:${release.digest}`);
|
|
45
|
-
if (!data.attestations?.[0]?.bundle) {
|
|
46
|
-
throw new FetchError(`No Sigstore bundle for ${configRepo} at digest ${release.digest}`);
|
|
47
|
-
}
|
|
48
|
-
return data.attestations[0].bundle;
|
|
49
|
-
});
|
|
50
|
-
// 3. Parse attestation report
|
|
51
|
-
let report;
|
|
52
|
-
try {
|
|
53
|
-
report = new Report(await decompressGzip(base64ToBytes(attestation.body)));
|
|
54
|
-
}
|
|
55
|
-
catch (e) {
|
|
56
|
-
wrapOrThrow(e, AttestationError, 'Failed to parse attestation report');
|
|
57
|
-
}
|
|
58
|
-
// 4. Fetch VCEK certificate from AMD KDS (needs parsed report)
|
|
59
|
-
const vcek = await withRetry(async () => {
|
|
60
|
-
const tcb = tcbFromInt(report.reportedTcb);
|
|
61
|
-
const chip = bytesToHex(report.chipId);
|
|
62
|
-
const der = await fetchBinary(`${KDS}/vcek/v1/${report.productName}/${chip}?blSPL=${tcb.blSpl}&teeSPL=${tcb.teeSpl}&snpSPL=${tcb.snpSpl}&ucodeSPL=${tcb.ucodeSpl}`);
|
|
63
|
-
let bin = '';
|
|
64
|
-
for (let i = 0; i < der.length; i++)
|
|
65
|
-
bin += String.fromCharCode(der[i]);
|
|
66
|
-
return btoa(bin);
|
|
67
|
-
});
|
|
68
|
-
return {
|
|
69
|
-
domain: enclaveHost,
|
|
70
|
-
enclaveAttestationReport: attestation,
|
|
71
|
-
digest: release.digest,
|
|
72
|
-
releaseTag: release.tag,
|
|
73
|
-
sigstoreBundle,
|
|
74
|
-
vcek,
|
|
75
|
-
enclaveCert,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
// ---------------------------------------------------------------------------
|
|
79
|
-
// Retry and typed fetch helpers
|
|
80
|
-
// ---------------------------------------------------------------------------
|
|
81
|
-
const MAX_RETRIES = 2;
|
|
82
|
-
/** Retry on transient FetchError with exponential backoff (0.5s, 1s, 2s). */
|
|
83
|
-
async function withRetry(fn) {
|
|
84
|
-
for (let i = 0; i <= MAX_RETRIES; i++) {
|
|
85
|
-
try {
|
|
86
|
-
return await fn();
|
|
87
|
-
}
|
|
88
|
-
catch (e) {
|
|
89
|
-
if (i === MAX_RETRIES || !(e instanceof FetchError))
|
|
90
|
-
throw e;
|
|
91
|
-
}
|
|
92
|
-
await new Promise(r => setTimeout(r, 500 * Math.pow(2, i)));
|
|
93
|
-
}
|
|
94
|
-
throw new Error('unreachable');
|
|
95
|
-
}
|
|
96
|
-
/** Fetch a URL, throwing FetchError on non-OK or network failure. */
|
|
97
|
-
async function fetchOk(url, init) {
|
|
98
|
-
let response;
|
|
99
|
-
try {
|
|
100
|
-
response = await fetch(url, init);
|
|
101
|
-
}
|
|
102
|
-
catch (e) {
|
|
103
|
-
throw new FetchError(`Network error: ${url}`, { cause: e });
|
|
104
|
-
}
|
|
105
|
-
if (!response.ok) {
|
|
106
|
-
throw new FetchError(`HTTP ${response.status}: ${url}`);
|
|
107
|
-
}
|
|
108
|
-
return response;
|
|
109
|
-
}
|
|
110
|
-
async function fetchJson(url, init) {
|
|
111
|
-
try {
|
|
112
|
-
return await (await fetchOk(url, init)).json();
|
|
113
|
-
}
|
|
114
|
-
catch (e) {
|
|
115
|
-
wrapOrThrow(e, FetchError, `Invalid response from ${url}`);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
async function fetchText(url) {
|
|
119
|
-
try {
|
|
120
|
-
return await (await fetchOk(url)).text();
|
|
121
|
-
}
|
|
122
|
-
catch (e) {
|
|
123
|
-
wrapOrThrow(e, FetchError, `Invalid response from ${url}`);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
async function fetchBinary(url) {
|
|
127
|
-
try {
|
|
128
|
-
return new Uint8Array(await (await fetchOk(url)).arrayBuffer());
|
|
129
|
-
}
|
|
130
|
-
catch (e) {
|
|
131
|
-
wrapOrThrow(e, FetchError, `Invalid response from ${url}`);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
//# sourceMappingURL=bundle.js.map
|
package/dist/bundle.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,aAAa,EAA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package/dist/cert-verify.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Certificate verification for enclave TLS certificates.
|
|
3
|
-
*
|
|
4
|
-
* Verifies that:
|
|
5
|
-
* 1. Certificate is valid for the expected domain
|
|
6
|
-
* 2. Certificate SANs contain the correct HPKE key
|
|
7
|
-
* 3. Certificate SANs contain the correct attestation hash
|
|
8
|
-
*/
|
|
9
|
-
import type { AttestationDocument } from './types.js';
|
|
10
|
-
export interface CertVerificationResult {
|
|
11
|
-
/** HPKE public key extracted from certificate (hex) */
|
|
12
|
-
hpkePublicKey: string;
|
|
13
|
-
/** Attestation document hash extracted from certificate (hex) */
|
|
14
|
-
attestationHash: string;
|
|
15
|
-
/** DNS names from certificate SANs */
|
|
16
|
-
dnsNames: string[];
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Verify enclave TLS certificate.
|
|
20
|
-
*
|
|
21
|
-
* @param certPem - PEM-encoded certificate
|
|
22
|
-
* @param expectedDomain - Expected domain name
|
|
23
|
-
* @param attestationDoc - Attestation document to verify hash against
|
|
24
|
-
* @param expectedHpkeKey - Expected HPKE public key (hex)
|
|
25
|
-
* @returns Verification result with extracted values
|
|
26
|
-
* @throws AttestationError if certificate parsing or decoding fails
|
|
27
|
-
* @throws AttestationError if certificate values don't match expected values
|
|
28
|
-
*/
|
|
29
|
-
export declare function verifyCertificate(certPem: string, expectedDomain: string, attestationDoc: AttestationDocument, expectedHpkeKey: string): Promise<CertVerificationResult>;
|
|
30
|
-
//# sourceMappingURL=cert-verify.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cert-verify.d.ts","sourceRoot":"","sources":["../src/cert-verify.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AA4DtD,MAAM,WAAW,sBAAsB;IACrC,uDAAuD;IACvD,aAAa,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,eAAe,EAAE,MAAM,CAAC;IACxB,sCAAsC;IACtC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,mBAAmB,EACnC,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,sBAAsB,CAAC,CA+EjC"}
|
package/dist/cert-verify.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Certificate verification for enclave TLS certificates.
|
|
3
|
-
*
|
|
4
|
-
* Verifies that:
|
|
5
|
-
* 1. Certificate is valid for the expected domain
|
|
6
|
-
* 2. Certificate SANs contain the correct HPKE key
|
|
7
|
-
* 3. Certificate SANs contain the correct attestation hash
|
|
8
|
-
*/
|
|
9
|
-
import { X509Certificate } from '@freedomofpress/sigstore-browser';
|
|
10
|
-
import { ASN1Obj } from '@freedomofpress/crypto-browser';
|
|
11
|
-
import { decodeDomains, bytesToHex } from './dcode.js';
|
|
12
|
-
import { hashAttestationDocument } from './types.js';
|
|
13
|
-
import { AttestationError } from './errors.js';
|
|
14
|
-
/**
|
|
15
|
-
* Extract DNS names from Subject Alternative Name extension
|
|
16
|
-
* Uses ASN1Obj parser for proper ASN.1 handling
|
|
17
|
-
*/
|
|
18
|
-
function extractSANs(cert) {
|
|
19
|
-
// OID 2.5.29.17 = Subject Alternative Name (RFC 5280)
|
|
20
|
-
const sanExtension = cert.extension('2.5.29.17');
|
|
21
|
-
if (!sanExtension) {
|
|
22
|
-
return [];
|
|
23
|
-
}
|
|
24
|
-
const sans = [];
|
|
25
|
-
const asn1 = ASN1Obj.parseBuffer(sanExtension.value);
|
|
26
|
-
// Iterate over GeneralName sequence (RFC 5280 section 4.2.1.6)
|
|
27
|
-
for (const generalName of asn1.subs) {
|
|
28
|
-
// Context-specific tag [2] = dNSName (IA5String)
|
|
29
|
-
if (generalName.tag.number === 2 && !generalName.tag.constructed) {
|
|
30
|
-
sans.push(new TextDecoder().decode(generalName.value));
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return sans;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Get the parent domain (e.g., "sub.example.com" -> "example.com")
|
|
37
|
-
*/
|
|
38
|
-
function getParentDomain(domain) {
|
|
39
|
-
const parts = domain.split('.');
|
|
40
|
-
if (parts.length <= 2) {
|
|
41
|
-
return domain;
|
|
42
|
-
}
|
|
43
|
-
return parts.slice(1).join('.');
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Check if a domain matches any of the SANs (including wildcards)
|
|
47
|
-
*/
|
|
48
|
-
function domainMatchesSans(sans, expectedDomain) {
|
|
49
|
-
const parentDomain = getParentDomain(expectedDomain);
|
|
50
|
-
for (const san of sans) {
|
|
51
|
-
// Exact match
|
|
52
|
-
if (san === expectedDomain) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
// Wildcard match (*.example.com matches sub.example.com, but NOT example.com)
|
|
56
|
-
// Per RFC 6125, wildcards only match a single label, not the apex domain
|
|
57
|
-
if (san.startsWith('*.') && san.substring(2) === parentDomain && expectedDomain !== parentDomain) {
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Verify enclave TLS certificate.
|
|
65
|
-
*
|
|
66
|
-
* @param certPem - PEM-encoded certificate
|
|
67
|
-
* @param expectedDomain - Expected domain name
|
|
68
|
-
* @param attestationDoc - Attestation document to verify hash against
|
|
69
|
-
* @param expectedHpkeKey - Expected HPKE public key (hex)
|
|
70
|
-
* @returns Verification result with extracted values
|
|
71
|
-
* @throws AttestationError if certificate parsing or decoding fails
|
|
72
|
-
* @throws AttestationError if certificate values don't match expected values
|
|
73
|
-
*/
|
|
74
|
-
export async function verifyCertificate(certPem, expectedDomain, attestationDoc, expectedHpkeKey) {
|
|
75
|
-
// 1. Parse PEM certificate
|
|
76
|
-
let cert;
|
|
77
|
-
try {
|
|
78
|
-
cert = X509Certificate.parse(certPem);
|
|
79
|
-
}
|
|
80
|
-
catch (error) {
|
|
81
|
-
throw new AttestationError(`Failed to parse enclave TLS certificate: ${error.message}`, { cause: error });
|
|
82
|
-
}
|
|
83
|
-
// 2. Extract SANs
|
|
84
|
-
const sans = extractSANs(cert);
|
|
85
|
-
if (sans.length === 0) {
|
|
86
|
-
throw new AttestationError('Invalid enclave certificate: No Subject Alternative Names found');
|
|
87
|
-
}
|
|
88
|
-
// 3. Verify domain
|
|
89
|
-
if (!domainMatchesSans(sans, expectedDomain)) {
|
|
90
|
-
throw new AttestationError(`Certificate domain mismatch: Certificate is not valid for "${expectedDomain}"`);
|
|
91
|
-
}
|
|
92
|
-
// 4. Extract and verify HPKE key
|
|
93
|
-
const hpkeSans = sans.filter(s => s.includes('.hpke.'));
|
|
94
|
-
if (hpkeSans.length === 0) {
|
|
95
|
-
throw new AttestationError('Invalid enclave certificate: No HPKE key embedded in Subject Alternative Names');
|
|
96
|
-
}
|
|
97
|
-
let hpkeKeyBytes;
|
|
98
|
-
try {
|
|
99
|
-
hpkeKeyBytes = decodeDomains(hpkeSans, 'hpke');
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
throw new AttestationError(`Failed to extract HPKE key from certificate: ${error.message}`, { cause: error });
|
|
103
|
-
}
|
|
104
|
-
const hpkePublicKey = bytesToHex(hpkeKeyBytes);
|
|
105
|
-
if (hpkePublicKey !== expectedHpkeKey) {
|
|
106
|
-
throw new AttestationError('HPKE key mismatch: The encryption key in the certificate does not match the attested key');
|
|
107
|
-
}
|
|
108
|
-
// 5. Extract and verify attestation hash
|
|
109
|
-
const hattSans = sans.filter(s => s.includes('.hatt.'));
|
|
110
|
-
if (hattSans.length === 0) {
|
|
111
|
-
throw new AttestationError('Invalid enclave certificate: No attestation hash embedded in Subject Alternative Names');
|
|
112
|
-
}
|
|
113
|
-
let hashBytes;
|
|
114
|
-
try {
|
|
115
|
-
hashBytes = decodeDomains(hattSans, 'hatt');
|
|
116
|
-
}
|
|
117
|
-
catch (error) {
|
|
118
|
-
throw new AttestationError(`Failed to extract attestation hash from certificate: ${error.message}`, { cause: error });
|
|
119
|
-
}
|
|
120
|
-
// The hash is stored as the hex string bytes
|
|
121
|
-
const certAttestationHash = new TextDecoder().decode(hashBytes);
|
|
122
|
-
const computedHash = await hashAttestationDocument(attestationDoc);
|
|
123
|
-
if (certAttestationHash !== computedHash) {
|
|
124
|
-
throw new AttestationError('Attestation hash mismatch: The hash in the certificate does not match the attestation document');
|
|
125
|
-
}
|
|
126
|
-
return {
|
|
127
|
-
hpkePublicKey,
|
|
128
|
-
attestationHash: computedHash,
|
|
129
|
-
dnsNames: sans,
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=cert-verify.js.map
|
package/dist/cert-verify.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cert-verify.js","sourceRoot":"","sources":["../src/cert-verify.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C;;;GAGG;AACH,SAAS,WAAW,CAAC,IAAqB;IACxC,sDAAsD;IACtD,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACjD,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,IAAI,GAAa,EAAE,CAAC;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,KAAc,EAAE,CAC1B,CAAC;IACJ,CAAC;IAED,MAAM,aAAa,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAC/C,IAAI,aAAa,KAAK,eAAe,EAAE,CAAC;QACtC,MAAM,IAAI,gBAAgB,CACxB,0FAA0F,CAC3F,CAAC;IACJ,CAAC;IAED,yCAAyC;IACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,gBAAgB,CAAC,wFAAwF,CAAC,CAAC;IACvH,CAAC;IAED,IAAI,SAAqB,CAAC;IAC1B,IAAI,CAAC;QACH,SAAS,GAAG,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,gBAAgB,CACxB,wDAAyD,KAAe,CAAC,OAAO,EAAE,EAClF,EAAE,KAAK,EAAE,KAAc,EAAE,CAC1B,CAAC;IACJ,CAAC;IAED,6CAA6C;IAC7C,MAAM,mBAAmB,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAChE,MAAM,YAAY,GAAG,MAAM,uBAAuB,CAAC,cAAc,CAAC,CAAC;IAEnE,IAAI,mBAAmB,KAAK,YAAY,EAAE,CAAC;QACzC,MAAM,IAAI,gBAAgB,CACxB,gGAAgG,CACjG,CAAC;IACJ,CAAC;IAED,OAAO;QACL,aAAa;QACb,eAAe,EAAE,YAAY;QAC7B,QAAQ,EAAE,IAAI;KACf,CAAC;AACJ,CAAC"}
|
package/dist/client.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { AttestationResponse, VerificationDocument, AttestationBundle } from './types.js';
|
|
2
|
-
export interface VerifierOptions {
|
|
3
|
-
/** Server URL for fetching attestation. Required when using verify(), optional when using verifyBundle(). */
|
|
4
|
-
serverURL?: string;
|
|
5
|
-
configRepo: string;
|
|
6
|
-
}
|
|
7
|
-
export declare class Verifier {
|
|
8
|
-
private serverURL?;
|
|
9
|
-
private configRepo;
|
|
10
|
-
private verificationDocument?;
|
|
11
|
-
constructor(options: VerifierOptions);
|
|
12
|
-
verify(): Promise<AttestationResponse>;
|
|
13
|
-
verifyBundle(bundle: AttestationBundle): Promise<AttestationResponse>;
|
|
14
|
-
private saveFailedVerificationDocument;
|
|
15
|
-
getVerificationDocument(): VerificationDocument | undefined;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,iBAAiB,EAAoB,MAAM,YAAY,CAAC;AASjH,MAAM,WAAW,eAAe;IAC9B,6GAA6G;IAC7G,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,QAAQ;IACnB,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,oBAAoB,CAAC,CAAuB;gBAExC,OAAO,EAAE,eAAe;IAQ9B,MAAM,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAStC,YAAY,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAgG3E,OAAO,CAAC,8BAA8B;IAmBtC,uBAAuB,IAAI,oBAAoB,GAAG,SAAS;CAK5D"}
|