routstrd 0.3.10 → 0.4.0
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/IMPLEMENTATION.md +253 -0
- package/README.md +45 -0
- package/SECURITY.md +23 -0
- package/SKILL.md +13 -3
- package/bun.lock +68 -41
- package/dist/daemon/index.js +47850 -11349
- package/dist/index.js +4730 -448
- package/package.json +8 -3
- package/src/cli.test.ts +55 -0
- package/src/cli.ts +502 -229
- package/src/daemon/args.ts +8 -1
- package/src/daemon/models.ts +119 -39
- package/src/daemon/wallet/coco-client.npc.test.ts +252 -0
- package/src/daemon/wallet/coco-client.test.ts +508 -0
- package/src/daemon/wallet/coco-client.ts +835 -0
- package/src/daemon/wallet/cocod-client.ts +86 -2
- package/src/daemon/wallet/fixtures/cocod-0.0.24-wallet.db.gz +0 -0
- package/src/daemon/wallet/migration.test.ts +147 -0
- package/src/daemon/wallet/migration.ts +209 -0
- package/src/daemon/wallet/paths.ts +33 -0
- package/src/integrations/claudecode.ts +2 -1
- package/src/integrations/hermes.ts +46 -6
- package/src/integrations/openclaw.ts +3 -2
- package/src/integrations/opencode.ts +3 -2
- package/src/integrations/pi.ts +3 -2
- package/src/integrations/registry.ts +7 -5
- package/src/start-daemon.ts +168 -22
- package/src/tui/usage/app.ts +41 -2
- package/src/tui/usage/render.ts +10 -3
- package/src/tui/usage/types.ts +6 -0
- package/src/utils/clients.ts +21 -0
- package/src/utils/config.ts +11 -0
- package/src/utils/daemon-client.ts +104 -25
- package/src/utils/logger.ts +42 -28
- package/src/utils/update-checker.ts +114 -0
- package/tests/utils/daemon-client.test.ts +61 -0
- package/tests/wallet/short-keyset-token.test.ts +106 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# Migrate wallet storage from `~/.cocod` to `~/.routstrd/wallet`
|
|
2
|
+
|
|
3
|
+
Task: [`routstrd-migrate-cocod-to-routstrd-files`](https://github.com/nodestrich/routstrd)
|
|
4
|
+
Event ID: `2f420644005154c5b106017c4a753854bb2660ba834cde7e6e267532cb5448e9`
|
|
5
|
+
Priority: 997 · Status: open
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Baseline
|
|
10
|
+
|
|
11
|
+
This plan is based on `coco-integration` at `86ac688` (after the default-mint, NPC/npubx.cash, and Windows-support changes).
|
|
12
|
+
|
|
13
|
+
The task branch is currently based on `04f8c22`; rebase it onto the latest `coco-integration` before implementing this plan.
|
|
14
|
+
|
|
15
|
+
## Goal
|
|
16
|
+
|
|
17
|
+
Move the in-process Cashu wallet's persistent data from:
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
~/.cocod/config.json
|
|
21
|
+
~/.cocod/coco.db
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
to:
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
~/.routstrd/wallet/config.json
|
|
28
|
+
~/.routstrd/wallet/coco.db
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The migration must preserve the mnemonic, proofs, default mint, and NPC identity. Existing users must not accidentally get a new wallet, and `cocod` and routstrd must never open the same database concurrently.
|
|
32
|
+
|
|
33
|
+
Fresh installs must use `~/.routstrd/wallet` immediately. Existing installs must be migrated automatically and safely; merely continuing to run from `~/.cocod` is not sufficient for this task.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Important corrections to the previous plan
|
|
38
|
+
|
|
39
|
+
### 1. Do not rename or migrate `cocod.sock`
|
|
40
|
+
|
|
41
|
+
The in-process `coco-core` wallet does not expose a Unix socket. `cocod.sock` belongs to the legacy external `cocod` daemon and is used only to determine whether that daemon is still alive.
|
|
42
|
+
|
|
43
|
+
There should therefore be no `wallet.sock`. Do not copy a socket inode into the new directory.
|
|
44
|
+
|
|
45
|
+
### 2. Keep legacy-process paths separate from wallet-data paths
|
|
46
|
+
|
|
47
|
+
On the current base, `src/daemon/wallet/coco-client.ts` derives all of these from one `CONFIG_DIR`:
|
|
48
|
+
|
|
49
|
+
- wallet config and database;
|
|
50
|
+
- legacy cocod socket;
|
|
51
|
+
- legacy cocod PID/process lock.
|
|
52
|
+
|
|
53
|
+
That coupling must be removed. After migration:
|
|
54
|
+
|
|
55
|
+
- wallet data comes from `~/.routstrd/wallet`;
|
|
56
|
+
- probes and shutdown logic for an external legacy cocod continue to use `~/.cocod/cocod.sock` and `~/.cocod/cocod.pid`;
|
|
57
|
+
- routstrd uses `~/.routstrd/wallet/wallet.pid` as the in-process wallet lock.
|
|
58
|
+
|
|
59
|
+
While routstrd owns the migrated wallet, it should also retain the existing legacy-cocod exclusion mechanism (claiming the legacy `cocod.pid`) so an old cocod cannot be started against a stale or partially migrated legacy wallet. Acquisition and release of both locks must be rollback-safe.
|
|
60
|
+
|
|
61
|
+
### 3. Do not rename `cocodPath`
|
|
62
|
+
|
|
63
|
+
`RoutstrdConfig.cocodPath` is an executable path for the external compatibility client, not a wallet storage path. Renaming it to `walletPath` would change its meaning and would not help this migration.
|
|
64
|
+
|
|
65
|
+
The current daemon creates `createCocoClient()` directly and injects it into `createWalletAdapter()`, so `cocodPath` is effectively bypassed on the normal in-process path. Cleanup or removal of that compatibility setting is a separate task.
|
|
66
|
+
|
|
67
|
+
### 4. Do not implement fallback as the steady state
|
|
68
|
+
|
|
69
|
+
A resolver that permanently falls back to `~/.cocod` does not move the data. Legacy detection is needed to initiate migration, but successful startup should resolve to the canonical directory afterward.
|
|
70
|
+
|
|
71
|
+
### 5. Account for the updated base
|
|
72
|
+
|
|
73
|
+
The latest `coco-integration` adds:
|
|
74
|
+
|
|
75
|
+
- `defaultMintUrl` persistence in the wallet's `config.json`;
|
|
76
|
+
- the NPC plugin, whose Nostr identity is derived from the same mnemonic;
|
|
77
|
+
- `src/daemon/wallet/coco-client.npc.test.ts`;
|
|
78
|
+
- Windows support and `USERPROFILE` fallback.
|
|
79
|
+
|
|
80
|
+
Migration must preserve the complete config JSON rather than reconstructing selected fields. Path construction must use `path.join` rather than hard-coded `/` separators.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Current runtime path references on the latest base
|
|
85
|
+
|
|
86
|
+
### Wallet data and legacy process coordination
|
|
87
|
+
|
|
88
|
+
| File | Current responsibility | Required change |
|
|
89
|
+
|---|---|---|
|
|
90
|
+
| `src/daemon/wallet/coco-client.ts` | Uses one `.cocod` directory for config, DB, socket, and PID; owns the in-process wallet and legacy-cocod guard | Split canonical data paths from legacy process paths; migrate before opening the DB; use `wallet.pid` for the in-process lock |
|
|
91
|
+
| `src/daemon/wallet/cocod-client.ts` | External cocod compatibility client; defaults to `.cocod/cocod.sock` | Keep legacy defaults and clarify that they are external-cocod paths |
|
|
92
|
+
| `src/cli.ts` | Initializes `.cocod`; two restart paths wait on `.cocod/cocod.pid` | Initialize/migrate the canonical wallet and wait on `wallet.pid` |
|
|
93
|
+
| `src/utils/config.ts` | Defines `~/.routstrd`, but no wallet subdirectory | Export canonical and legacy wallet/process path helpers or constants |
|
|
94
|
+
| `src/daemon/index.ts` | Calls `createCocoClient()` before building the adapter | Ensure migration occurs before the client opens the DB |
|
|
95
|
+
|
|
96
|
+
### Tests and documentation
|
|
97
|
+
|
|
98
|
+
| File | Required update |
|
|
99
|
+
|---|---|
|
|
100
|
+
| `src/cli.test.ts` | Change fresh-wallet expectations and add migration coverage |
|
|
101
|
+
| `src/daemon/wallet/coco-client.test.ts` | Update data/lock paths and add migration/dual-lock tests |
|
|
102
|
+
| `src/daemon/wallet/coco-client.npc.test.ts` | Use the canonical wallet layout in fixtures; verify migrated mnemonic/config still drives NPC identity |
|
|
103
|
+
| `README.md` | Document the new location and migration behavior; retain legacy cocod terminology only where discussing compatibility |
|
|
104
|
+
| `SKILL.md` | Update wallet storage and environment-variable documentation |
|
|
105
|
+
|
|
106
|
+
The fixture `src/daemon/wallet/fixtures/cocod-0.0.24-wallet.db.gz` keeps its name because it records the fixture's provenance.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Target path model
|
|
111
|
+
|
|
112
|
+
Define the path model in one dependency-light module (for example `src/daemon/wallet/paths.ts`, or in `src/utils/config.ts` if that does not introduce a cycle):
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
ROUTSTRD config root process.env.ROUTSTRD_DIR || ~/.routstrd
|
|
116
|
+
canonical wallet directory process.env.ROUTSTRD_WALLET_DIR || <config root>/wallet
|
|
117
|
+
canonical wallet config <wallet directory>/config.json
|
|
118
|
+
canonical wallet database <wallet directory>/coco.db
|
|
119
|
+
canonical wallet lock process.env.ROUTSTRD_WALLET_PID || <wallet directory>/wallet.pid
|
|
120
|
+
|
|
121
|
+
legacy cocod directory process.env.COCOD_DIR || ~/.cocod
|
|
122
|
+
legacy cocod socket process.env.COCOD_SOCKET || <legacy directory>/cocod.sock
|
|
123
|
+
legacy cocod PID process.env.COCOD_PID || <legacy directory>/cocod.pid
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Use `HOME` with `USERPROFILE` fallback, matching the updated Windows-support base. Use functions or injectable path objects where tests need to change environment variables after module import.
|
|
127
|
+
|
|
128
|
+
`COCOD_DIR`, `COCOD_SOCKET`, and `COCOD_PID` remain compatibility controls for locating an old external cocod. They must not redirect the new in-process wallet away from `~/.routstrd/wallet`. `ROUTSTRD_WALLET_DIR` is the new explicit data-directory override.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Implementation plan
|
|
133
|
+
|
|
134
|
+
### Phase 1 — Centralize and separate paths
|
|
135
|
+
|
|
136
|
+
1. Add the canonical wallet and legacy cocod path definitions above.
|
|
137
|
+
2. Remove the local `.cocod` path construction from `coco-client.ts` and `cli.ts`.
|
|
138
|
+
3. Change `CreateCocoClientOptions` so tests/tooling can independently override:
|
|
139
|
+
- wallet data directory;
|
|
140
|
+
- wallet lock path;
|
|
141
|
+
- legacy cocod socket and PID paths.
|
|
142
|
+
4. Keep `cocod-client.ts` pointed at the legacy socket. Do not make it import a resolver that prefers the new wallet directory.
|
|
143
|
+
|
|
144
|
+
### Phase 2 — Add a safe automatic migration primitive
|
|
145
|
+
|
|
146
|
+
Add an idempotent `migrateLegacyWallet()` helper with injectable paths/filesystem operations for tests.
|
|
147
|
+
|
|
148
|
+
Preconditions and behavior:
|
|
149
|
+
|
|
150
|
+
1. If the canonical wallet already contains both `config.json` and `coco.db`, return `already-current` and do not touch legacy data.
|
|
151
|
+
2. If neither canonical nor legacy wallet data exists, return `fresh`; initialization will create the canonical directory.
|
|
152
|
+
3. If only the legacy wallet exists:
|
|
153
|
+
- first verify that legacy cocod is not running using the existing PID and socket guard;
|
|
154
|
+
- create a private staging directory under `~/.routstrd` with mode `0700`;
|
|
155
|
+
- copy the complete `config.json` and `coco.db` into staging without parsing or rewriting them;
|
|
156
|
+
- apply `0600` to both files;
|
|
157
|
+
- validate that the staged files exist and have the expected byte sizes;
|
|
158
|
+
- atomically rename the staged directory to `wallet`;
|
|
159
|
+
- only after the canonical directory is committed, remove the legacy `config.json` and `coco.db`;
|
|
160
|
+
- never copy `cocod.sock` or `cocod.pid`.
|
|
161
|
+
4. If canonical storage is partial, legacy storage is partial, both contain wallet data, or files conflict, stop with an actionable error. Never merge databases and never generate a new mnemonic over an ambiguous state.
|
|
162
|
+
5. Clean up an uncommitted staging directory after failure. A committed canonical wallet remains authoritative if cleanup of the old files fails; report that cleanup warning clearly.
|
|
163
|
+
|
|
164
|
+
The migration should preserve unknown config fields, including `defaultMintUrl`, and preserve the database byte-for-byte. This also preserves the NPC identity because that identity is derived from the mnemonic.
|
|
165
|
+
|
|
166
|
+
A staging copy plus atomic directory rename is preferred over two independent file renames: a crash must not expose a half-created canonical wallet. Copying also permits a clear rollback before commit and supports a legacy directory located on another filesystem through `COCOD_DIR`.
|
|
167
|
+
|
|
168
|
+
### Phase 3 — Run migration from every wallet-opening path
|
|
169
|
+
|
|
170
|
+
1. **CLI onboarding/init:** run migration before `initializeWallet()`. Only initialize a new mnemonic when migration reports `fresh`.
|
|
171
|
+
2. **Daemon direct startup:** run migration before `createCocoClient()` opens `coco.db`. This covers users who invoke the daemon without rerunning onboarding.
|
|
172
|
+
3. **Start/restart/update/service paths:** retain `stopLegacyCocod()` before migration/startup where those paths already stop legacy cocod. Direct daemon startup should refuse with the existing actionable error rather than silently running two wallet engines.
|
|
173
|
+
4. Print a concise success message showing old and new directories, but never print config contents or the mnemonic during migration.
|
|
174
|
+
|
|
175
|
+
A separate `routstrd wallet migrate` command is optional as a manual recovery/preview entry point, but it must call the same migration primitive. It is not a substitute for automatic migration.
|
|
176
|
+
|
|
177
|
+
### Phase 4 — Separate process locking
|
|
178
|
+
|
|
179
|
+
Refactor the current `claimLegacyCocodPidFile()` behavior into explicit responsibilities:
|
|
180
|
+
|
|
181
|
+
1. Claim `wallet.pid` for the lifetime of the in-process wallet to prevent two routstrd wallet instances from opening `coco.db`.
|
|
182
|
+
2. Continue claiming the legacy `cocod.pid` while routstrd is active, after verifying no real cocod owns it, to prevent an old cocod from starting.
|
|
183
|
+
3. If either claim fails, release any claim already acquired before returning the error.
|
|
184
|
+
4. On `CocodClient.dispose()`, startup failure, and daemon shutdown, release only PID files still owned by the current process.
|
|
185
|
+
5. Keep `stopLegacyCocod()` and `assertLegacyCocodNotRunning()` operating only on legacy cocod paths.
|
|
186
|
+
6. Update both PID-release waits in `src/cli.ts` (`restartDaemonsAfterUpdate` and `restart`) to wait for the canonical `wallet.pid` rather than `.cocod/cocod.pid`.
|
|
187
|
+
|
|
188
|
+
There is no canonical wallet socket.
|
|
189
|
+
|
|
190
|
+
### Phase 5 — Update initialization and client defaults
|
|
191
|
+
|
|
192
|
+
1. Make `initializeWallet()` default to the canonical wallet directory.
|
|
193
|
+
2. Preserve directory mode `0700` and config mode `0600` on both migrated and fresh wallets.
|
|
194
|
+
3. In `createCocoClient()`, derive `config.json` and `coco.db` from the canonical wallet directory, but take legacy guard paths separately.
|
|
195
|
+
4. Update the wallet-access comment near `unlock()` to reference `~/.routstrd/wallet/config.json`.
|
|
196
|
+
5. Leave `CocodClient`, `resolveCocodExecutable()`, and `cocodPath` compatibility behavior unchanged.
|
|
197
|
+
|
|
198
|
+
### Phase 6 — Tests
|
|
199
|
+
|
|
200
|
+
Add or update tests for:
|
|
201
|
+
|
|
202
|
+
- fresh initialization creates `~/.routstrd/wallet`, not `.cocod`;
|
|
203
|
+
- a legacy config and database migrate byte-for-byte;
|
|
204
|
+
- `defaultMintUrl` and unknown config fields survive migration;
|
|
205
|
+
- the NPC-derived identity is unchanged after migration;
|
|
206
|
+
- migration never copies socket or PID files;
|
|
207
|
+
- migration refuses while a real legacy cocod is running;
|
|
208
|
+
- stale legacy socket/PID handling remains safe;
|
|
209
|
+
- an existing complete canonical wallet wins without modifying it;
|
|
210
|
+
- partial canonical, partial legacy, and conflicting dual-wallet states fail without generating a mnemonic;
|
|
211
|
+
- staging cleanup and retry after an interrupted migration;
|
|
212
|
+
- custom `ROUTSTRD_DIR`, `ROUTSTRD_WALLET_DIR`, and legacy `COCOD_DIR` paths;
|
|
213
|
+
- Windows-compatible path construction;
|
|
214
|
+
- acquiring the second process lock rolls back the first on failure;
|
|
215
|
+
- `dispose()` releases both owned locks and does not unlink another process's lock;
|
|
216
|
+
- both CLI restart paths wait for `wallet.pid`.
|
|
217
|
+
|
|
218
|
+
Keep `cocod-0.0.24-wallet.db.gz` unchanged and continue using it to prove the migrated database opens successfully with the current in-process wallet.
|
|
219
|
+
|
|
220
|
+
### Phase 7 — Documentation
|
|
221
|
+
|
|
222
|
+
Update `README.md` and `SKILL.md` to state:
|
|
223
|
+
|
|
224
|
+
- wallet data is stored in `~/.routstrd/wallet`;
|
|
225
|
+
- existing `~/.cocod` data is migrated automatically on first startup;
|
|
226
|
+
- users must back up the mnemonic before migration;
|
|
227
|
+
- `ROUTSTRD_WALLET_DIR` overrides the canonical wallet directory;
|
|
228
|
+
- `COCOD_DIR`, `COCOD_SOCKET`, `COCOD_PID`, and `cocodPath` refer only to legacy external-cocod compatibility.
|
|
229
|
+
|
|
230
|
+
Do not replace every use of the word `cocod`: references to the external daemon, compatibility client, legacy guard, package, and fixture are still accurate.
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Acceptance criteria
|
|
235
|
+
|
|
236
|
+
- A fresh install creates wallet data only under `~/.routstrd/wallet`.
|
|
237
|
+
- Starting from a valid `.cocod` wallet results in the same config and database under the canonical directory without changing balances, mnemonic-derived NPC identity, or default mint.
|
|
238
|
+
- No startup path silently creates a new mnemonic when recoverable legacy data exists.
|
|
239
|
+
- A running legacy cocod blocks migration and database opening.
|
|
240
|
+
- The new wallet directory contains no copied Unix socket and uses `wallet.pid` only as an in-process lock.
|
|
241
|
+
- Legacy cocod probing and exclusion continue to use `.cocod/cocod.sock` and `.cocod/cocod.pid`.
|
|
242
|
+
- The implementation works with `USERPROFILE`/Windows path construction and custom directory overrides.
|
|
243
|
+
- All wallet, CLI, typecheck, and build tests pass on the rebased `coco-integration` branch.
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## Suggested commit sequence
|
|
248
|
+
|
|
249
|
+
1. `refactor(wallet): separate routstrd wallet paths from legacy cocod paths`
|
|
250
|
+
2. `feat(wallet): atomically migrate legacy cocod wallet data`
|
|
251
|
+
3. `fix(wallet): use independent routstrd and legacy cocod process locks`
|
|
252
|
+
4. `test(wallet): cover migration, conflicts, NPC identity, and lock rollback`
|
|
253
|
+
5. `docs: document routstrd wallet storage and legacy migration`
|
package/README.md
CHANGED
|
@@ -6,6 +6,10 @@ Routstr daemon - A CLI tool for managing routstr processes, similar to `cocod` (
|
|
|
6
6
|
|
|
7
7
|
routstrd is a Bun-based CLI tool that provides a background daemon for the Routstr protocol. It integrates with `cocod` for wallet management and uses the Routstr SDK to handle provider routing and model discovery.
|
|
8
8
|
|
|
9
|
+
## Routstr for Teams
|
|
10
|
+
|
|
11
|
+
For team-based routing, see [routstrd-auth](https://github.com/Routstr/routstrd-auth).
|
|
12
|
+
|
|
9
13
|
## Features
|
|
10
14
|
|
|
11
15
|
- **Daemon Mode**: Run routstrd as a background HTTP server
|
|
@@ -70,6 +74,13 @@ With custom port:
|
|
|
70
74
|
routstrd start --port 9000
|
|
71
75
|
```
|
|
72
76
|
|
|
77
|
+
The daemon binds to `127.0.0.1` by default. To expose it on another interface:
|
|
78
|
+
```sh
|
|
79
|
+
routstrd start --host 0.0.0.0
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Only expose the daemon behind appropriate network controls.
|
|
83
|
+
|
|
73
84
|
With specific provider:
|
|
74
85
|
```sh
|
|
75
86
|
routstrd start --provider https://your-provider.com
|
|
@@ -97,6 +108,28 @@ Stop the daemon:
|
|
|
97
108
|
routstrd stop
|
|
98
109
|
```
|
|
99
110
|
|
|
111
|
+
### NPC (Lightning Address)
|
|
112
|
+
|
|
113
|
+
The in-process wallet registers the NPC (npubx.cash) plugin, which gives the
|
|
114
|
+
daemon a persistent Lightning address backed by the wallet's Cashu mints.
|
|
115
|
+
Payments to the address are imported into the wallet automatically (websocket
|
|
116
|
+
push, plus manual sync on demand).
|
|
117
|
+
|
|
118
|
+
```sh
|
|
119
|
+
# Show your NPC Lightning address (username@npubx.cash, or npub fallback)
|
|
120
|
+
routstrd wallet npc address
|
|
121
|
+
|
|
122
|
+
# Claim a username (quote first, then confirm to pay the claim fee from the wallet)
|
|
123
|
+
routstrd wallet npc username myname
|
|
124
|
+
routstrd wallet npc username myname --confirm
|
|
125
|
+
|
|
126
|
+
# Manually sync paid NPC quotes into the wallet
|
|
127
|
+
routstrd wallet npc sync
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Equivalent daemon endpoints: `GET /wallet/npc/address`,
|
|
131
|
+
`POST /wallet/npc/username`, `POST /wallet/npc/sync`.
|
|
132
|
+
|
|
100
133
|
### Daemon API
|
|
101
134
|
|
|
102
135
|
The daemon exposes an HTTP server (default port 8008) with the following endpoints:
|
|
@@ -128,6 +161,17 @@ Response:
|
|
|
128
161
|
}
|
|
129
162
|
```
|
|
130
163
|
|
|
164
|
+
## Wallet storage
|
|
165
|
+
|
|
166
|
+
The in-process Cashu wallet stores its mnemonic and proof database in
|
|
167
|
+
`~/.routstrd/wallet/`. On first startup, an existing wallet in `~/.cocod/` is
|
|
168
|
+
migrated automatically after routstrd verifies that the legacy cocod daemon is
|
|
169
|
+
not running. Back up your mnemonic before upgrading.
|
|
170
|
+
|
|
171
|
+
Set `ROUTSTRD_WALLET_DIR` to override the canonical wallet directory. The
|
|
172
|
+
`COCOD_DIR`, `COCOD_SOCKET`, and `COCOD_PID` variables are retained only for
|
|
173
|
+
locating and excluding a legacy external cocod process.
|
|
174
|
+
|
|
131
175
|
## Configuration
|
|
132
176
|
|
|
133
177
|
Configuration is stored in `~/.routstrd/config.json`:
|
|
@@ -135,6 +179,7 @@ Configuration is stored in `~/.routstrd/config.json`:
|
|
|
135
179
|
```json
|
|
136
180
|
{
|
|
137
181
|
"port": 8008,
|
|
182
|
+
"host": "127.0.0.1",
|
|
138
183
|
"provider": null,
|
|
139
184
|
"cocodPath": null
|
|
140
185
|
}
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
## SECURITY.md
|
|
2
|
+
# Security Policy
|
|
3
|
+
|
|
4
|
+
## Reporting a Vulnerability
|
|
5
|
+
|
|
6
|
+
Please report suspected security vulnerabilities privately to **team@routstr.com**.
|
|
7
|
+
|
|
8
|
+
Do not open a public GitHub issue or disclose the vulnerability publicly until we have had a
|
|
9
|
+
reasonable opportunity to investigate and coordinate a fix.
|
|
10
|
+
|
|
11
|
+
Please include, where possible:
|
|
12
|
+
|
|
13
|
+
- The affected Routstr package and version or commit
|
|
14
|
+
- A description of the vulnerability and its potential impact
|
|
15
|
+
- Steps to reproduce or a proof of concept
|
|
16
|
+
|
|
17
|
+
Do not include real Cashu tokens, seed phrases, private keys, or other secrets.
|
|
18
|
+
|
|
19
|
+
We will acknowledge your report and coordinate remediation and disclosure with you.
|
|
20
|
+
|
|
21
|
+
## Supported Versions
|
|
22
|
+
|
|
23
|
+
Security fixes are provided for the latest released version.
|
package/SKILL.md
CHANGED
|
@@ -170,7 +170,9 @@ Refresh routstr21 models from Nostr and re-run integrations for all registered c
|
|
|
170
170
|
| Variable | Default | Description |
|
|
171
171
|
|----------|---------|-------------|
|
|
172
172
|
| `ROUTSTRD_DIR` | `~/.routstrd` | Config directory |
|
|
173
|
-
| `
|
|
173
|
+
| `ROUTSTRD_WALLET_DIR` | `~/.routstrd/wallet` | In-process Cashu wallet data directory |
|
|
174
|
+
| `ROUTSTRD_WALLET_PID` | `<wallet>/wallet.pid` | In-process wallet lock path |
|
|
175
|
+
| `COCOD_DIR` | `~/.cocod` | Legacy external cocod compatibility directory |
|
|
174
176
|
|
|
175
177
|
### `routstrd mode`
|
|
176
178
|
|
|
@@ -191,12 +193,15 @@ View daemon logs.
|
|
|
191
193
|
| Option | Default | Description |
|
|
192
194
|
|--------|---------|-------------|
|
|
193
195
|
| `-f, --follow` | false | Follow log output (like `tail -f`) |
|
|
196
|
+
| `-c, --coco` | false | Show Cashu wallet-engine (coco) logs instead of daemon logs |
|
|
194
197
|
| `-n, --lines <number>` | 50 | Number of lines to show |
|
|
195
198
|
|
|
196
|
-
Log files are stored at `~/.routstrd/logs/YYYY-MM-DD.log`.
|
|
199
|
+
Log files are stored at `~/.routstrd/logs/YYYY-MM-DD.log`. Wallet-engine (Cashu/coco) diagnostics go to a separate `~/.routstrd/coco-logs/YYYY-MM-DD.log` so they don't pollute the main daemon logs.
|
|
197
200
|
|
|
198
201
|
## Wallet Commands
|
|
199
202
|
|
|
203
|
+
New wallets automatically trust `https://mint.cubabitcoin.org` as their default mint. The default is used when a wallet command does not include `--mint-url`.
|
|
204
|
+
|
|
200
205
|
### `routstrd wallet status`
|
|
201
206
|
|
|
202
207
|
Check wallet status.
|
|
@@ -245,6 +250,10 @@ List configured wallet mints.
|
|
|
245
250
|
|
|
246
251
|
Add a new mint by URL.
|
|
247
252
|
|
|
253
|
+
### `routstrd wallet mints set-default <url>`
|
|
254
|
+
|
|
255
|
+
Set the persistent default mint. If necessary, the mint is added as trusted first.
|
|
256
|
+
|
|
248
257
|
### `routstrd wallet mints info <url>`
|
|
249
258
|
|
|
250
259
|
Get info about a specific mint.
|
|
@@ -311,4 +320,5 @@ When `routstrd onboard` runs, it automatically configures a `routstr` provider i
|
|
|
311
320
|
| `~/.routstrd/routstr.db` | SQLite database |
|
|
312
321
|
| `~/.routstrd/routstrd.sock` | IPC socket |
|
|
313
322
|
| `~/.routstrd/routstrd.pid` | PID file |
|
|
314
|
-
| `~/.routstrd/logs/YYYY-MM-DD.log` | Daily log files |
|
|
323
|
+
| `~/.routstrd/logs/YYYY-MM-DD.log` | Daily daemon log files |
|
|
324
|
+
| `~/.routstrd/coco-logs/YYYY-MM-DD.log` | Daily Cashu wallet-engine (coco) log files |
|