CYBORGDB_SERVICE_ROOT_KEY set, the JS/TS SDK exposes per-index user provisioning on EncryptedIndex. These calls require the client to be using the root API key.
See Multi-Tenancy & RBAC for the operator-side playbook (modes, key kinds, KMS-backed constraint).
createUser
Mint a per-user API key scoped to this index.Parameters
Returns
Promise<{ userId, apiKey }>:
Example
KMS-backed vs SDK-supplied indexes.
createUser needs to unwrap the index’s root DEK so it can re-wrap it under a fresh user key.- KMS-backed (
kmsNameset): the service unwraps the DEK server-side; the client just callscreateUseron the loaded index — noindexKeyis sent or required. - SDK-supplied (
indexKeyset atloadIndex): the SDK transparently forwards the index key to the server so it can perform the unwrap. The root client must have loaded the index with the correctindexKey, otherwise the call fails.
listUsers and deleteUser.Errors
- Throws if
permissionsis empty/invalid, the client is not using the root key, or RBAC is not enabled.
listUsers
List the users provisioned for this index.Returns
Array of{ userId, permissions }. Permissions are derived from which wrapped DEKs exist for the user.
Example
Errors
- Throws if the client is not using the root key, or RBAC is not enabled.
deleteUser
Revoke a user. Erases their wrapped DEK(s) for this index — even a capturedcdbk_… token becomes useless on the next request. No propagation lag.
Parameters
Example
Errors
- Throws if
userIdis invalid, the client is not using the root key, or RBAC is not enabled.