> For the complete documentation index, see [llms.txt](https://vectis.liesware.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vectis.liesware.com/mac.md).

# MAC

## Create a keyed MAC digest

> Creates a deterministic MAC digest using a MAC profile loaded from signed config. The profile binds name, KID, and a structured context. SHA-3(N) operational keys use KMAC-N with an N-bit digest; other keys use HMAC with the key hash algorithm. Create requires an active key.<br>

```json
{"openapi":"3.1.0","info":{"title":"Vectis HTTP API","version":"v1"},"tags":[{"name":"MAC"}],"servers":[{"url":"http://127.0.0.1:3000","description":"Local default server over HTTP"},{"url":"https://127.0.0.1:3000","description":"Local HTTPS server when VECTIS_MODE=prod"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key"}},"parameters":{"Kid":{"name":"kid","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Kid"}}},"schemas":{"Kid":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"},"MacCreateInput":{"type":"object","additionalProperties":false,"required":["ref","profile","plaintext"],"properties":{"ref":{"$ref":"#/components/schemas/ClientRef"},"profile":{"$ref":"#/components/schemas/AadSafeText"},"plaintext":{"$ref":"#/components/schemas/TextField"}}},"ClientRef":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[^\\x00-\\x1F\\x7F-\\x9F]+$","description":"Client-defined correlation reference. Echoed in FPE, tokenization, MAC, commitment, blind-index, and masking responses; not used for cryptographic derivation, storage lookup, audit, or metrics."},"AadSafeText":{"type":"string","minLength":1,"pattern":"^[^\\x00-\\x1F\\x7F-\\x9F;=]+$","description":"Text safe to embed in a key=value;... AAD string (no ';' or '=')."},"TextField":{"type":"string","minLength":1,"pattern":"^[^\\x00-\\x1F\\x7F-\\x9F]+$"},"MacCreateOutput":{"type":"object","required":["ref","kid","profile","algorithm","digest"],"properties":{"ref":{"$ref":"#/components/schemas/ClientRef"},"kid":{"$ref":"#/components/schemas/Kid"},"profile":{"$ref":"#/components/schemas/AadSafeText"},"algorithm":{"type":"string","description":"HMAC(<ops-key-hash>) or KMAC-224/256/384/512 for SHA-3 keys."},"digest":{"$ref":"#/components/schemas/HexString"}}},"HexString":{"type":"string","pattern":"^[0-9a-fA-F]+$"},"ErrorResponse":{"type":"object","required":["error"],"properties":{"error":{"$ref":"#/components/schemas/TextField"}}}},"responses":{"RequestBodyTooLarge":{"description":"Request body exceeds the internal 2 MiB limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Error":{"description":"Public error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/mac/{kid}":{"post":{"tags":["MAC"],"summary":"Create a keyed MAC digest","description":"Creates a deterministic MAC digest using a MAC profile loaded from signed config. The profile binds name, KID, and a structured context. SHA-3(N) operational keys use KMAC-N with an N-bit digest; other keys use HMAC with the key hash algorithm. Create requires an active key.\n","parameters":[{"$ref":"#/components/parameters/Kid"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MacCreateInput"}}}},"responses":{"200":{"description":"MAC digest","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MacCreateOutput"}}}},"413":{"$ref":"#/components/responses/RequestBodyTooLarge"},"default":{"$ref":"#/components/responses/Error"}}}}}}
```

## Create keyed MAC digests as an all-or-nothing batch

> Creates deterministic MAC digests for a batch using one signed MAC profile. Each item must include a unique client ref. Create requires an active key. Any validation or execution error fails the whole batch.<br>

```json
{"openapi":"3.1.0","info":{"title":"Vectis HTTP API","version":"v1"},"tags":[{"name":"MAC"}],"servers":[{"url":"http://127.0.0.1:3000","description":"Local default server over HTTP"},{"url":"https://127.0.0.1:3000","description":"Local HTTPS server when VECTIS_MODE=prod"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key"}},"parameters":{"Kid":{"name":"kid","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Kid"}}},"schemas":{"Kid":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"},"MacCreateBatchInput":{"type":"object","additionalProperties":false,"required":["profile","items"],"properties":{"profile":{"$ref":"#/components/schemas/AadSafeText"},"items":{"type":"array","minItems":1,"maxItems":128,"items":{"$ref":"#/components/schemas/MacCreateBatchItemInput"}}}},"AadSafeText":{"type":"string","minLength":1,"pattern":"^[^\\x00-\\x1F\\x7F-\\x9F;=]+$","description":"Text safe to embed in a key=value;... AAD string (no ';' or '=')."},"MacCreateBatchItemInput":{"type":"object","additionalProperties":false,"required":["ref","plaintext"],"properties":{"ref":{"$ref":"#/components/schemas/ClientRef"},"plaintext":{"$ref":"#/components/schemas/TextField"}}},"ClientRef":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[^\\x00-\\x1F\\x7F-\\x9F]+$","description":"Client-defined correlation reference. Echoed in FPE, tokenization, MAC, commitment, blind-index, and masking responses; not used for cryptographic derivation, storage lookup, audit, or metrics."},"TextField":{"type":"string","minLength":1,"pattern":"^[^\\x00-\\x1F\\x7F-\\x9F]+$"},"MacCreateBatchOutput":{"type":"object","required":["kid","profile","algorithm","items"],"properties":{"kid":{"$ref":"#/components/schemas/Kid"},"profile":{"$ref":"#/components/schemas/AadSafeText"},"algorithm":{"type":"string","description":"HMAC(<ops-key-hash>) or KMAC-224/256/384/512 for SHA-3 keys."},"items":{"type":"array","items":{"$ref":"#/components/schemas/MacCreateBatchOutputItem"}}}},"MacCreateBatchOutputItem":{"type":"object","required":["ref","digest"],"properties":{"ref":{"$ref":"#/components/schemas/ClientRef"},"digest":{"$ref":"#/components/schemas/HexString"}}},"HexString":{"type":"string","pattern":"^[0-9a-fA-F]+$"},"ErrorResponse":{"type":"object","required":["error"],"properties":{"error":{"$ref":"#/components/schemas/TextField"}}}},"responses":{"RequestBodyTooLarge":{"description":"Request body exceeds the internal 2 MiB limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Error":{"description":"Public error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/mac/batch/{kid}":{"post":{"tags":["MAC"],"summary":"Create keyed MAC digests as an all-or-nothing batch","description":"Creates deterministic MAC digests for a batch using one signed MAC profile. Each item must include a unique client ref. Create requires an active key. Any validation or execution error fails the whole batch.\n","parameters":[{"$ref":"#/components/parameters/Kid"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MacCreateBatchInput"}}}},"responses":{"200":{"description":"MAC digests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MacCreateBatchOutput"}}}},"413":{"$ref":"#/components/responses/RequestBodyTooLarge"},"default":{"$ref":"#/components/responses/Error"}}}}}}
```

## Verify a keyed MAC digest

> Verifies a MAC digest using the selected signed MAC profile. Verify permits active and retired keys and compares digests in constant time.<br>

```json
{"openapi":"3.1.0","info":{"title":"Vectis HTTP API","version":"v1"},"tags":[{"name":"MAC"}],"servers":[{"url":"http://127.0.0.1:3000","description":"Local default server over HTTP"},{"url":"https://127.0.0.1:3000","description":"Local HTTPS server when VECTIS_MODE=prod"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key"}},"schemas":{"MacVerifyInput":{"type":"object","additionalProperties":false,"required":["ref","kid","profile","plaintext","digest"],"properties":{"ref":{"$ref":"#/components/schemas/ClientRef"},"kid":{"$ref":"#/components/schemas/Kid"},"profile":{"$ref":"#/components/schemas/AadSafeText"},"plaintext":{"$ref":"#/components/schemas/TextField"},"digest":{"$ref":"#/components/schemas/HexString"}}},"ClientRef":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[^\\x00-\\x1F\\x7F-\\x9F]+$","description":"Client-defined correlation reference. Echoed in FPE, tokenization, MAC, commitment, blind-index, and masking responses; not used for cryptographic derivation, storage lookup, audit, or metrics."},"Kid":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"},"AadSafeText":{"type":"string","minLength":1,"pattern":"^[^\\x00-\\x1F\\x7F-\\x9F;=]+$","description":"Text safe to embed in a key=value;... AAD string (no ';' or '=')."},"TextField":{"type":"string","minLength":1,"pattern":"^[^\\x00-\\x1F\\x7F-\\x9F]+$"},"HexString":{"type":"string","pattern":"^[0-9a-fA-F]+$"},"MacVerifyOutput":{"type":"object","required":["ref","valid"],"properties":{"ref":{"$ref":"#/components/schemas/ClientRef"},"valid":{"type":"boolean"}}},"ErrorResponse":{"type":"object","required":["error"],"properties":{"error":{"$ref":"#/components/schemas/TextField"}}}},"responses":{"RequestBodyTooLarge":{"description":"Request body exceeds the internal 2 MiB limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Error":{"description":"Public error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/mac/verify":{"post":{"tags":["MAC"],"summary":"Verify a keyed MAC digest","description":"Verifies a MAC digest using the selected signed MAC profile. Verify permits active and retired keys and compares digests in constant time.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MacVerifyInput"}}}},"responses":{"200":{"description":"MAC verification result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MacVerifyOutput"}}}},"413":{"$ref":"#/components/responses/RequestBodyTooLarge"},"default":{"$ref":"#/components/responses/Error"}}}}}}
```

## Verify keyed MAC digests as an all-or-nothing batch

> Verifies MAC digests for a batch using one signed MAC profile. Request validation and execution errors fail the whole batch; digest mismatches return valid=false for their items.<br>

```json
{"openapi":"3.1.0","info":{"title":"Vectis HTTP API","version":"v1"},"tags":[{"name":"MAC"}],"servers":[{"url":"http://127.0.0.1:3000","description":"Local default server over HTTP"},{"url":"https://127.0.0.1:3000","description":"Local HTTPS server when VECTIS_MODE=prod"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key"}},"schemas":{"MacVerifyBatchInput":{"type":"object","additionalProperties":false,"required":["kid","profile","items"],"properties":{"kid":{"$ref":"#/components/schemas/Kid"},"profile":{"$ref":"#/components/schemas/AadSafeText"},"items":{"type":"array","minItems":1,"maxItems":128,"items":{"$ref":"#/components/schemas/MacVerifyBatchItemInput"}}}},"Kid":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"},"AadSafeText":{"type":"string","minLength":1,"pattern":"^[^\\x00-\\x1F\\x7F-\\x9F;=]+$","description":"Text safe to embed in a key=value;... AAD string (no ';' or '=')."},"MacVerifyBatchItemInput":{"type":"object","additionalProperties":false,"required":["ref","plaintext","digest"],"properties":{"ref":{"$ref":"#/components/schemas/ClientRef"},"plaintext":{"$ref":"#/components/schemas/TextField"},"digest":{"$ref":"#/components/schemas/HexString"}}},"ClientRef":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[^\\x00-\\x1F\\x7F-\\x9F]+$","description":"Client-defined correlation reference. Echoed in FPE, tokenization, MAC, commitment, blind-index, and masking responses; not used for cryptographic derivation, storage lookup, audit, or metrics."},"TextField":{"type":"string","minLength":1,"pattern":"^[^\\x00-\\x1F\\x7F-\\x9F]+$"},"HexString":{"type":"string","pattern":"^[0-9a-fA-F]+$"},"MacVerifyBatchOutput":{"type":"object","required":["kid","profile","items"],"properties":{"kid":{"$ref":"#/components/schemas/Kid"},"profile":{"$ref":"#/components/schemas/AadSafeText"},"items":{"type":"array","items":{"$ref":"#/components/schemas/MacVerifyBatchOutputItem"}}}},"MacVerifyBatchOutputItem":{"type":"object","required":["ref","valid"],"properties":{"ref":{"$ref":"#/components/schemas/ClientRef"},"valid":{"type":"boolean"}}},"ErrorResponse":{"type":"object","required":["error"],"properties":{"error":{"$ref":"#/components/schemas/TextField"}}}},"responses":{"RequestBodyTooLarge":{"description":"Request body exceeds the internal 2 MiB limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Error":{"description":"Public error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/mac/verify/batch":{"post":{"tags":["MAC"],"summary":"Verify keyed MAC digests as an all-or-nothing batch","description":"Verifies MAC digests for a batch using one signed MAC profile. Request validation and execution errors fail the whole batch; digest mismatches return valid=false for their items.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MacVerifyBatchInput"}}}},"responses":{"200":{"description":"MAC verification results","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MacVerifyBatchOutput"}}}},"413":{"$ref":"#/components/responses/RequestBodyTooLarge"},"default":{"$ref":"#/components/responses/Error"}}}}}}
```
