Skip to content

Commit 3f656ae

Browse files
committed
Pre release 0.0.1
1 parent cc312dc commit 3f656ae

File tree

107 files changed

+2137
-646
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+2137
-646
lines changed

README.md

Lines changed: 15 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,24 @@
1-
# BitKeeper
2-
*Threshold Signing Vault*
1+
# TKeeper
32

4-
## Running the application
5-
To run an app in HTTP mode simply run:
3+
**TKeeper** is a threshold signature service that provides a simple REST API for distributed signing using **GG20 (Threshold ECDSA)** and **FROST (Threshold Schnorr)** protocols. The service abstracts the complexity of multiparty computation: to sign a message, a client just needs to send a single HTTP request.
64

7-
```bash
8-
java -jar <runner>.jar
9-
```
5+
It is suitable for custody systems, MPC-based wallets, and backend services that require distributed key management and signing without exposing private keys to any single participant.
106

11-
To enabld **CLI** mode, run:
7+
We avoid using high-level abstractions such as `BigInteger` for handling sensitive data. All arithmetic operations on secret shares and cryptographic material are performed through low-level bindings over **libgmp**, allowing precise memory control and zeroing. For highly sensitive values (such as private key shares), **SecretBox** from **libsodium** is used for encryption in memory. The memory encryption key is generated every time application is started. For local persistent storage, TKeeper uses **RocksDB**, with all secret data encrypted with your **seal** key before being written to disk.
128

13-
```bash
14-
java -Dquarkus.profile=cli -jar <runner>.jar
15-
```
9+
---
1610

17-
#### NOTE
18-
DON'T CHANGE `%cli` PROFILE CONFIG! HTTP SERVER SHOULD NOT BE ENABLED IN THIS MODE
11+
## Requirements
1912

20-
## Configuration
21-
Configuration example:
13+
TKeeper depends on several native libraries for cryptographic operations. Make sure the following are installed on the system:
2214

23-
```yaml
24-
"%cli":
25-
quarkus:
26-
http:
27-
insecure-requests: disabled
28-
host-enabled: false
29-
ssl-port: -1
15+
- [libsodium](https://github.com/jedisct1/libsodium) – used for secure memory handling and Ed25519 point ops
16+
- [libgmp](https://gmplib.org/) – used for arbitrary-precision arithmetic
17+
- [libsecp256k1](https://github.com/bitcoin-core/secp256k1) – used for Secp256k1 point ops
3018

31-
keeper:
32-
idx: ${KEEPER_SERVICE_IDX}
33-
threshold: ${KEEPER_SERVICE_THRESHOLD}
34-
parallelism: ${KEEPER_SERVICE_PARALLELISM:4}
35-
database-path: ${KEEPER_DATABASE_PATH}
36-
session:
37-
gg20:
38-
expire: 15m
39-
frost:
40-
expire: 5m
41-
private-key: ${KEEPER_PRIVATE_KEY}
42-
peers:
43-
- idx: 1
44-
public-url: 'https://keeper1.example.com'
45-
public-key: 'NOOP'
46-
```
19+
Make sure these libraries are available in your environment and linked correctly.
20+
___
4721

48-
### Definitions
49-
- `idx` - index of the current keeper in the network
50-
- `threshold` - threshold defined during shamir secret sharing
51-
- `parallelism` - number of parallel threads for keeper while broadcasts
52-
- `database-path` - path to the database file (!file)
53-
- `session` - session settings
54-
- `gg20` - settings for GG20 session
55-
- `expire` - expiration time of the session
56-
- `frost` - settings for FROST session
57-
- `expire` - expiration time of the session
58-
- `private-key` - Ed25519 private key of the keeper
59-
- `peers` - list of peers in the network
60-
- `idx` - index of the peer
61-
- `public-url` - public URL of the peer
62-
- `public-key` - Ed25519 public key of the peer
63-
64-
## CLI commands
65-
66-
### Storing private key share
67-
```bash
68-
store <publicKeyId> <privateKeyShare> <relatedFullPublicKey>
69-
```
70-
71-
### Deleting key share
72-
```bash
73-
delete <publicKeyId>
74-
```
75-
76-
**NOTE**:
77-
All key share data should be specified in **Base64**
22+
## Documentation
23+
See [docs](docs) for detailed documentation on, or visit [docs.exploit.org/tkeeper](https://docs.exploit.org/tkeeper) for
24+
user-friendly documentation.

build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ dependencies {
3737

3838
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.18.3'
3939

40-
implementation 'org.exploit.tss:gg20:0.0.1-patch1'
41-
implementation 'org.exploit.tss:frost:0.0.1-patch1'
40+
implementation 'org.exploit.tss:gg20:0.0.2.4'
41+
implementation 'org.exploit.tss:frost:0.0.2.4'
4242

43-
implementation 'org.exploit.tss:ed25519:0.0.1-patch1'
44-
implementation 'org.exploit.tss:secp256k1:0.0.1-patch1'
43+
implementation 'org.exploit.tss:ed25519:0.0.2.4'
44+
implementation 'org.exploit.tss:secp256k1:0.0.2.4'
4545

46-
implementation 'org.exploit.tss:core:0.0.1-patch1'
46+
implementation 'org.exploit.tss:core:0.0.2.4'
4747

4848
implementation 'com.nimbusds:nimbus-jose-jwt:10.2'
4949

@@ -61,7 +61,7 @@ dependencies {
6161
}
6262

6363
group 'org.exploit'
64-
version '1.0-SNAPSHOT'
64+
version '0.0.1-SNAPSHOT'
6565

6666
java {
6767
sourceCompatibility = JavaVersion.VERSION_17

docs/API.md

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# TKeeper API
2+
3+
This document describes all public REST endpoints exposed by TKeeper.
4+
Each endpoint enforces permission checks (see [auth.md](auth.md)) and assumes that the node is unsealed and ready, unless stated otherwise.
5+
6+
---
7+
8+
## Base Path
9+
10+
```
11+
/v1/keeper
12+
```
13+
14+
---
15+
16+
## 1. System Control
17+
18+
### `POST /system/init`
19+
20+
Initializes TKeeper with the peer ID, threshold, and total number of nodes.
21+
22+
- See: [init.md](init.md)
23+
24+
### `PUT /system/unseal`
25+
26+
Submits one or more Shamir shares to reconstruct the local key share (manual unseal).
27+
Returns unsealing progress.
28+
29+
- See: [seal.md](seal.md)
30+
31+
### `PUT /system/seal`
32+
33+
Seals the local key share, removing it from memory.
34+
Used to force the node back into a locked state.
35+
36+
- Permissions: `tkeeper.system.seal`
37+
38+
### `GET /system/status`
39+
40+
Returns current sealing status.
41+
42+
```json
43+
{
44+
"sealedBy": "shamir | aws | google",
45+
"state": "UNINITIALIZED | SEALED | UNSEALED",
46+
"progress": {
47+
"threshold": 3,
48+
"total": 5,
49+
"progress": 2,
50+
"ready": false
51+
}
52+
}
53+
```
54+
55+
---
56+
57+
## 2. Key Generation
58+
59+
### `POST /dkg/generate`
60+
61+
Triggers distributed key generation (or key share refreshing).
62+
63+
- Request body: see [keygen.md](keygen.md)
64+
- Supports:
65+
- `overwrite: true` (requires `tkeeper.dkg.generate.overwrite`)
66+
- `refresh: true` for share refreshing
67+
- Requires all peers to be online
68+
69+
---
70+
71+
## 3. Signatures
72+
73+
### `POST /sign`
74+
75+
Performs threshold signing using the specified key and MPC scheme.
76+
77+
- Supports:
78+
- `GG20` (1 operation max)
79+
- `FROST` (multiple operations allowed)
80+
- See: [sign.md](sign.md)
81+
82+
### `POST /sign/verify`
83+
84+
Verifies a signature against a public key.
85+
86+
- See: [sign.md](sign.md)
87+
88+
---
89+
90+
## 4. Public Interface
91+
92+
### `GET /publicKey?keyId=...`
93+
94+
Returns the public key for the given key ID.
95+
96+
```json
97+
{
98+
"data64": "base64-encoded public key"
99+
}
100+
```
101+
102+
- Requires: `tkeeper.key.{keyId}.public`
103+
104+
### `GET /peerId`
105+
106+
Returns the current node’s `peerId`.
107+
108+
```json
109+
{
110+
"serviceId": 2,
111+
"result": 2
112+
}
113+
```
114+
115+
### `GET /ping`
116+
117+
Returns basic readiness status:
118+
119+
```json
120+
{
121+
"ready": true
122+
}
123+
```
124+
125+
- `true`: node is initialized and unsealed
126+
127+
---
128+
129+
## 5. Integrity
130+
131+
### `POST /integrity/regen`
132+
133+
Regenerates the internal integrity key used to authenticate internal peer-to-peer messages.
134+
Used for re-keying or recovery.
135+
136+
- Permission: `tkeeper.integrity.regen`
137+
138+
---
139+
140+
## 6. Storage (Trusted Dealer)
141+
142+
### `POST /storage/store`
143+
144+
Injects a full private key into the system. The current node acts as a **trusted dealer**, splits the key into Shamir shares, and distributes them to all online peers.
145+
146+
- All nodes must be online during this operation
147+
- Each peer receives and stores only its own share
148+
- See: [store.md](store.md)
149+
- Permission: `tkeeper.storage.write`
150+
151+
### `DELETE /storage/delete?keyId=...`
152+
153+
Deletes the distributed key from **all peers**. The initiating node contacts every participant and removes the stored share.
154+
155+
- All nodes must be online
156+
- If any peer is unreachable, the operation fails
157+
- Permission: `tkeeper.storage.delete`
158+
159+
---
160+
161+
## Permissions Overview
162+
163+
Each endpoint requires a specific permission token.
164+
For the full list and structure, refer to [auth.md](auth.md).

0 commit comments

Comments
 (0)