Skip to main content

Installation

To get started, install the Trust Stack SDK.

Modules

The Trust Stack SDK is also available as a set of NPM packages to keep your codebase clean and focused. Read more about modules to learn more. Each core functionality is either available per the TrustStack client in @truststack/sdk or as a module in the @truststack/<MODULE> package.
Or, alternatively, via only installing the @truststack/admin:

Access Token Configuration

You can configure the SDK globally and set your access token.
Subsequent module usage will use the access token you have configured. Below is an example of how to use the Canvas module.
You can also configure globally with each module as well. The following examples all have the same effect.

Environment Variables

You can also set the access token via environment variables.

Organization Configuration

It is recommended you read about Organizations before continuing. Most actions within the Trust Stack require the concept of a “Organization”. The Organizations section has more information but setting the organization is important to ensure your requests are made in the correct context. It enforces permissions and authorization for the actions you perform on hehalf of your user groups. There are a few ways to set the organization. You can set the organization globally:

Globally Set Organization

Per client set organization

You can also set the organization on a per client basis.

Per request set organization

You can also set the organization on a per request basis. Most module functions accept a second set of parameters to do this.

No organization?

If you don’t set an organization, the SDK will default your tenant as the organization. If you are require DIDs, Credentials, or other resources, you will need to set the organization. managed against your tenant, this is the default behavior.