@seams/cli 0.0.0-stage → 0.29.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/README.md +83 -2
- package/bin/seams-wallet.mjs +128 -0
- package/package.json +30 -4
- package/release-root.json +1 -0
package/README.md
CHANGED
|
@@ -1,3 +1,84 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Seams Wallet CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The `seams-wallet` command runs on macOS (Apple Silicon or Intel) and Linux x86_64.
|
|
4
|
+
The npm launcher requires Node.js 22 or later and verifies the signed native
|
|
5
|
+
release before running it. The CLI discovers the dashboard from the console
|
|
6
|
+
and uses explicit wrapper-key filenames.
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install --global @seams/cli@0.29.0
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Use the commands shown in your Seams dashboard. They include your console URL,
|
|
13
|
+
environment, and configured recovery destination. The same executable and HTTPS
|
|
14
|
+
verification run in local development and production. Install your development
|
|
15
|
+
CA in the operating system's trust store when using a local HTTPS deployment.
|
|
16
|
+
|
|
17
|
+
## Create and download a complete backup
|
|
18
|
+
|
|
19
|
+
Follow Recovery backup in the dashboard. Each holder runs the displayed key
|
|
20
|
+
setup command and approves the matching code in the browser. Setup saves their
|
|
21
|
+
private wrapper key file and the deployment's public recovery authority on their device.
|
|
22
|
+
Setup defaults to `deriver-a-wrapper.key` or `deriver-b-wrapper.key` for the selected
|
|
23
|
+
role. Use `--wrapping-key-file` to choose another path.
|
|
24
|
+
|
|
25
|
+
The CLI creates the ZIP locally with the manifest, role backup packages, and their
|
|
26
|
+
matching wrapper key files. Two-owner governance provides each holder's own package
|
|
27
|
+
and key; single-owner governance includes both. Keep these files safe.
|
|
28
|
+
|
|
29
|
+
ZIP password protection is optional. Press Enter at the password prompt for a normal
|
|
30
|
+
ZIP or enter a password for AES-256 encryption. Extract the ZIP before using the CLI;
|
|
31
|
+
extracted keys require no separate password.
|
|
32
|
+
|
|
33
|
+
## Verify the extracted files
|
|
34
|
+
|
|
35
|
+
From the extracted folder:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
seams-wallet derivation-root backup verify
|
|
39
|
+
seams-wallet derivation-root backup check --role deriver-a
|
|
40
|
+
seams-wallet derivation-root backup check --role deriver-b
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
For a holder-specific ZIP, add `--role deriver-a` or `--role deriver-b` to
|
|
44
|
+
verification and run only that holder's decryption check. Verification checks
|
|
45
|
+
signatures and package integrity; `backup check` also confirms the saved key
|
|
46
|
+
can decrypt the package. Offline verification does not check revocation status
|
|
47
|
+
or perform a restore.
|
|
48
|
+
|
|
49
|
+
On a device that has not connected to this deployment, first run the dashboard's
|
|
50
|
+
`trust connect` command. It obtains the authority over verified HTTPS, verifies
|
|
51
|
+
the manifest, and saves the authority for subsequent offline use. A trust file
|
|
52
|
+
inside an archive cannot authorize itself. Release-signing trust remains
|
|
53
|
+
separate and compiled into the launcher.
|
|
54
|
+
|
|
55
|
+
## Restore
|
|
56
|
+
|
|
57
|
+
Copy each holder's bundled restore command from the dashboard. It includes
|
|
58
|
+
`--destination`, `--console-url`, and `--environment`. The CLI discovers the dashboard
|
|
59
|
+
address from the console over verified HTTPS.
|
|
60
|
+
The CLI opens the dashboard: compare the code and approve access using your
|
|
61
|
+
signed-in session. No tenant bootstrap credential is required.
|
|
62
|
+
|
|
63
|
+
The bundled command registers the manifest, imports that holder's share, and
|
|
64
|
+
saves retry state. It finds `manifest.json`, `deriver-a.backup` / `deriver-b.backup`,
|
|
65
|
+
and the matching `deriver-a-wrapper.key` / `deriver-b-wrapper.key` file in the current folder. Keep its `.restore-*` files
|
|
66
|
+
and rerun the same command after an interruption.
|
|
67
|
+
|
|
68
|
+
Once both imports complete, follow the dashboard's status and activation
|
|
69
|
+
commands. Activation is explicit. The destination must be configured for this
|
|
70
|
+
organization and environment and have no active derivation root.
|
|
71
|
+
|
|
72
|
+
Operators provisioning a destination may explicitly use `--bootstrap-fd` instead
|
|
73
|
+
of browser authorization. That credential stays on the server in the tenant
|
|
74
|
+
workflow. Tenant commands and production commands follow the same authorization
|
|
75
|
+
and destination-binding checks.
|
|
76
|
+
|
|
77
|
+
## Save a complete recovery kit
|
|
78
|
+
|
|
79
|
+
Copy the `backup kit` command from your dashboard and run it in the directory
|
|
80
|
+
containing both enrolled wrapper key files. Approve the matching browser code. The CLI
|
|
81
|
+
downloads the authorized recovery set, checks both keys decrypt their packages,
|
|
82
|
+
and saves `seams-recovery.zip` with private file permissions. An optional password
|
|
83
|
+
encrypts every ZIP entry with AES-256. Use an AES-compatible ZIP extractor.
|
|
84
|
+
The dashboard never reads the private keys or ZIP password.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createHash, createPublicKey, verify } from 'node:crypto';
|
|
3
|
+
import { readFile, mkdir, writeFile, chmod, rename, rm } from 'node:fs/promises';
|
|
4
|
+
import { homedir } from 'node:os';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { spawnSync } from 'node:child_process';
|
|
7
|
+
|
|
8
|
+
function canonical(value) {
|
|
9
|
+
if (Array.isArray(value)) return `[${value.map(canonical).join(',')}]`;
|
|
10
|
+
if (value !== null && typeof value === 'object')
|
|
11
|
+
return `{${Object.keys(value)
|
|
12
|
+
.sort()
|
|
13
|
+
.map((key) => `${JSON.stringify(key)}:${canonical(value[key])}`)
|
|
14
|
+
.join(',')}}`;
|
|
15
|
+
return JSON.stringify(value);
|
|
16
|
+
}
|
|
17
|
+
async function download(url, maximum) {
|
|
18
|
+
const response = await fetch(url, { signal: AbortSignal.timeout(120000) });
|
|
19
|
+
if (!response.ok || !response.url.startsWith('https://') || response.body === null)
|
|
20
|
+
throw new Error('Unable to download the signed Seams release.');
|
|
21
|
+
const chunks = [];
|
|
22
|
+
let size = 0;
|
|
23
|
+
for await (const chunk of response.body) {
|
|
24
|
+
size += chunk.length;
|
|
25
|
+
if (size > maximum) throw new Error('Release download exceeds its size limit.');
|
|
26
|
+
chunks.push(chunk);
|
|
27
|
+
}
|
|
28
|
+
return Buffer.concat(chunks);
|
|
29
|
+
}
|
|
30
|
+
function digest(bytes) {
|
|
31
|
+
return createHash('sha256').update(bytes).digest('base64url');
|
|
32
|
+
}
|
|
33
|
+
function target() {
|
|
34
|
+
switch (`${process.platform}-${process.arch}`) {
|
|
35
|
+
case 'darwin-arm64':
|
|
36
|
+
return 'aarch64-apple-darwin';
|
|
37
|
+
case 'darwin-x64':
|
|
38
|
+
return 'x86_64-apple-darwin';
|
|
39
|
+
case 'linux-x64':
|
|
40
|
+
return 'x86_64-unknown-linux-gnu';
|
|
41
|
+
default:
|
|
42
|
+
throw new Error('Supported platforms: macOS Apple Silicon/Intel and Linux x86_64.');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async function main() {
|
|
46
|
+
const pkg = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8'));
|
|
47
|
+
const root = JSON.parse(await readFile(new URL('../release-root.json', import.meta.url), 'utf8'));
|
|
48
|
+
const platform = target();
|
|
49
|
+
const base = `https://github.com/seams-tech/seams-wallet/releases/download/seams-cli-v${pkg.version}`;
|
|
50
|
+
const directory = join(homedir(), '.cache', 'seams-cli', pkg.version);
|
|
51
|
+
const manifestPath = join(directory, 'seams-release-manifest.json');
|
|
52
|
+
let manifestBytes;
|
|
53
|
+
try {
|
|
54
|
+
manifestBytes = await readFile(manifestPath);
|
|
55
|
+
} catch (error) {
|
|
56
|
+
if (error.code !== 'ENOENT') throw error;
|
|
57
|
+
manifestBytes = await download(`${base}/seams-release-manifest.json`, 65536);
|
|
58
|
+
}
|
|
59
|
+
if (manifestBytes.length > 65536) throw new Error('Release manifest exceeds its size limit.');
|
|
60
|
+
const manifest = JSON.parse(manifestBytes);
|
|
61
|
+
const { signature, ...unsigned } = manifest;
|
|
62
|
+
if (
|
|
63
|
+
manifest.formatVersion !== 'seams_release_checksum_manifest_v1' ||
|
|
64
|
+
manifest.releaseVersion !== pkg.version ||
|
|
65
|
+
manifest.signerKeyId !== root.keyId ||
|
|
66
|
+
typeof signature !== 'string' ||
|
|
67
|
+
!Array.isArray(manifest.entries)
|
|
68
|
+
)
|
|
69
|
+
throw new Error('Release manifest does not match this CLI package.');
|
|
70
|
+
const key = createPublicKey({
|
|
71
|
+
format: 'jwk',
|
|
72
|
+
key: { kty: 'OKP', crv: 'Ed25519', x: root.verifyingKey },
|
|
73
|
+
});
|
|
74
|
+
if (
|
|
75
|
+
!verify(
|
|
76
|
+
null,
|
|
77
|
+
Buffer.concat([
|
|
78
|
+
Buffer.from('seams/release-checksum-manifest/v1'),
|
|
79
|
+
Buffer.from(canonical(unsigned)),
|
|
80
|
+
]),
|
|
81
|
+
key,
|
|
82
|
+
Buffer.from(signature, 'base64url'),
|
|
83
|
+
)
|
|
84
|
+
)
|
|
85
|
+
throw new Error('Release signature verification failed.');
|
|
86
|
+
const entries = manifest.entries.filter(
|
|
87
|
+
(entry) => entry.target === platform && entry.filename === `seams-wallet-${platform}`,
|
|
88
|
+
);
|
|
89
|
+
if (entries.length !== 1 || !/^[A-Za-z0-9_-]{43}$/.test(entries[0].sha256B64u))
|
|
90
|
+
throw new Error('No verified binary for this platform.');
|
|
91
|
+
const entry = entries[0];
|
|
92
|
+
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
93
|
+
const executable = join(directory, entry.filename);
|
|
94
|
+
let cached = null;
|
|
95
|
+
try {
|
|
96
|
+
cached = await readFile(executable);
|
|
97
|
+
} catch (error) {
|
|
98
|
+
if (error.code !== 'ENOENT') throw error;
|
|
99
|
+
}
|
|
100
|
+
if (cached === null || digest(cached) !== entry.sha256B64u) {
|
|
101
|
+
const bytes = await download(`${base}/${entry.filename}`, 200 * 1024 * 1024);
|
|
102
|
+
if (digest(bytes) !== entry.sha256B64u) throw new Error('Binary checksum verification failed.');
|
|
103
|
+
const temporary = `${executable}.${process.pid}.tmp`;
|
|
104
|
+
try {
|
|
105
|
+
await writeFile(temporary, bytes, { mode: 0o700, flag: 'wx' });
|
|
106
|
+
await rename(temporary, executable);
|
|
107
|
+
} finally {
|
|
108
|
+
await rm(temporary, { force: true });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const temporaryManifest = `${manifestPath}.${process.pid}.tmp`;
|
|
112
|
+
try {
|
|
113
|
+
await writeFile(temporaryManifest, manifestBytes, { mode: 0o600, flag: 'wx' });
|
|
114
|
+
await rename(temporaryManifest, manifestPath);
|
|
115
|
+
} finally {
|
|
116
|
+
await rm(temporaryManifest, { force: true });
|
|
117
|
+
}
|
|
118
|
+
await chmod(executable, 0o700);
|
|
119
|
+
const result = spawnSync(executable, process.argv.slice(2), { stdio: 'inherit' });
|
|
120
|
+
if (result.error) throw result.error;
|
|
121
|
+
process.exitCode = result.status ?? (result.signal === 'SIGINT' ? 130 : 1);
|
|
122
|
+
}
|
|
123
|
+
try {
|
|
124
|
+
await main();
|
|
125
|
+
} catch (error) {
|
|
126
|
+
console.error(error instanceof Error ? error.message : 'Seams CLI setup failed.');
|
|
127
|
+
process.exitCode = 1;
|
|
128
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seams/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.29.0",
|
|
4
|
+
"description": "Seams native recovery CLI launcher",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=22"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"seams-wallet": "bin/seams-wallet.mjs"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin",
|
|
15
|
+
"release-root.json",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"prepack": "node prepare.mjs"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/seams-tech/seams-wallet.git"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/seams-tech/seams-wallet/issues"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://github.com/seams-tech/seams-wallet#readme"
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"formatVersion":"seams_release_root_v1","keyId":"seams-release-root-production-2026-10","verifyingKey":"DoQRzk0LwzlyyX7VxntaFT6iNwxh1ezZBvzHczHHDDo"}
|