# Make a key, sign and encrypt with it

You are given an API key (`pkk_…`), once, with your account. Keep it on your server. Every call below sends `Authorization: Bearer <api key>`. `input`, `plaintext` and results are base64.

## Make a key

```sh
curl -X POST https://keys.praecise.com/keys -H "Authorization: Bearer $KEYS_API_KEY" -H "content-type: application/json" \
  -d '{"name":"release-signing","kind":"ed25519"}'
```

Kinds: `ed25519`, `ecdsa-p256` (sign) and `aes256-gcm96` (encrypt). The answer lists the public key and the version. The private key never leaves the key service.

## Sign and verify

`POST /keys/release-signing/sign` with `{ "input": "<base64>" }` gives `{ signature, version }`. `POST /keys/release-signing/verify` with `{ input, signature }` gives `{ valid }`.

## Encrypt and decrypt

`POST /keys/<name>/encrypt` with `{ "plaintext": "<base64>" }` gives `{ ciphertext, version }`; `/decrypt` with `{ ciphertext }` gives `{ plaintext }`.

## Rotate, disable, read

`POST /keys/<name>/rotate` adds a version (old ciphertext still opens). `POST /keys/<name>/disable` stops all use of the key through Keys. `GET /keys` lists keys and public keys. `GET /audit?key=<name>&limit=100` is your audit trail; `GET /usage` is today's counts.

## What Keys does not do

- It is early and unproven. The client for the key service was written from its documentation and has not yet met a real one; the tests use a fake that follows the same documented shapes.
- Keys are never exported and there is no backup you can take. If the key service loses a key, Keys cannot bring it back.
- A key is never deleted: disabling stops use through Keys, the key stays in the key service. A disabled key cannot be enabled again by you.
- Only three kinds: ed25519 and ecdsa-p256 for signing, aes256-gcm96 for encryption. No derived keys, no key context, no certificates, no signing of a hash you computed yourself.
- Disabling is kept by Keys, not by the key service: it stops calls through Keys only.
- Messages and plaintext are limited to under 1 MiB per request (base64 included).
- The audit trail records who, which key, which operation, when and the result. It never holds your data. It is not yet rotated or exported; read it with `GET /audit`.
- One instance; accounts, counts and the audit trail are kept on its disk.
