Skip to main content
CyborgDB can persist a per-index KMS envelope — a small record describing how an index’s KEK is wrapped by an external Key Management Service. AES-256-GCM wraps the 32-byte KEK. These module-level functions read and write that envelope; the envelope itself is represented by the KMSBlob type and stored as a FlatBuffer next to the index keystore.
KMS is an advanced / optional feature primarily for the service layer. Embedded SDK users who supply their own KEK can ignore it entirely, or use provider="none" (the SDK supplies the plaintext KEK per request and nothing key-derived is stored).
Envelope model. Each index is encrypted with AES-256-GCM under a 32-byte KEK. The KMS envelope records how that KEK is wrapped by an external KMS so a service layer can unwrap it at request time. Supported providers:
  • "aws" — the KEK is wrapped with AES-256-GCM under a value stored in AWS Secrets Manager.
  • "aws-kms" — the KEK is wrapped via kms.Encrypt using an AWS KMS key.
  • "none" — no external wrapping; the caller supplies the plaintext KEK per request and nothing is stored.
Customer-managed keys (CMK) are supported via "aws-kms", not yet for the other providers.By default the plaintext KEK lives in caller process memory; the wrapped KEK lives next to the index keystore (StorageConfig).
All functions take a config_location (StorageConfig) identifying where the index keystore lives, plus the index name.

create_index_kms

Creates a KMS envelope for an index. Strict insert — fails if an envelope already exists for index_name.

Parameters

Example Usage


push_index_kms

Stores a KMS envelope for an index. Idempotent upsert — creates the envelope if missing, otherwise overwrites it.

Parameters

Example Usage


get_index_kms

Retrieves the KMS envelope for an index.

Parameters

Returns

KMSBlob: The stored KMS envelope for the index.

Example Usage


delete_index_kms

Deletes the KMS envelope for an index. Idempotent — deleting a non-existent envelope is a no-op.

Parameters

Example Usage


Rotation

To rotate the wrapped KEK, re-wrap it with your external KMS and store the new envelope with push_index_kms (an idempotent upsert), bumping version:
For end-to-end key-rotation guidance, see the CyborgDB documentation.