@super-protocol/attestation-wasm
v0.1.1
Published
Shared Go WASM attestation verifier for browser extensions and Node.js.
Keywords
Readme
@super-protocol/attestation-wasm
Shared Go/WASM attestation verifier for browser extensions and Node.js.
The package exposes one TypeScript API backed by shared Go code compiled with GOOS=js GOARCH=wasm.
Entrypoints:
@super-protocol/attestation-wasm/browserfor Chrome extension and Vite/browser usage.@super-protocol/attestation-wasm/nodefor Node.js usage on a PC.@super-protocol/attestation-wasmas the default public entrypoint.
The runtime model is an async singleton: WASM initialization happens lazily once per JavaScript runtime, and public APIs return promises.
Usage
import { createAttestationVerifier } from '@super-protocol/attestation-wasm';
const verifier = await createAttestationVerifier();
const result = await verifier.verifyTdxQuote(quoteBytes);For one-off calls:
import { verifyTdxQuote } from '@super-protocol/attestation-wasm';
const result = await verifyTdxQuote(quoteBytes);The verifier expects a raw Intel TDX quote as Uint8Array or ArrayBuffer. By default, Intel PCS collateral and CRL checks are enabled. In browser extensions, run verification from an extension context with the required host_permissions, not from a content script.
verifyTdxQuote accepts TDX-only call options directly:
await verifier.verifyTdxQuote(quoteBytes, {
getCollateral: true,
checkRevocations: true,
});verifyTeeEvidence accepts per-evidence options:
await verifier.verifyTeeEvidence(serializedTeeEvidence, {
tdx: {
getCollateral: true,
checkRevocations: true,
},
sevSnp: {},
});Verification results include logs captured from the underlying Go verifier. For APIs that throw, the thrown error also carries logs.
verifyTdxQuote returns separate verification checks so callers can make their own policy decision:
const { result, logs } = await verifier.verifyTdxQuote(quoteBytes);
result.quoteIntegrity; // true when the quote is cryptographically valid
// true when CRL was checked and the cert chain is not revoked;
// false when CRL was requested and the check did not confirm a clean status
// (cert revoked OR CRL fetch/parse failed — these are not distinguished);
// undefined when CRL was not requested or could not be evaluated.
result.certChainRevocationStatusOk;
result.tdxTcbStatus; // e.g. 'UpToDate' or 'OutOfDate'; undefined when not checked
result.qeTcbStatus;
logs; // logs captured from the underlying Go verifierThere is no top-level verdict in the TDX result. Callers decide whether to accept the evidence from the individual checks and TCB statuses. Invalid quotes and unclassified verifier failures throw instead of returning a structured failure state.
To use PCCS instead of Intel PCS, pass the same pccsUrl shape used by sgx_default_qcnl.conf:
await verifier.verifyTdxQuote(quoteBytes, {
pccsUrl: 'https://pccs.example.com:8081/sgx/certification/v4/',
});
await verifier.verifyTeeEvidence(serializedTeeEvidence, {
tdx: {
pccsUrl: 'https://pccs.example.com:8081/sgx/certification/v4/',
},
});The value may include /sgx/certification/v4/, matching QCNL config, or just the PCCS server root. Intel PCS URLs keep their original /tdx/certification/v4/... or /sgx/certification/v4/... paths on that PCCS server. Intel Root CA CRL distribution URL is mapped to /sgx/certification/v4/rootcacrl and decoded from PCCS hex response to DER bytes for go-tdx-guest.
If pccsUrl is omitted, Intel PCS URLs are used as provided by go-tdx-guest.
Network retries follow go-tdx-guest defaults unless overridden:
await verifier.verifyTeeEvidence(serializedTeeEvidence, {
tdx: {
network: {
timeoutMs: 120_000,
initialRetryDelayMs: 2_000,
maxRetryDelayMs: 30_000,
retries: true,
},
},
});Dependencies
This package pins github.com/google/go-tdx-guest to a pre-release pseudo-version rather than the latest release tag (v0.3.1). The reason is that v0.3.1 does not expose SupportedTcbLevelsFromCollateral (or an equivalent), so TCB/QE status cannot be read separately from the verdict — any OutOfDate (and similar non-fatal) status causes the whole verification to fail. That is too strict for our use case: we surface tdxTcbStatus and qeTcbStatus in the result and let the caller apply its own policy on which statuses are acceptable.
The pseudo-version will be replaced with the next upstream release tag that contains the required APIs.
Build
npm install
npm run buildThe build compiles TypeScript, builds go/cmd/tdx-wasm to dist/tdx_verifier.wasm, and copies wasm_exec.js from the same Go toolchain into dist/.
