Installation and configuration
This guide helps you install the Truvity API client and ensures your environment meets the required system specifications.
System requirements
Before you install the Truvity SDK, make sure your system meets these requirements:
- TypeScript
- Java
- Node.js version 16.16 or later. Download it from the official Node.js website.
- Operating systems: macOS, Windows, or Linux
- Java version 11 or later. Download it from the official Java website.
- Operating systems: macOS, Windows, or Linux
Ensure that your environment meets these requirements to avoid compatibility issues.
Obtain API key
Before using the API, you need to obtain the API key to authenticate calls. Follow the Create API Keys guide to create a new API key.
Install the SDK
The SDK installation instructions depend on the SDK language you want to use.
- TypeScript
- Java
Maven Dependency:
To include the Truvity SDK as a dependency in your Maven project, add the following to your pom.xml
. Make sure to replace the <latest-version>
placeholder with the most recent version available from the Maven Central Repository.
<dependency>
<groupId>com.truvity</groupId>
<artifactId>sdk</artifactId>
<version><latest-version></version>
</dependency>
Gradle Dependency:
To add the Truvity SDK in Gradle, include the following line in your build.gradle
file. Again, replace <latest-version>
with the latest version from the Maven Central Repository.
implementation group: 'com.truvity', name: 'sdk', version: '<latest-version>'
Create the API client
To begin using the API, you first need to create a new API client. Use the following code to set up the client:
- TypeScript
- Java
import { TruvityClient } from "@truvity/sdk";
const client = new TruvityClient({
environment: "https://api.truvity.cloud",
apiKey: "YOUR_API_KEY",
});
Where YOUR_API_KEY
is the API key you obtained in the previous step.
import com.truvity.api.TruvityApiExtendedClient;
import com.truvity.api.TruvityApiExtendedClientBuilder;
static TruvityApiExtendedClientBuilder builder = new TruvityApiExtendedClientBuilder()
.environment(Environment.custom("https://api.truvity.cloud"))
.apiKey(System.getenv("YOUR_API_KEY"));
static TruvityApiExtendedClient client = builder.build();
Where YOUR_API_KEY
is the API key you obtained in the previous step.
This code initializes a new client for the Truvity API, which makes API calls to Truvity Cloud.
Make API calls
Once you set up the API client, use API methods to perform actions with the available API operations.
For example, to create a new API key, use the following code:
- TypeScript
- Java
await client.apiKeys.apiKeyCreate({
idempotencyKey: "7da7a728-f910-11e6-942a-68f728c1ba70",
body: {}
});
client.apiKeys().apiKeyCreate(ApiKeyCreateRequest.builder()
.body(ApiKeyInput.builder().build())
.idempotencyKey("7da7a728-f910-11e6-942a-68f728c1ba70")
.build());
Next steps
Now that you have installed the SDK, you are ready to start building your first application using the Truvity SDK. Here are some recommended next steps to help you get started:
1. Explore the quick start guide
The Quick start guide is the best place to begin after installing the SDK. It demonstrates key operations such as issuing credentials and interacting with wallet data.
2. Review API documentation
For detailed information on the available API endpoints, parameters, and response formats, check out the API reference. The API documentation provides code samples in multiple languages to help you integrate the SDK into your application seamlessly.
3. Start building
Once you gone through the Quick Start Guide, you are ready to begin building your first application.
Explore the Credential lifecycle section and go through step-by-step guides through the process of creating, issuing, sharing and verifying credentials and presentations.
4. Explore advanced features
Once you are comfortable with the basics, you can dive into more advanced features of the SDK, such as:
- Building end-to-end credential lifecycle: Learn how to cover the full credential lifecycle from creating a credential to sharing it with the verifier.
- Working with linked data: Learn how to link credentials to each other and files to credentials.
- Managing credential data: Epxlore how to model credential data with labels, use faceted search to retrieve results, and view credential history.