The Verification Center is an embeddable iframe that displays the status of Tinfoil’s enclave verification process. It shows users the cryptographic proof that their data is being processed in a verified secure enclave. You can see it live at chat.tinfoil.sh.This guide covers how to embed the Verification Center in your web application and feed it verification data from the Tinfoil JavaScript SDK.
Use the Tinfoil SDK to get the verification document and send it to the iframe via postMessage. You can use either TinfoilAI (OpenAI-compatible) or SecureClient (low-level):
TinfoilAI
SecureClient
import { TinfoilAI } from "tinfoil";const client = new TinfoilAI({ apiKey: "<YOUR_API_KEY>" });await client.ready();const verificationDoc = await client.getVerificationDocument();const iframe = document.getElementById("tinfoil-verification") as HTMLIFrameElement;// Wait for the iframe to signal it's readywindow.addEventListener("message", (event) => { if (event.origin !== "https://verification-center.tinfoil.sh") return; if (event.data.type === "TINFOIL_VERIFICATION_CENTER_READY") { iframe.contentWindow?.postMessage( { type: "TINFOIL_VERIFICATION_DOCUMENT", document: verificationDoc, }, "https://verification-center.tinfoil.sh" ); }});
import { SecureClient } from "tinfoil";const client = new SecureClient({ enclaveURL: "https://<CONTAINER_URL>", configRepo: "<CONFIG_REPO>",});await client.ready();const verificationDoc = client.getVerificationDocument();const iframe = document.getElementById("tinfoil-verification") as HTMLIFrameElement;// Wait for the iframe to signal it's readywindow.addEventListener("message", (event) => { if (event.origin !== "https://verification-center.tinfoil.sh") return; if (event.data.type === "TINFOIL_VERIFICATION_CENTER_READY") { iframe.contentWindow?.postMessage( { type: "TINFOIL_VERIFICATION_DOCUMENT", document: verificationDoc, }, "https://verification-center.tinfoil.sh" ); }});
Listen for these messages from the Verification Center:
window.addEventListener("message", (event) => { // Only handle messages from the Verification Center if (event.origin !== "https://verification-center.tinfoil.sh") return; switch (event.data.type) { case "TINFOIL_VERIFICATION_CENTER_READY": // Iframe is ready to receive verification data break; case "TINFOIL_REQUEST_VERIFICATION_DOCUMENT": // Iframe is requesting a fresh verification document break; }});
The verification document contains the results of the three-step verification process:
interface VerificationDocument { // Repository and enclave information configRepo: string; // GitHub repo (e.g., "tinfoilsh/confidential-gpt-oss-120b") enclaveHost: string; // Enclave hostname releaseDigest: string; // SHA256 digest of the release // Cryptographic measurements codeMeasurement: object; // Measurement from Sigstore verification enclaveMeasurement: object; // Measurement from enclave attestation codeFingerprint: string; // SHA-256 fingerprint of code enclaveFingerprint: string; // SHA-256 fingerprint of enclave // Verification status securityVerified: boolean; // True if all checks passed steps: { fetchDigest: StepState; verifyCode: StepState; verifyEnclave: StepState; compareMeasurements: StepState; verifyCertificate: StepState; };}interface StepState { status: "pending" | "success" | "failed"; error?: string;}
The securityVerified field indicates whether all verification steps passed. Individual step statuses are available in the steps object for granular status display.The getVerificationDocument() method is available on both TinfoilAI and SecureClient. On TinfoilAI it returns a promise; on SecureClient it returns synchronously after ready() has resolved.