Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/coboglobal/cobo-java-api
Cobo Custody Java sdk
https://github.com/coboglobal/cobo-java-api
bitcoin blockchain cryptocurrency custody
Last synced: 2 months ago
JSON representation
Cobo Custody Java sdk
- Host: GitHub
- URL: https://github.com/coboglobal/cobo-java-api
- Owner: CoboGlobal
- License: gpl-2.0
- Created: 2021-06-22T07:32:07.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-28T09:50:11.000Z (8 months ago)
- Last Synced: 2024-05-29T00:45:41.845Z (8 months ago)
- Topics: bitcoin, blockchain, cryptocurrency, custody
- Language: Java
- Homepage: https://cobo.com/custody
- Size: 648 KB
- Stars: 7
- Watchers: 1
- Forks: 14
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# The Official Java SDK for Cobo WaaS API
![JitPack](https://jitpack.io/v/CoboGlobal/cobo-java-api.svg)
[![License: GPL v2](https://img.shields.io/badge/License-GPL_v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
[![GitHub Release](https://img.shields.io/github/release/CoboGlobal/cobo-java-api.svg?style=flat)]()## About
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.## Documentation
To access the API documentation, navigate to the [API references](https://www.cobo.com/developers/api-references/overview/).For more information on Cobo's Java SDK, refer to the [Java SDK Guide](https://www.cobo.com/developers/sdks-and-tools/sdks/waas/java).
## Usage
### Before You Begin
Ensure that you have created an account and configured Cobo's Custodial and/or MPC services.
For detailed instructions, please refer to the [Quickstart](https://www.cobo.com/developers/get-started/overview/quickstart) guide.### Requirements
- JDK8
- JDK17 or newer### Installation
Step 1. Add the JitPack repository to your build filegradle:
```
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```maven:
```
jitpack.io
https://jitpack.io
```
Step 2. Add the dependency
gradle:
```
dependencies {
implementation 'com.github.CoboGlobal:cobo-java-api:v0.95'
}
```maven:
```
com.github.CoboGlobal
cobo-java-api
v0.95```
### Code Sample
#### Generate Key Pair
```java
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](https://www.cobo.com/developers/api-references/overview/authentication).#### Initialize ApiSigner
`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:
```javaimport com.cobo.custody.api.client.ApiSigner;
new ApiSigner() {
@Override
public String sign(byte[] message) {
return null;
}@Override
public String getPublicKey() {
return null;
}
}
```#### Initialize RestClient
These can be instantiated using the corresponding factory method provided by `CoboApiClientFactory`.```java
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();
```#### Complete Code Sample
```java
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 = client.getOrgInfo()
System.out.println(orgInfo);
```