ccpool-server 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +52 -0
- package/dist/index.js +1838 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 hexxt
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# ccpool-server
|
|
2
|
+
|
|
3
|
+
The multi-tenant HTTP server for [ccpool](https://github.com/hexxt-git/ccpool) — the
|
|
4
|
+
one path to the shared ledger. Most groups don't need this: the [`ccpool`](https://www.npmjs.com/package/ccpool)
|
|
5
|
+
CLI points at a hosted server by default, so there's nothing to deploy. Install this
|
|
6
|
+
only if your group wants to **run its own server**.
|
|
7
|
+
|
|
8
|
+
The server is multi-tenant (many groups on one server, each ledger isolated by a
|
|
9
|
+
`group_id` in one shared database) and runs on **libSQL** — one `DATABASE_URL` covers
|
|
10
|
+
both a local SQLite file and a remote `libsql://` (Turso).
|
|
11
|
+
|
|
12
|
+
## Run it
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
# local SQLite file
|
|
16
|
+
DATABASE_URL=file:/var/lib/ccpool/server.db PORT=8787 npx ccpool-server
|
|
17
|
+
|
|
18
|
+
# remote libSQL / Turso
|
|
19
|
+
DATABASE_URL=libsql://your-db.turso.io CCPOOL_DB_AUTH_TOKEN=… PORT=8787 npx ccpool-server
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Or install it globally and run the `ccpool-server` binary:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npm install -g ccpool-server
|
|
26
|
+
DATABASE_URL=file:/var/lib/ccpool/server.db ccpool-server
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Environment
|
|
30
|
+
|
|
31
|
+
| Variable | Required | Description |
|
|
32
|
+
| ---------------------- | -------- | ------------------------------------------------------------ |
|
|
33
|
+
| `DATABASE_URL` | yes | A `file:` path (local SQLite) or a `libsql://…` (Turso) URL. |
|
|
34
|
+
| `CCPOOL_DB_AUTH_TOKEN` | remote | Auth token for a remote `libsql://` database. |
|
|
35
|
+
| `PORT` | no | Port to listen on (default `8787`). |
|
|
36
|
+
|
|
37
|
+
The schema (ledger + registry tables) is brought up idempotently on boot — there's
|
|
38
|
+
nothing to migrate by hand.
|
|
39
|
+
|
|
40
|
+
## Point CLIs at it
|
|
41
|
+
|
|
42
|
+
Members set `CCPOOL_SERVER_URL=https://your-host` when running `ccpool init`. Run the
|
|
43
|
+
server behind TLS: the bearer token rides on every request, so the CLI refuses plain
|
|
44
|
+
`http://` for anything but localhost. Passwords are stored as salted scrypt hashes and
|
|
45
|
+
tokens as sha256 hashes — the server never keeps a usable credential.
|
|
46
|
+
|
|
47
|
+
See [Storage & server](https://ccpool.hexxt.dev/docs/algorithm/storage-and-server) for how
|
|
48
|
+
tenancy and the two-password model work.
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
MIT
|