Skip to main content
When the service runs with CYBORGDB_SERVICE_ROOT_KEY set, EncryptedIndex can create, list, and revoke per-index users. These methods require a client created with the root key.
See Multi-Tenancy & RBAC for the operator-side playbook (modes, key kinds, SDK-supplied indexes).

createUser

Creates a user scoped to this index and returns their API key.

Parameters

Returns

Promise<{ userId, apiKey }>:
The service returns apiKey only in this response and never stores it. Give it to the user over a secure channel and don’t log it. If it’s lost, delete the user and create a new one.

Example


listUsers

Lists the users created for this index.

Returns

An array of { userId, permissions }, where permissions is a subset of ['read', 'write'].

Example

Deleting an index doesn’t delete its user records. If you create a new index with the same name, listUsers() on it still returns the old users. They can’t read the new index, because their keys don’t unwrap its data key; delete them with deleteUser().

deleteUser

Revokes a user. Their access keys for this index are erased, so their cdbk_ key stops working on the next request.

Parameters

Example


Exceptions

These apply to all three methods:
The client isn’t using the root key (HTTP 403), or its apiKey is invalid (HTTP 401).
permissions is empty or contains a value other than 'read' or 'write', or userId isn’t hex (HTTP 400).
The index doesn’t exist (HTTP 404).
The service returns 5xx.
See Errors for the full hierarchy.