Verificar HMAC
hmac-verifyRecalcula un HMAC y lo compara en tiempo constante con el esperado (p. ej. firma de webhook). Cuándo: hay que firmar un mensaje, o comprobar una firma, con un secreto compartido que viene en la llamada. No para: calcular el HMAC (hmac-sha256). Efectos secundarios: ninguno (solo lectura, sin red, sin estado guardado). Determinista: la misma entrada da la misma salida. Límites: entrada JSON de hasta 64 KB, 1 s por llamada, resultado de hasta 1 MB.
EN: Recomputes an HMAC over the data and compares it with an expected hex/base64 MAC in constant time, e.g. to check a webhook signature. When: a message has to be signed, or a signature checked, with a shared secret supplied in the call. Not for: computing the HMAC (hmac-sha256). Side effects: none (read-only, no network access, no stored state). Deterministic: the same input gives the same output. Limits: JSON input up to 64 KB, 1 s per call, result up to 1 MB.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Secret key (string; required; up to 4096 chars). | |
| data | Yes | Input data (string; required). | |
| expected | Yes | Expected MAC, hex or base64 (string; required; up to 512 chars). | |
| algorithm | No | Hash (optional; one of: sha256, sha512, sha1, sha384; default "sha256"). | sha256 |
| key_encoding | No | Encoding of `key` (optional; one of: utf8, hex, base64; default "utf8"). | utf8 |
| input_encoding | No | How `data` is encoded (optional; one of: utf8, hex, base64; default "utf8"). | utf8 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| valid | No |