Skip to content

Overview

This section serves as the reference for the Trinsic API, which can be accessed using any of our SDKs.

Authentication

Auth Tokens

Authentication with the Trinsic platform uses auth tokens, which are strings that operate similarly to API keys.

Unlike API keys, however, Trinsic utilizes zero-knowledge proofs to sign SDK calls using an auth token, without ever transmitting the auth token itself down the wire. This provides increased security compared to API keys, while being more convenient than other auth schemes, such as public/private tokens.

Custom Protection of Auth Tokens

We provide helper methods to protect auth tokens -- enabling you to perform custom security operations. An auth token, once protected with a code, is unusable until unprotected with that same code. Protection and unprotection are performed entirely on-device.

Using Auth Tokens in the SDK

Whenever you perform an SDK call which returns an auth token (signing in to an account, or creating an ecosystem), our SDKs will automatically store the auth token in memory and use it for subsequent calls.

You can also manually set the auth token used by the SDK (such as when loading an auth token from storage):

trinsic config --auth-token {AUTH_TOKEN}
trinsic.options.authToken = authToken;
trinsic.SetAuthToken(authToken);
trinsic.service_options.auth_token = auth_token
trinsic.SetAuthToken(authToken)
trinsic.setAuthToken(authToken);

Services

Our SDK is broken down into the following logical services, each of which is accessible through a single TrinsicService instance:

Using an SDK Service

If you are using one of the Trinsic SDKs, you will need to create an instance of a TrinsicService in order to use it.

const trinsic = new TrinsicService();
var trinsic = new TrinsicService(_options);
trinsic_service = TrinsicService(server_config=trinsic_config())
trinsic, err := NewTrinsic(WithTestEnv())
if !assert2.Nil(err) {
    return
}
var trinsic = new TrinsicService(TrinsicUtilities.getTrinsicServiceOptions());

The constructor accepts a ServiceOptions object as an argument, allowing you to specify a default ecosystem and other configuration properties:

Configuration for Trinsic SDK Services
server_endpoint
string
Trinsic API endpoint. Defaults to `prod.trinsic.cloud`
server_port
int32
Trinsic API port; defaults to `443`
server_use_tls
bool
Whether TLS is enabled between SDK and Trinsic API; defaults to `true`
auth_token
string
Authentication token for SDK calls; defaults to empty string (unauthenticated) Default ecosystem ID to use for various SDK calls; defaults to `default` string default_ecosystem = 5;

The exact structure of this object will depend on the language you are working with. You can always rely on your editor's intellisense when in doubt.