This repository contains the official Java SDK for Cobo WaaS API, enabling developers to integrate with Cobo's Custodial and/or MPC services seamlessly using the Java programming language.
To access the API documentation, navigate to the API references.
For more information on Cobo's Java SDK, refer to the Java SDK Guide.
Ensure that you have created an account and configured Cobo's Custodial and/or MPC services. For detailed instructions, please refer to the Quickstart guide.
- JDK8
- JDK17 or newer
Step 1. Add the JitPack repository to your build file
gradle:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
maven:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Step 2. Add the dependency
gradle:
dependencies {
implementation 'com.github.CoboGlobal:cobo-java-api:v0.96'
}
maven:
<dependency>
<groupId>com.github.CoboGlobal</groupId>
<artifactId>cobo-java-api</artifactId>
<version>v0.96</version>
</dependency>
import com.cobo.custody.api.client.impl.LocalSigner;
String[] key = LocalSigner.generateKeyPair();
String secretKey = key[0];
String apiKey = key[1];
For more information on the API key, please click here.
ApiSigner
can be instantiated through new LocalSigner("secretkey" )
In certain scenarios, the private key may be restricted from export, such as when it is stored in AWS Key Management Service (KMS). In such cases, please pass in a custom implementation using the ApiSigner interface:
import com.cobo.custody.api.client.ApiSigner;
new ApiSigner() {
@Override
public String sign(byte[] message) {
return null;
}
@Override
public String getPublicKey() {
return null;
}
}
These can be instantiated using the corresponding factory method provided by CoboApiClientFactory
.
import com.cobo.custody.api.client.CoboApiClientFactory;
import com.cobo.custody.api.client.CoboApiRestClient;
import com.cobo.custody.api.client.config.CoboApiConfig;
import com.cobo.custody.api.client.config.Env;
import com.cobo.custody.api.client.impl.LocalSigner;
CoboApiRestClient client = CoboApiClientFactory.newInstance(
new LocalSigner(apiSecret),
Env.DEV,
false).newRestClient();
import com.cobo.custody.api.client.CoboApiClientFactory;
import com.cobo.custody.api.client.CoboApiRestClient;
import com.cobo.custody.api.client.config.CoboApiConfig;
import com.cobo.custody.api.client.config.Env;
import com.cobo.custody.api.client.impl.LocalSigner;
String[] key = LocalSigner.generateKeyPair();
String secretKey = key[0];
String apiKey = key[1];
CoboApiRestClient client = CoboApiClientFactory.newInstance(
new LocalSigner(secretKey),
Env.DEV,
false).newRestClient();
ApiResponse<OrgInfo> orgInfo = client.getOrgInfo()
System.out.println(orgInfo);