@asecret/cli 0.0.0-stage → 0.1.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/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +72 -2
- package/bin/asecret-mcp.js +4 -0
- package/bin/asecret.js +12 -0
- package/core/spec/0.2/messages.schema.json +751 -0
- package/core/src/agent-crypto.js +191 -0
- package/core/src/agent.js +237 -0
- package/core/src/assistant-instructions.js +64 -0
- package/core/src/authorization.js +266 -0
- package/core/src/credentials.js +149 -0
- package/core/src/host-login.js +110 -0
- package/core/src/mcp-tools.js +130 -0
- package/core/src/wire.js +76 -0
- package/package.json +68 -4
- package/skill/SKILL.md +66 -0
- package/src/agents.js +140 -0
- package/src/api.js +188 -0
- package/src/commands.js +864 -0
- package/src/config.js +76 -0
- package/src/core.d.ts +55 -0
- package/src/core.js +19 -0
- package/src/errors.js +11 -0
- package/src/main.js +520 -0
- package/src/mcp.js +107 -0
- package/src/output.js +93 -0
- package/src/server.js +242 -0
- package/src/storage.js +137 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 (not yet published)
|
|
4
|
+
|
|
5
|
+
First release of `@asecret/cli`. It continues the secret and person side of `@afile/cli` 0.3.0: on 2 December 2026 aFile split in two, and aFile now keeps files while aSecret keeps secrets and private details.
|
|
6
|
+
|
|
7
|
+
- `asecret save NAME` keeps a secret, such as an API key, encrypted on this machine before it leaves, at api.asecret.sh or another aSecret server. The value comes only from standard input; in a terminal it is asked for without echo. Saving the same name again keeps a new version, and the one before is kept for 30 days. A secret can be up to 64 KiB, and its name is written like an environment variable's. `save` connects the agent first if needed.
|
|
8
|
+
- `asecret list` shows names only. `asecret run --secret NAME -- <cmd>` sets each secret in that command's environment alone and prints nothing about it. `asecret get NAME` prints a value, with a warning on standard error, and writes exactly the value to a pipe; `--version <n>` reads an earlier one. `asecret delete NAME` removes a secret with its earlier versions. `secret` and `secrets` remain as other names for `save` and `list`.
|
|
9
|
+
- `asecret link` links this agent to its person at asecret.sh with a code they approve, signed in with aGroup. They then see its secrets by name, never their values, and can delete them, pause the agent, unlink it or erase it. With agent recovery on, the agent seals its key to their recovery key, on linking or on its next command, so they can reveal and recover its secrets in their browser. `asecret unlink` ends the link, and `asecret me` shows the agent, its secrets, the link and recovery.
|
|
10
|
+
- Once linked, `asecret ask <type>` and `asecret ask setup` ask the person through asecret.sh, and `asks`, `check` and `cancel` follow the asks there. The person decides in their browser; the agent learns only "saved" or "ready". Payment methods, website forms, deliveries to merchants, order status and `asecret recipients` need the person's own aSecret server, linked with `--server`.
|
|
11
|
+
- `connect` (with `--restore`), `key --export`, `token --rotate`, `erase`, `logout`, `add`, `remove` and `instructions` are as in `@afile/cli`.
|
|
12
|
+
- `asecret mcp` and `asecret-mcp` run a local MCP server with `list_secrets`, which gives names only, and the ask tools: `public_directory`, `request_use`, `request_setup`, `request_order_status`, `request_save`, `owner_setup_link`, `website_form_link`, `check_request` and `cancel_request`. No tool returns a secret's value.
|
|
13
|
+
- Settings are `ASECRET_TOKEN`, `ASECRET_CONFIG_DIR` (default `~/.config/asecret`) and `ASECRET_API_URL`. Agent tokens start `ast_`, and requests send `asecret-version: 0.2`, the aSecret Protocol.
|
|
14
|
+
- The bundled skill is `asecret` 0.1.0.
|
|
15
|
+
|
|
16
|
+
Not here: files, notes, share links and receive links (`items`, `show`, `update`, `search`, `share`, `receive`, `links` and `close`). They stay in `@afile/cli`. The hidden `--vault` flag is gone too. Secrets saved with `@afile/cli` stay at aFile; save them here again.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 aSecret, part of aGroup
|
|
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
CHANGED
|
@@ -1,3 +1,73 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @asecret/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Agents use your secrets without seeing them. Use aSecret from the terminal to keep an agent's API keys and passwords encrypted, and hand one to a command without printing it. The agent's person can link it at asecret.sh to see its secrets by name. Once linked, the agent can ask them for one of their own details, such as their address. They decide in their browser, and the agent learns only the outcome, never the detail. Requires Node.js 24 or later.
|
|
4
|
+
|
|
5
|
+
For files and notes, see [aFile](https://afile.sh).
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install -g @asecret/cli
|
|
9
|
+
asecret connect
|
|
10
|
+
printf %s "$OPENAI_API_KEY" | asecret save OPENAI_API_KEY
|
|
11
|
+
asecret run --secret OPENAI_API_KEY -- python agent.py
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`asecret connect` registers this agent with no account. It creates the agent's key on this machine and saves the token and key, readable only by you. Every secret is encrypted here before it leaves: aSecret keeps ciphertext and can't read names or values. Without the key the secrets can't be read again, so keep a copy with `asecret key --export --out <file>`. `asecret connect --restore <file>` sets up the same agent on another machine. If the token leaks, `asecret token --rotate` replaces it and the old one stops working; the key, and so every secret, stays the same. `asecret erase` deletes the agent at aSecret with every secret it keeps.
|
|
15
|
+
|
|
16
|
+
## Secrets
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
printf %s "$OPENAI_API_KEY" | asecret save OPENAI_API_KEY
|
|
20
|
+
asecret save GITHUB_TOKEN
|
|
21
|
+
asecret list
|
|
22
|
+
asecret run --secret OPENAI_API_KEY --secret GITHUB_TOKEN -- ./release.sh
|
|
23
|
+
asecret get OPENAI_API_KEY --version 1
|
|
24
|
+
asecret delete GITHUB_TOKEN
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
A value comes only from standard input, never from the command line, so it stays out of shell history. In a terminal, `asecret save` asks for it without echo. Name a secret the way you'd name an environment variable. Saving the same name again keeps a new version, and the one before is kept for 30 days. A secret can be up to 64 KiB.
|
|
28
|
+
|
|
29
|
+
`list` shows names, never values. `run` decrypts each `--secret` and sets it, under its own name, in that command's environment alone. Nothing about the value is printed, so it never enters an agent's conversation, and the command's exit code is asecret's. `get` prints a value, with a warning on standard error, because whatever reads the output sees it; to a pipe it writes exactly the value. Prefer `run`. `delete` removes a secret with its earlier versions, and there's no undo. `secret` and `secrets` still work as other names for `save` and `list`.
|
|
30
|
+
|
|
31
|
+
## Your person
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
asecret link
|
|
35
|
+
asecret me
|
|
36
|
+
asecret unlink
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`asecret link` prints an address on asecret.sh and a code. The agent's person opens it signed in with aGroup, checks that the code matches and approves; the command waits until they decide. Ctrl-C stops waiting, and the code still works for 15 minutes. Once linked, the person sees this agent's secrets by name on asecret.sh, never their values, and can delete them, pause the agent so it can't ask, unlink it or erase it. With agent recovery turned on there, this agent seals its key to their recovery key, so only they can open it, and they can reveal and recover its secrets in their browser. If they turn recovery on later, the agent gives them its key on its next command, and `asecret me` shows where recovery stands. `asecret unlink` ends the link and deletes that copy of the key.
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
asecret ask postal_address
|
|
43
|
+
asecret ask setup
|
|
44
|
+
asecret asks
|
|
45
|
+
asecret check <ask> --wait
|
|
46
|
+
asecret cancel <ask>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Once linked, the agent can ask its person for a detail they keep: `postal_address`, `email`, `phone`, `membership`, `secure_note`, `api_key`, `password`, `id_number` or `document`. `asecret ask setup` asks them to set up several at once. `asecret ask` prints a review link on asecret.sh. The person opens it signed in, chooses or adds the detail in their browser and answers. The agent reads only the outcome, saved or ready, never the detail. An ask waits 15 minutes. Before linking, `asecret ask <type>` prints a public save page instead, which isn't tracked.
|
|
50
|
+
|
|
51
|
+
### Your person's own aSecret server
|
|
52
|
+
|
|
53
|
+
Payment methods, website forms and deliveries to merchants need your person's own aSecret server, one they run themselves. Link to it with `--server`, and the CLI remembers it; asks then go there.
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
asecret link --server https://asecret.example.com --name "Travel agent"
|
|
57
|
+
asecret recipients
|
|
58
|
+
asecret ask payment_method
|
|
59
|
+
asecret ask address --to northline --order 1846 --wait
|
|
60
|
+
asecret ask order-status --to northline --order 1846
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`asecret link --server` prints an address for the agent's person to open. They check the agent's name, choose how long it may ask, and approve it on their aSecret server. If the agent also keeps its secrets on that server (`ASECRET_API_URL`), they can see them by name, delete them and recover them. `recipients` lists the merchants their server delivers to. `save` and `ask` take `--key <uuid>`: reuse it to retry the same write without doing it twice.
|
|
64
|
+
|
|
65
|
+
## Setup
|
|
66
|
+
|
|
67
|
+
`asecret add` installs the aSecret skill for supported agents. `asecret mcp` runs aSecret as a local MCP server over stdio (`claude mcp add asecret -- asecret mcp`), and `asecret-mcp` runs the same server. It has `list_secrets`, which gives names only, and the tools that ask your person: `request_save`, `request_setup`, `check_request`, `cancel_request` and `owner_setup_link`, plus `public_directory`, `request_use`, `request_order_status` and `website_form_link` on their own server. No tool returns a secret's value. `asecret mcp --print --host claude` prints a settings entry instead. `asecret instructions` prints a few lines your person can paste into any chat.
|
|
68
|
+
|
|
69
|
+
Run `asecret --help` for all commands and `asecret <command> --help` for each command's options. `--json` prints the API's representation. Set `ASECRET_TOKEN` to use an existing token, `ASECRET_CONFIG_DIR` to keep a separate agent on the same machine (the default is `~/.config/asecret`), or `ASECRET_API_URL` (or `--api`) to use another aSecret server, such as one you run yourself.
|
|
70
|
+
|
|
71
|
+
[Agent secrets protocol](https://github.com/asecret-org/protocol/blob/main/spec/0.2/agent-secrets.md) · [Changelog](CHANGELOG.md)
|
|
72
|
+
|
|
73
|
+
Part of [aGroup](https://agroup.sh), with [aMessage](https://amessage.sh), [aBeacon](https://abeacon.sh), [aFile](https://afile.sh) and [aSecret](https://asecret.sh). MIT License.
|
package/bin/asecret.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { main } from "../src/main.js";
|
|
3
|
+
|
|
4
|
+
// Piping into `head` closes the pipe early. That is not an error.
|
|
5
|
+
for (const stream of [process.stdout, process.stderr]) {
|
|
6
|
+
stream.on("error", (error) => {
|
|
7
|
+
if (/** @type {NodeJS.ErrnoException} */ (error).code === "EPIPE") process.exit(process.exitCode ?? 0);
|
|
8
|
+
throw error;
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
process.exitCode = await main(process.argv.slice(2));
|