Authentication
The Core SDK has one class per ecosystem. You create the class with that ecosystem's API key, which you get in Hovi Studio (see Get an API key).
| Ecosystem | Class | The API key starts with |
|---|---|---|
| EU Digital Identity | OpenIdEcosystem | openId |
| Microsoft Entra | EntraEcosystem | entra |
| cheqd | CheqdEcosystem | cheqd |
| Indicio | IndicioEcosystem | indicio |
| Polygon | PrivadoEcosystem | privado |
If the key is missing or belongs to another ecosystem, the constructor throws an error.
Initialization
import { OpenIdEcosystem } from '@hovi/core-sdk';
// This example uses EU Digital Identity. Every class works the same way.
const openid = new OpenIdEcosystem({
apiKey: '<YOUR_API_KEY>',
});
Options
| Parameter | Type | Description |
|---|---|---|
| apiKey | string (Required) | Your ecosystem API key. |
| apiBaseUrl | string (Optional) | The base URL of the Hovi Connect API. The default is https://api.hovi.id. |
Most methods also take the organizationId of the organization you act for. You get it when you create an organization.
Error handling
When a call fails, the SDK throws a standard Error. Its message includes the HTTP status and the reason, for example Axios Error 401: …. Wrap your calls in try/catch:
try {
const organizations = await openid.getAllOrganizations();
} catch (error) {
console.error((error as Error).message);
}