> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prem.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Run Attestation

> Run confidential enclave attestation directly with Reticle.

The Prem SDK and the Confidential Proxy verify attestation automatically by default. You can also run attestation directly. The `@premai/reticle` library lets you request hardware evidence, run the cryptographic and policy checks, and verify confidential environments before you send data.

<Note>
  Direct verification requires your Prem API key. If you do not have an API key, create one in the [Prem Dashboard](https://dashboard.prem.io).
</Note>

## 1. Install Reticle

Install the Reticle verification package from npm:

```bash theme={"system"}
npm install @premai/reticle@0.5.1
```

Reticle contains WebAssembly modules and Rust cryptographic verifiers. It runs on Node.js, Bun, Deno, modern browsers, and mobile devices (iOS and Android via [React Native](/guides/react-native)).

## 2. Verify with the high-level client

Use `ClientBuilder` to connect to the gateway and verify the runtime:

```typescript theme={"system"}
import { ClientBuilder, QueryParams } from "@premai/reticle";

const apiKey = process.env.PREM_API_KEY;
const proxyUrl = process.env.PROXY_URL || "https://gateway.prem.io";

if (!apiKey) {
  throw new Error("Set the PREM_API_KEY environment variable");
}

// Initialize the Reticle client
const client = await new ClientBuilder(proxyUrl)
  .with_authorization(apiKey)
  .build();

// Set the target model query
client.set_query(new QueryParams().with("model", "deepseek-v4-flash"));

// Run full attestation
const result = await client.attest();

console.log("Verified modules:", result.modules());
console.log("GPU session ID:", result.headers().gpu()?.get("x-session-id"));
```

When you call `client.attest()`, Reticle does the following steps:

1. **Module discovery:** It asks the gateway for available CPU and GPU modules.
2. **Freshness validation:** It sends a fresh cryptographic nonce to prevent replay attacks.
3. **Signature verification:** It downloads manufacturer certificate material and verifies the hardware signature.
4. **Policy evaluation:** It evaluates the measured hardware state against configured golden policies.

## 3. Component verification

If you know the specific hardware architecture of your target backend, you can call individual verification methods directly:

```typescript theme={"system"}
// Verify AMD SEV-SNP CPU report
await client.attest_sev();

// Verify Intel TDX CPU quote
await client.attest_tdx();

// Verify NVIDIA GPU overall and detached tokens
await client.attest_nvidia();
```

<Warning>
  Do not use low-level request methods (`client.request_sev()`, `client.request_tdx()`, or `client.request_nvidia()`) for verification. Those methods download raw evidence but do not perform cryptographic checks. Always use `attest()` or the `attest_*()` methods.
</Warning>

## 4. Appraise measurements with golden policies

Cryptographic verification proves that the report came from genuine hardware. To make sure that the hardware runs an approved software image, Reticle queries Open Policy Agent (OPA) rules.

Prem publishes these rules in [prem-research/confidential-policies](https://github.com/prem-research/confidential-policies). The repository contains golden policies for:

* **AMD SEV-SNP** (`sev/policy.rego`): Evaluates guest policy and TCB levels.
* **Intel TDX** (`tdx/policy.rego`): Enforces debug restrictions and minimum SVN levels.
* **NVIDIA GPU** (`nvidia/policy.rego`): Validates device claims and token digests.

By default, the golden policies leave software measurements unpinned so they operate across different builds.

## Related

<CardGroup cols={2}>
  <Card title="Attestation Concept" icon="certificate" href="/attestation" arrow="true">
    Read the full attestation architecture and current implementation status.
  </Card>

  <Card title="Security Model" icon="shield-halved" href="/security-model" arrow="true">
    Understand the threat model and confidential computing boundaries.
  </Card>

  <Card title="Golden Policies" icon="github" href="https://github.com/prem-research/confidential-policies" arrow="true">
    Inspect the open Rego policies for SEV-SNP, TDX, and NVIDIA GPUs.
  </Card>

  <Card title="Mobile Example (Expo)" icon="mobile" href="https://github.com/prem-research/reticle-expo" arrow="true">
    See how to run on-device Reticle verification in React Native.
  </Card>
</CardGroup>
