CYBORGDB_SERVICE_ROOT_KEY set, *EncryptedIndex can create, list, and revoke per-index users. These methods require a client created with the root key. They work on both KMS-backed indexes and indexes created with an IndexKey.
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
*CreatedUser:
Example
ListUsers
Lists the users created for this index.Returns
A[]UserInfo, each with UserID string and Permissions []string (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 theircdbk_ key stops working on the next request.
Parameters
Example
Errors
*AuthenticationError
*AuthenticationError
The client isn’t using the root key (HTTP
403), or its apiKey is invalid (HTTP 401).*ValidationError
*ValidationError
permissions is empty or contains a value other than "read" or "write", or userID isn’t hex (HTTP 400).*NotFoundError
*NotFoundError
The index doesn’t exist (HTTP
404).*ServiceError / *TransportError
*ServiceError / *TransportError
The service returns
5xx or can’t be reached.