Getting Started
Relevant source files
The following files were used as context for generating this wiki page:
Tinfoil Verifier is a Go-based library designed to provide portable remote-attestation verification and a secure HTTP client for enclave-backed services. It allows developers to verify the integrity of remote enclaves, specifically AMD SEV-SNP and Intel TDX, and bind this verification directly to TLS connections.
The system is self-contained, requiring no external attestation service, and integrates with Sigstore for code provenance verification. It is versatile enough to be deployed as a standard Go library, a WASM module for browser environments, or integrated into mobile applications via Swift bindings.
Sources: README.md:1-15
Installation and Setup
To begin using the Tinfoil Verifier in a Go project, install the library using the standard Go package manager:
go get github.com/tinfoilsh/verifier@latest
Sources: README.md:17-19
Creating a Secure Client
The most direct way to interact with an enclave-backed service is via the client package. This package provides a SecureClient that handles attestation gates and TLS pinning automatically.
import "github.com/tinfoilsh/verifier/client"
// Initialize the client with the enclave hostname and the target repository
tinfoilClient := client.NewSecureClient("enclave.example.com", "org/repo")
Sources: README.md:21-26, examples/client/main.go:13-16
Architecture and Verification Flow
The verification process involves multiple steps to ensure the enclave is running the expected code on genuine hardware. This flow compares runtime measurements from the hardware against source measurements fetched from code repositories.
High-Level Verification Sequence
The following diagram illustrates the interaction between the Client, the Enclave, and external trust roots during the attestation process.
Core Components
| Component | Description | Relevant File |
|---|---|---|
| Secure Client | Wraps net/http to provide an attestation-gated http.Client. | client/client.go |
| Attestation Module | Handles platform-specific logic for AMD SEV-SNP and Intel TDX. | attestation/attestation.go |
| Sigstore Integration | Verifies code provenance using Rekor/Sigstore bundles. | sigstore/sigstore.go |
| WASM Verifier | Provides Go verification logic compiled for web browsers. | wasm/main.go |
Sources: README.md:39-60, attestation/attestation.go:20-50
Basic Usage Patterns
Transparent HTTP Requests
Once a SecureClient is initialized, standard HTTP methods like Get and Post can be used. The first request triggers an automatic attestation check.
headers := map[string]string{"Content-Type": "application/json"}
body := []byte(`{"messages":[{"role":"user","content":"Hi"}]}`)
resp, err := tinfoilClient.Post("/v1/chat/completions", headers, body)
if err != nil {
log.Fatal(err)
}
Sources: README.md:46-52, client/integration_test.go:68-80
Manual Verification
Developers can manually trigger verification to inspect the "Ground Truth" (verified measurements and keys).
groundTruth, err := tinfoilClient.Verify()
if err != nil {
log.Fatal(err)
}
// Access verified measurements
log.Printf("TLS Cert Fingerprint: %s", groundTruth.TLSPublicKey)
Sources: README.md:31-38, attestation/attestation.go:88-92
Platform Support
Tinfoil Verifier currently supports two primary Confidential Computing (CC) platforms.
| Platform | Verification Technique |
|---|---|
| AMD SEV-SNP | Validates VCEK certificates and SNP reports. |
| Intel TDX | Validates TDX quotes and TD report integrity. |
Sources: README.md:58-63, attestation/attestation.go:24-28
Measurement Types
Measurements are categorized by PredicateType to identify the environment and version of the attestation data.
const (
SevGuestV2 PredicateType = "https://tinfoil.sh/predicate/sev-snp-guest/v2"
TdxGuestV2 PredicateType = "https://tinfoil.sh/predicate/tdx-guest/v2"
SnpTdxMultiPlatformV1 PredicateType = "https://tinfoil.sh/predicate/snp-tdx-multiplatform/v1"
)
Sources: attestation/attestation.go:24-31
Web and Browser Integration
For browser-based applications, the project provides a WASM build. This allows the same Go-based verification logic to run natively in the browser via WebAssembly.
// Example JS usage
const go = new Go();
WebAssembly.instantiateStreaming(
fetch("https://tinfoilsh.github.io/verifier/tinfoil-verifier.wasm"),
go.importObject
).then((result) => {
go.run(result.instance);
verify("inference.example.com", "org/repo").then(console.log);
});
Sources: README.md:120-145, wasm/main.go:130-155
The WASM module exports several functions to the global JavaScript scope:
verify(enclaveHostname, repo): Performs complete end-to-end verification.verifyEnclave(enclaveHostname): Fetches and verifies only the enclave report.verifyCode(repo, digest): Verifies source code measurements via Sigstore.
Sources: wasm/main.go:163-168
Summary
The Tinfoil Verifier provides a streamlined path for implementing remote attestation in Go and Web environments. By utilizing the client package, developers can easily secure communications with enclave-backed services, ensuring that data is only exchanged with verified, untampered software running on genuine confidential computing hardware.
Sources: README.md:6-15