# `Signer`

A class in `fastatp.crypto` ([source](https://github.com/jacoblapenna/fastatp/blob/main/fastatp/crypto.py#L208)).

Based on `Protocol`.

Something that signs with a key it may not be able to hand over.

Implement this to put a peer's pen in a TPM, an HSM, a secure element or
a remote signing service: `sign` is awaited so a device that takes tens
of milliseconds never stalls the peer's event loop. Return the signature
exactly as the device gives it, DER or raw `r||s`, low-S or not; fastatp
normalizes and verifies it (`sign_with`) before anything is
committed, so a misbehaving device fails at the write, not at a mirror.

Curves are k256 and p256 only. TPM 2.0 parts generally offer only p256.

## Attributes

- `public_key: PublicKey`: The verifying half: what a DID document or `did:key` carries.

## Methods

### `sign`

```python
async sign(message: bytes) -> bytes
```

ECDSA-SHA256 over `message`, in whatever encoding the device returns.
