Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
NODE_AUTH_TOKEN=github_pat_with_read_packages
PORT=8787
INVISIBLE_COORDINATOR_PRESET=dev
INVISIBLE_ENABLE_MUTATIONS=false

# Optional: pass an exact CoordinatorPoolConfig JSON instead of a preset.
# INVISIBLE_COORDINATOR_POOL_JSON={"endpoints":[{"wsUrl":"wss://example.com/ws-noise","expectedHostname":"example.com","releasePin":{"mrtd":"..."},"requiredMode":"prod"}]}
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
node_modules/
dist/
.wrangler/
.env
.env.*
!.dev.vars.example
!.env.example
*.tsbuildinfo
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@invisible-labs:registry=https://npm.pkg.github.com
save-exact=true
52 changes: 49 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,51 @@
# Invisible Worker
# Invisible SDK Node Server Example

Cloudflare Worker server example for Invisible private transfers.
Backend/server example for `@invisible-labs/sdk`.

Implementation lives in pull requests.
This replaces the old "worker" positioning with a standard Node.js HTTP server.

It demonstrates the current SDK basics:

- attested session open, re-attestation, close
- normal-user private transfer, status restore, refund intent
- LP lifecycle entrypoints: create, recover, DKG, funding, refill, withdraw
- local storage, recovery-code helpers, derived refundable amount
- coordinator-pending surfaces are imported and kept explicit

## Install

The SDK is currently private on GitHub Packages.

```bash
export NODE_AUTH_TOKEN=<github-token-with-read:packages>
npm ci
```

If npm is not already configured for GitHub Packages:

```bash
npm config set //npm.pkg.github.com/:_authToken "$NODE_AUTH_TOKEN"
```

## Run

```bash
cp .env.example .env
npm run dev
```

Safe routes:

- `GET /health`: local SDK utility check
- `GET /sdk/surface`: SDK surface imported by this example
- `POST /attestation`: opens and closes an attested SDK session

Mutating routes are blocked unless `INVISIBLE_ENABLE_MUTATIONS=true`.

## Validate

```bash
npm run typecheck
npm run build
npm test
```
Loading