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

# Device signing vectors

> Cross-language test vectors for fau/1 device signatures — pin your phone/node implementations here.

Paired approval apps authenticate with Ed25519 over a canonical string. This page is
**self-contained**: you can implement a signer/verifier without access to any private
repository.

Scheme name: **`fau/1 device`**.

## Algorithm

1. Build the canonical string (UTF-8):

```
fau/1 device\n
<METHOD>\n
<target>\n
<timestamp>\n
<nonce>\n
<sha256(body) hex>
```

2. Sign with Ed25519 (raw 32-byte secret).
3. Send signature as **base64url** (no padding) in `X-FAU-Signature`.

Rules:

| Part | Rule |
| - | - |
| METHOD | Uppercased before signing (`post` → `POST`) |
| target | Exact path + query as on the wire |
| timestamp | Decimal ASCII, same as `X-FAU-Timestamp` |
| nonce | Same as `X-FAU-Nonce`; unique per request |
| body hash | Hex SHA-256 of raw body bytes; empty body → hash of `""` |

Headers on the request:

```http theme={null}
X-FAU-Device: dv_…
X-FAU-Timestamp: 1760000000
X-FAU-Nonce: …
X-FAU-Signature: …
Accept: application/json
```

## Test keypair

**For vectors only — never use in production.**

| Field | Value |
| - | - |
| Secret (base64url) | `AwoRGB8mLTQ7QklQV15lbHN6gYiPlp2kq7K5wMfO1dw` |
| Public (base64url) | `dVxMuSVsp83ErP3Gz-7ahJAX5bn5UU6ZGRvWfgsNQnY` |

SHA-256 of empty string:

`e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`

## Vectors

### 1. Bodyless GET (`/papi/pending`)

**Why:** commonest call — fetch pending approvals.

| Input | Value |
| - | - |
| method | `GET` |
| path | `/papi/pending` |
| timestamp | `1760000000` |
| nonce | `Zm9vYmFyMTIzNDU2Nzg5` |
| body | *(empty)* |

Canonical:

```
fau/1 device
GET
/papi/pending
1760000000
Zm9vYmFyMTIzNDU2Nzg5
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
```

Signature (base64url):

```
-u1lK6YcP5KxZVklIpT5zeAByb3unFdTa_OaA7v2rwkD6HJd1OAUgbRPKi43s1AptWcoBKFl3FTd4wXpaqcABg
```

### 2. GET with query (`/papi/activity?limit=50`)

**Why:** query string must be inside the signed target.

| Input | Value |
| - | - |
| method | `GET` |
| path | `/papi/activity?limit=50` |
| timestamp | `1760000001` |
| nonce | `bm9uY2UtZm9yLWFjdGl2aXR5` |
| body | *(empty)* |

Canonical ends with the empty-body hash. Signature:

```
_i_M_kDu3w3FVoHM-SJDj8qXZeGXPraSgp7HdG1DZrNFyFZ5nTOYRCYBasgorFrTYVPyNt7qhmgbU_Pj1CH6DQ
```

### 3. POST with JSON body

**Why:** body hash must match bytes exactly (no re-serialization after sign).

| Input | Value |
| - | - |
| method | `POST` |
| path | `/papi/decide` |
| timestamp | `1760000002` |
| nonce | `ZGVjaWRlLW5vbmNlLTAwMQ` |
| body | `{"approval_id":"ap_abc123","decision":"allow_30d"}` |

Signature:

```
PwcrT_Xndp0P9YNp9bXxO-iLtHleSH-d_zOcTtY0B3WgKkrOrkQ6O0QQty-bl3dh8CYUTphxVaFqXQfxYnT2BQ
```

Note: the body string above is the vector’s literal bytes. Production decisions use
values like `deny` / `once` / `30_days` — the point of this vector is hashing, not the
decision enum.

### 4. Lowercase method normalized

Input method `post` must sign as `POST`. Path `/papi/pause`, body `{"paused":true}`,
timestamp `1760000003`, nonce `cGF1c2Utbm9uY2UtMDAxMg`.

Signature:

```
pEIUM3CIJX8i_ny-YjrpQxX-Aavszc9_cDp3Go6P-CcYsMvC_NCinfOTi_dDLEAqmdz5wv6Po2vguBHSRypQCw
```

### 5. Non-ASCII JSON body

Body: `{"note":"Café — naïve ☕ 東京"}` (UTF-8). Path `/papi/decide`, timestamp
`1760000004`, nonce `dW5pY29kZS1ub25jZS0wMQ`.

Signature:

```
nRy2mQGbQvwCRzV719ruikwWj-NKHB0HHDaFGuQdotz-4vP8lRvClH4VDDFvcRbNcyKtIgGO7mj7Mv6dEd06AQ
```

## How to use these vectors

1. Implement canonicalization + sign + verify in your language.
2. Assert your canonical string **equals** each vector’s canonical (byte-for-byte).
3. Assert your signature verifies with the test public key (or matches exactly if your
   encoder is deterministic for the test secret).
4. Only then wire production keys.

If vector 2 fails, you almost certainly signed `/papi/activity` without `?limit=50`.

## Related

* [Phone API](https://docs.fau.run/developer/apps/phone-api.md)
* [Wire specification](https://docs.fau.run/developer/protocol/spec.md)
* [Apps signing guide](https://docs.fau.run/developer/apps/signing.md)


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