# Attestation bundles

An attestation bundle is the signed record a capture device makes for each photo or video, which the API verifies byte for byte.

An attestation bundle is the signed record a capture device makes for each photo or video, that binds the media's hash, time, location and device certificate under the device's key.

## When to use it

You work with bundles when you build your own capture app, debug a `signature_invalid` result, or hand a capture to a third party who wants to check it. The capture SDK makes and submits them for you.

## How it works

1. The device hashes the raw sensor bytes into `sensor_hash`.
2. It builds the bundle, serializes it as canonical JSON with `signature` set to `""` (keys sorted, no whitespace), and signs the SHA-256 of that with its ECDSA P-256 key.
3. For a photo, it embeds the bundle in the JPEG's XMP metadata under `provenance:AttestationBundle`, in the namespace `https://provenanceauth.com/ns/2.0/` (earlier files use `https://provenance.io/ns/1.0/`, which verifiers still read), so the proof travels with the pixels. For a video, the bundle is a [sidecar manifest](https://provenanceauth.com/docs/attest/concepts/video-attestation.md).

1. **Capture**: sensor bytes → sensor_hash
2. **Sign**: ECDSA P-256 over canonical JSON
3. **Verify**: signature, certificate, hash

Any change to any field after signing, even reformatting, fails [`signature_invalid`](https://provenanceauth.com/docs/platform/reason-codes.md#signature_invalid).

## Key fields

| Field | Type | Description |
| --- | --- | --- |
| `schema` | string | The bundle schema URI, `https://provenanceauth.com/claims/v2`. Bundles signed before November 2026 carry `https://provenance.io/claims/v1`, which still verifies. |
| `schema_version` | string | `2.0.0` (`1.1.0` on the earlier bundles; the fields are the same). |
| `attestation_id` | string | A UUIDv4 per capture; also the idempotency key on attest. |
| `device_id` | string | The enrolled device. |
| `device_cert` | string | The device's X.509 certificate, checked against the root CA. |
| `claim_id` | string \| null | Your claim or case ID. |
| `carrier_id` | string \| null | The carrier the capture belongs to. |
| `capture_type` | string | `image` or `video`. |
| `capture_timestamp` | string | When it was captured (RFC 3339). |
| `sensor_hash` | string | SHA-256 of the raw sensor bytes; for video, the chunk chain's root. |
| `gps` | object \| null | `lat`, `lng` and `accuracy_m`; optionally `fix_age_s` (the fix's age at the shutter) and, on Android, `is_mock` (the OS reported a mock location). |
| `biometric_present` | boolean | Whether a biometric check ran at capture. |
| `biometric_type` | string \| null | `face`, `fingerprint`, or `platform` when the phone checked a strong biometric but doesn't say which kind (Android with more than one sensor). Null when `biometric_present` is false. |
| `signature` | string | Base64url ECDSA P-256 signature over the canonical JSON. |
| `signature_algorithm` | string | `ECDSA-P256-SHA256`. |

Three optional fields describe the phone, as its OS reports them to the app: `time_zone` (an IANA zone), `locale` (a BCP 47 tag) and `device_model`. Each is signed when present and left out when unknown, so a bundle without them signs and verifies the same way.

A video bundle also carries `session_nonce` and `video_manifest`; see [video attestation](https://provenanceauth.com/docs/attest/concepts/video-attestation.md).

## What verification checks

Verify a bundle by its `attestation_id`, or by sending the image bytes with the bundle embedded:

**curl**

```bash
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_full_K7mN3xQp9RbT2vWm8sYd4cFjLhXn6gAe

curl $PROVENANCE_API/v1/attest/verifications \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "attestation_id": "att_00000000000000000000000000000001" }'
```

**Node**

```ts
import { Provenance } from "@provenanceauth/sdk";

const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY!, baseUrl: process.env.PROVENANCE_API });
const result = await prov.attest.verifications.create({ attestationId: "att_00000000000000000000000000000001" });
```

**Python**

```python
import os
from provenanceauth import Provenance

prov = Provenance(os.environ["PROVENANCE_KEY"], base_url=os.environ["PROVENANCE_API"])
result = prov.attest.verifications.create(attestation_id="att_00000000000000000000000000000001")
```

The response, trimmed:

```json
{
  "id": "att_00000000000000000000000000000001",
  "object": "verification_result",
  "status": "verified",
  "risk_score": 0,
  "risk_factors": [],
  "device_info": {
    "device_id": "dev_00000000000000000000000000000001",
    "enrolled": true,
    "cert_valid": true
  },
  "capture_type": "image"
}
```

## Export to C2PA

A bundle exports to a C2PA-style manifest: a COSE-Sign1 signature over a CBOR claim carrying the capture time, location, device and the `sensor_hash` binding. Export with `toC2paManifest(bundle)` in `@provenance/core` or the `provenance-c2pa export` command. The bundle stays the source of truth.

To check a C2PA manifest you received, use [`POST /v1/attest/media/verify_c2pa`](https://provenanceauth.com/docs/api/media.md#post-v1-attest-media-verify-c2pa). Its result is an advisory signal (`c2pa_present_valid` or `c2pa_invalid`) kept separate from the risk score.

**Limitations:** the export checks manifest structure and the claim signature. Provenance's signer isn't on a C2PA trust list, so a C2PA verifier reports the signature as valid with an unlisted signer.

## Related

- [Verification](https://provenanceauth.com/docs/attest/concepts/verification.md)
- [Risk scoring](https://provenanceauth.com/docs/attest/concepts/risk-scoring.md)
- [Device registry](https://provenanceauth.com/docs/attest/concepts/device-registry.md)
