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

# Attestation check

> Verify signed attestation statements offline in TypeScript and Python, and check live revocation status.

An attestation is a signed `attestation/1` statement issued by TechnicallyFit when a coach witnesses
(level 3) or an approved organization certifies (level 4) a measurement. Both SDKs verify the
Ed25519 signature over the RFC 8785 canonical JSON statement offline against TechnicallyFit's
published public keys (`GET /v1/attestations/keys`).

Retired keys remain in the published key list and continue to verify statements signed before a
key rotation.

## What offline verification cannot see

Offline verification proves only that TechnicallyFit signed the statement and that the statement
was not altered. It cannot tell whether the attestor later revoked the attestation or whether the
teammate withdrew or erased the measurement.

To check live status, call `GET /v1/attestations/{attestation_id}/status` (anonymous, no API key
required), which answers `valid`, `revoked`, `withdrawn` or `unknown`.

## TypeScript

Import `verifyAttestation` from `@technicallyfit/sdk/attestations`. It uses Web Crypto only (no
Node-only dependencies).

```ts theme={null}
import { createClient } from '@technicallyfit/sdk';
import {
  AttestationVerificationError,
  verifyAttestation,
  type AttestationEnvelope,
} from '@technicallyfit/sdk/attestations';

export async function checkAttestation(attestation: AttestationEnvelope) {
  const tf = createClient();
  const keySet = await tf.GET('/v1/attestations/keys');

  try {
    const verified = await verifyAttestation({
      attestation,
      keys: keySet,
    });
    console.log('Verified with key:', verified.keyId, verified.keyStatus);
  } catch (error) {
    if (error instanceof AttestationVerificationError) {
      // reason is 'invalid_statement' | 'unknown_key' | 'signature_mismatch' | 'unsupported_runtime'
      console.error('Attestation check failed:', error.reason);
    }
    throw error;
  }
}
```

## Python

Import `verify_attestation` from `technicallyfit.attestations`. It uses pure Python standard
library code with no third-party cryptography dependency.

```python theme={null}
import os
from technicallyfit import TechnicallyFit
from technicallyfit.attestations import (
    AttestationVerificationError,
    verify_attestation,
)


def check_attestation(attestation: dict) -> None:
    tf = TechnicallyFit(api_key=os.environ["TF_API_KEY"])
    key_set = tf.request("GET", "/v1/attestations/keys")

    try:
        verified = verify_attestation(attestation, key_set)
        print("Verified with key:", verified.key_id, verified.key_status)
    except AttestationVerificationError as error:
        # error.reason is "invalid_statement" | "unknown_key" | "signature_mismatch"
        print("Attestation check failed:", error.reason)
        raise
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.