# crypto.signature.sign

Signs --text with HMAC-SHA256 under an hmac credential

# crypto.signature.sign

```
crypto.signature.sign --text TEXT --credential TEXT [--algorithm hmac-sha256] → signature
```

Signs `--text` with HMAC-SHA256 under an `hmac` credential. The signature is the HMAC-SHA256 of `--text`, keyed by the secret of the `hmac` credential `--credential` (an id from credential_list, never a value). Adds `signature: { algorithm, value }` (lowercase hex) and keeps the rest of the payload. An empty `--text` is refused.

## Flags

- `--text` (required): The text to sign (its UTF-8 bytes), e.g. a raw request body.
- `--credential` (required): Id of the hmac credential whose secret is the key.
- `--algorithm`: hmac-sha256 (default, the only one).

## Examples

### Sign an outgoing callback

```
| crypto.signature.sign --text "{{ input.body_text }}" --credential partner-hmac
```

It answers:

```json
{
  "signature": {
    "algorithm": "hmac-sha256",
    "value": "5d41402abc4b2a76b9719d911017c592…"
  }
}
```
