Skip to main content
Generates a random 32-byte (256-bit) key for creating an encrypted index with an SDK-supplied key.
GenerateKey is a package-level function, not a Client method. The package also exports the key length as cyborgdb.KeySize (32).

Returns

A 32-byte key read from Go’s crypto/rand. The error, which wraps ErrKeyGeneration, is non-nil only if the operating system’s random source fails. Unlike the Python SDK, there is no option to save the key to a file.
An index created with an SDK-supplied key can only be opened with that exact key. If the key is lost, the index’s data can’t be decrypted. Store it in a secrets manager, or use a KMS-backed index. See Managing Encryption Keys.

Example Usage