Tenant Management
Tenant management allows you to create, retrieve, manage, and delete tenants across multiple ecosystems (OpenID, Privado ID, Indicio, Cheqd). Tenants serve as isolated environments for self sovereign identity identity operations within each ecosystem. This section covers methods to handle tenant lifecycle and configuration, including webhooks and key rotation.
Create Tenant
Creates a new tenant in the specified ecosystem.
import { OpenIDEcosystem } from '@openid/core-sdk';
const openid = new OpenIDEcosystem({
apiKey: 'your-ecosystem-api-key',
});
const tenant = await openid.createTenant({
tenantName: 'your-tenant-name',
tenantLabel: 'Your Tenant Label',
tenantSecret: 'secret1243',
imageUrl: 'https://example.com/logo.png',
});
Params
| Parameter | Type | Description |
|---|---|---|
| tenantName | string (Required) | A unique name for the tenant. |
| tenantLabel | string (Required) | A human-readable label for the tenant. |
| tenantSecret | string (Required) | A secret key for tenant access (keep secure). |
| imageUrl | string (Required) | A URL pointing to the tenant's logo or image. |
| webhooks | string[] (Optional) | An array of webhook URLs for tenant notifications. |
- Ensure the
tenantNameis unique within the respective ecosystem. - Store
tenantSecretsecurely (e.g., in environment variables) to prevent exposure.
Get All Tenants
Retrieves a list of all tenants associated with the authenticated API key in the specified ecosystem.
import { OpenIDEcosystem } from '@openid/core-sdk';
const openid = new OpenIDEcosystem({
apiKey: 'your-ecosystem-api-key',
});
const tenants = await openid.getAllTenants({});
Params
| Parameter | Type | Description |
|---|---|---|
| tenantId | string (Optional) | Filter by a specific tenant ID (if omitted, returns all tenants). |
- Use the
tenantIdfilter for pagination or specific tenant queries if managing multiple tenants. - Response size may vary; consider limiting with additional query parameters (if supported in future updates).
Get Tenant Public DID
Retrieves the public DID (Decentralized Identifier) for a specified tenant in the respective ecosystem.
import { OpenIDEcosystem } from '@openid/core-sdk';
const openid = new OpenIDEcosystem({
apiKey: 'your-ecosystem-api-key',
});
const did = await openid.getTenantPublicDid({
tenantId: 'your-tenant-id',
});
Params
| Parameter | Type | Description |
|---|---|---|
| tenantId | string (Required) | The ID of the tenant to query. |
- The public DID is used for identity verification and should be shared only with trusted parties.
- Ensure the
tenantIdexists, or the method will return an error.
Rotate Tenant Key
Rotates the access token for a tenant in the specified ecosystem, enhancing security by generating a new key.
import { OpenIDEcosystem } from '@openid/core-sdk';
const openid = new OpenIDEcosystem({
apiKey: 'your-ecosystem-api-key',
});
const newToken = await openid.rotateTenantKey({
tenantId: 'your-tenant-id',
accessToken: 'current-token-xyz',
tenantSecret: 'your-tenant-secret',
});
Params
| Parameter | Type | Description |
|---|---|---|
| tenantId | string (Required) | The ID of the tenant to rotate. |
| accessToken | string (Required) | The current access token for authentication. |
| tenantSecret | string (Required) | The tenant's secret key for validation. |
- Rotate keys periodically or after a security breach.
- The old
accessTokenbecomes invalid immediately after a successful rotation.
Delete Tenant
Deletes a tenant and all associated data from the specified ecosystem.
import { OpenIDEcosystem } from '@openid/core-sdk';
const openid = new OpenIDEcosystem({
apiKey: 'your-ecosystem-api-key',
});
const result = await openid.deleteTenant({
tenantId: 'your-tenant-id',
tenantSecret: 'your-tenant-secret',
});
Params
| Parameter | Type | Description |
|---|---|---|
| tenantId | string (Required) | The ID of the tenant to delete. |
| tenantSecret | string (Required) | The tenant's secret key for validation. |
- This action is irreversible and deletes all tenant data (credentials, connections, etc.).
- Verify the
tenantIdandtenantSecretbefore proceeding to avoid accidental deletion.