decryption 0.0.0-stage → 0.5.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/README.md +348 -2
- package/commands/account.d.ts +4 -0
- package/commands/account.js +470 -0
- package/commands/cosmology.d.ts +4 -0
- package/commands/cosmology.js +97 -0
- package/commands/doctor.d.ts +3 -0
- package/commands/doctor.js +42 -0
- package/commands/encrypt.d.ts +12 -0
- package/commands/encrypt.js +251 -0
- package/commands/guard.d.ts +3 -0
- package/commands/guard.js +92 -0
- package/commands/keychain.d.ts +4 -0
- package/commands/keychain.js +92 -0
- package/commands/keys.d.ts +4 -0
- package/commands/keys.js +74 -0
- package/commands/passkey.d.ts +4 -0
- package/commands/passkey.js +135 -0
- package/commands/salt.d.ts +4 -0
- package/commands/salt.js +113 -0
- package/commands/secrets.d.ts +4 -0
- package/commands/secrets.js +214 -0
- package/commands/shamir.d.ts +4 -0
- package/commands/shamir.js +62 -0
- package/commands/vault.d.ts +7 -0
- package/commands/vault.js +382 -0
- package/commands/wallet.d.ts +5 -0
- package/commands/wallet.js +129 -0
- package/commands/workspace.d.ts +8 -0
- package/commands/workspace.js +289 -0
- package/commands.d.ts +8 -0
- package/commands.js +126 -0
- package/esm/commands/account.js +466 -0
- package/esm/commands/cosmology.js +93 -0
- package/esm/commands/doctor.js +38 -0
- package/esm/commands/encrypt.js +245 -0
- package/esm/commands/guard.js +88 -0
- package/esm/commands/keychain.js +88 -0
- package/esm/commands/keys.js +70 -0
- package/esm/commands/passkey.js +131 -0
- package/esm/commands/salt.js +109 -0
- package/esm/commands/secrets.js +210 -0
- package/esm/commands/shamir.js +58 -0
- package/esm/commands/vault.js +376 -0
- package/esm/commands/wallet.js +125 -0
- package/esm/commands/workspace.js +283 -0
- package/esm/commands.js +120 -0
- package/esm/index.js +50 -0
- package/esm/utils/bytes.js +286 -0
- package/esm/utils/dispatch.js +52 -0
- package/esm/utils/env.js +44 -0
- package/esm/utils/errors.js +44 -0
- package/esm/utils/header.js +14 -0
- package/esm/utils/io.js +49 -0
- package/esm/utils/passphrase.js +49 -0
- package/esm/utils/recipients.js +74 -0
- package/esm/utils/stash.js +61 -0
- package/esm/utils/temp.js +51 -0
- package/esm/utils/text.js +2 -0
- package/esm/workspace/bundle.js +239 -0
- package/esm/workspace/doctor.js +104 -0
- package/esm/workspace/git.js +72 -0
- package/esm/workspace/guard.js +111 -0
- package/esm/workspace/layout.js +106 -0
- package/esm/workspace/manifest.js +147 -0
- package/esm/workspace/recipients.js +37 -0
- package/esm/workspace/snippets.js +54 -0
- package/esm/workspace/state.js +46 -0
- package/esm/workspace/status.js +93 -0
- package/esm/workspace/tar.js +235 -0
- package/index.d.ts +12 -0
- package/index.js +67 -0
- package/package.json +53 -4
- package/utils/bytes.d.ts +86 -0
- package/utils/bytes.js +301 -0
- package/utils/dispatch.d.ts +24 -0
- package/utils/dispatch.js +58 -0
- package/utils/env.d.ts +26 -0
- package/utils/env.js +49 -0
- package/utils/errors.d.ts +25 -0
- package/utils/errors.js +50 -0
- package/utils/header.d.ts +4 -0
- package/utils/header.js +18 -0
- package/utils/io.d.ts +10 -0
- package/utils/io.js +57 -0
- package/utils/passphrase.d.ts +15 -0
- package/utils/passphrase.js +53 -0
- package/utils/recipients.d.ts +28 -0
- package/utils/recipients.js +80 -0
- package/utils/stash.d.ts +40 -0
- package/utils/stash.js +76 -0
- package/utils/temp.d.ts +10 -0
- package/utils/temp.js +59 -0
- package/utils/text.d.ts +2 -0
- package/utils/text.js +6 -0
- package/workspace/bundle.d.ts +50 -0
- package/workspace/bundle.js +248 -0
- package/workspace/doctor.d.ts +8 -0
- package/workspace/doctor.js +108 -0
- package/workspace/git.d.ts +21 -0
- package/workspace/git.js +83 -0
- package/workspace/guard.d.ts +23 -0
- package/workspace/guard.js +118 -0
- package/workspace/layout.d.ts +47 -0
- package/workspace/layout.js +113 -0
- package/workspace/manifest.d.ts +52 -0
- package/workspace/manifest.js +157 -0
- package/workspace/recipients.d.ts +16 -0
- package/workspace/recipients.js +45 -0
- package/workspace/snippets.d.ts +29 -0
- package/workspace/snippets.js +58 -0
- package/workspace/state.d.ts +13 -0
- package/workspace/state.js +52 -0
- package/workspace/status.d.ts +54 -0
- package/workspace/status.js +99 -0
- package/workspace/tar.d.ts +29 -0
- package/workspace/tar.js +240 -0
package/README.md
CHANGED
|
@@ -1,3 +1,349 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @decryption/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center" width="100%">
|
|
4
|
+
<img height="250" src="https://raw.githubusercontent.com/constructive-io/constructive/refs/heads/main/assets/outline-logo.svg" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center" width="100%">
|
|
8
|
+
<a href="https://github.com/constructive-io/decryption/actions/workflows/ci.yml">
|
|
9
|
+
<img height="20" src="https://github.com/constructive-io/decryption/actions/workflows/ci.yml/badge.svg" />
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://github.com/constructive-io/decryption/blob/main/LICENSE">
|
|
12
|
+
<img height="20" alt="MIT license" src="https://img.shields.io/badge/license-MIT-blue.svg" />
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://www.npmjs.com/package/@decryption/cli"><img height="20" src="https://img.shields.io/github/package-json/v/constructive-io/decryption?filename=packages%2Fcli%2Fpackage.json"/></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
`dcrypt` — a local-first command line for encryption, BIP39 wallets and team secrets. Only
|
|
19
|
+
`dcrypt account` makes a network request, and only to the endpoint you name.
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install -g @decryption/cli
|
|
25
|
+
dcrypt --help
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Commands
|
|
29
|
+
|
|
30
|
+
| Command | What it does |
|
|
31
|
+
|---------|--------------|
|
|
32
|
+
| `dcrypt encrypt` / `decrypt` | Encrypt with a passphrase or to X25519 recipients; files of any size with `--binary` |
|
|
33
|
+
| `dcrypt encrypt-section` / `decrypt-workspace` | Keep folders of a git repository encrypted: one bundle per folder, one passphrase prompt |
|
|
34
|
+
| `dcrypt status` / `doctor` | Where each section stands; whether this machine and workspace are set up safely |
|
|
35
|
+
| `dcrypt guard` | Keep plaintext out of git: a pre-commit check, its hook, and files to paste |
|
|
36
|
+
| `dcrypt wallet create\|address\|validate` | BIP39 mnemonics and offline address derivation |
|
|
37
|
+
| `dcrypt keys generate\|show\|verify` | Your X25519 identity, stored encrypted |
|
|
38
|
+
| `dcrypt secrets …` | Team secrets files, `.env` generation, recipient management |
|
|
39
|
+
| `dcrypt keychain set\|get\|del\|list` | Named local secrets, always encrypted |
|
|
40
|
+
| `dcrypt shamir split\|combine` | Authenticated Shamir shares |
|
|
41
|
+
| `dcrypt salt generate\|encrypt\|decrypt` | Two-layer encryption (data under a salt, salt under your passphrase) |
|
|
42
|
+
| `dcrypt cosmology decrypt\|encrypt\|upgrade` | Read, write and migrate data in the cosmology CLI format |
|
|
43
|
+
|
|
44
|
+
Every command supports `--help`.
|
|
45
|
+
|
|
46
|
+
## Examples
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# a wallet, encrypted at rest
|
|
50
|
+
dcrypt wallet create --words 24 --network osmosis --encrypt --out wallet.dcrypt
|
|
51
|
+
|
|
52
|
+
# a large file, to yourself and a teammate — no shared passphrase
|
|
53
|
+
dcrypt keys show # prints your dcrypt1… recipient
|
|
54
|
+
dcrypt encrypt --binary --recipient dcrypt1… --recipient dcrypt1… \
|
|
55
|
+
--in backup.tar --out backup.tar.dcrypt
|
|
56
|
+
dcrypt decrypt --in backup.tar.dcrypt --out backup.tar
|
|
57
|
+
|
|
58
|
+
# a private folder in a git repository, encrypted to everyone in recipients.txt
|
|
59
|
+
dcrypt encrypt-section finance # finance/ → finance.tar.dcrypt
|
|
60
|
+
dcrypt decrypt-workspace # every bundle → its folder, one passphrase prompt
|
|
61
|
+
|
|
62
|
+
# team secrets
|
|
63
|
+
dcrypt keys generate
|
|
64
|
+
dcrypt secrets init --vault production
|
|
65
|
+
dcrypt secrets set DATABASE_URL --in url.txt --vault production
|
|
66
|
+
dcrypt secrets add-recipient --label ada --recipient dcrypt1…
|
|
67
|
+
dcrypt secrets export --vault production --format dotenv --out .env
|
|
68
|
+
dcrypt secrets run --vault production -- npm start
|
|
69
|
+
|
|
70
|
+
# break-glass shares of a mnemonic
|
|
71
|
+
dcrypt shamir split --in mnemonic.txt --shares 5 --threshold 3
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Encrypting files
|
|
75
|
+
|
|
76
|
+
`dcrypt encrypt` writes one of two formats, and `dcrypt decrypt` detects which it was given:
|
|
77
|
+
|
|
78
|
+
| Flags | Output | Use for |
|
|
79
|
+
|-------|--------|---------|
|
|
80
|
+
| *(none)* | `dcrypt.v1.…` text, passphrase | short secrets you paste around; held in memory |
|
|
81
|
+
| `--binary` | binary file, passphrase | files of any size |
|
|
82
|
+
| `--binary --recipient <key>` | binary file, X25519 recipients | files several people or machines must open |
|
|
83
|
+
| `--recipient <key>` | `dcrypt.v2.…` text, X25519 recipients | small values for recipients; held in memory |
|
|
84
|
+
|
|
85
|
+
- `--recipient` takes a `dcrypt1…` public key and can be repeated. `--recipients-file <path>` reads one
|
|
86
|
+
key per line; anything after the key is a label, and `#` starts a comment. Encrypting to recipients
|
|
87
|
+
asks for no passphrase. Decrypting uses your stored identity (`dcrypt keys generate`) and asks for
|
|
88
|
+
the passphrase that protects it.
|
|
89
|
+
- **Large files are streamed.** The binary format is encrypted in 64 KiB chunks
|
|
90
|
+
([how](../core#file-format-version-2)), from a file or a pipe to a file or a pipe, holding one chunk
|
|
91
|
+
at a time. Resident memory still shows garbage the Node.js collector has not reclaimed yet: in our
|
|
92
|
+
runs it levelled off between roughly 0.3 and 1 GB for inputs from 300 MB to 4 GiB instead of growing
|
|
93
|
+
with the input, and a 1.2 GB decrypt completed at 336 MB under `--max-old-space-size=64`.
|
|
94
|
+
- **`--out` is written atomically.** Output goes to an owner-only temporary file next to the
|
|
95
|
+
destination and is renamed into place only after every byte has been written and, when decrypting,
|
|
96
|
+
authenticated. A wrong passphrase, a truncated or modified file, a full disk or Ctrl-C leaves the
|
|
97
|
+
destination exactly as it was.
|
|
98
|
+
- **On stdout there is nothing to rename.** Decrypted chunks are written as they authenticate, so a
|
|
99
|
+
file that turns out to be truncated has already produced output: check the exit code before using it.
|
|
100
|
+
- **Decrypting gives back the bytes that were encrypted**, in every format: nothing is decoded,
|
|
101
|
+
replaced or added on the way to a file or a pipe. Only on a terminal is a `dcrypt.v1` value that
|
|
102
|
+
does not end its last line followed by a newline.
|
|
103
|
+
- Binary data is never written to a terminal: not ciphertext, and not decrypted output that holds a
|
|
104
|
+
NUL byte or is not UTF-8. No such byte is written and the command fails, though text that came
|
|
105
|
+
before it may already have been shown. Use `--out` or redirect.
|
|
106
|
+
- `--aad` belongs to the `dcrypt.v1` envelope only.
|
|
107
|
+
|
|
108
|
+
What "audited" does and does not cover for these formats is spelled out in the
|
|
109
|
+
[repository README](../../README.md#audit-status): the `@noble` / `@scure` primitives are, the
|
|
110
|
+
envelope is not.
|
|
111
|
+
|
|
112
|
+
## Encrypted workspaces
|
|
113
|
+
|
|
114
|
+
A workspace is a folder, usually a git repository, in which some folders are private. Each private
|
|
115
|
+
folder is a **section**: it is committed as one encrypted bundle, and its plaintext stays on your
|
|
116
|
+
machine.
|
|
117
|
+
|
|
118
|
+
```text
|
|
119
|
+
<workspace>/
|
|
120
|
+
recipients.txt who can decrypt: one dcrypt1… public key per line (committed)
|
|
121
|
+
finance.tar.dcrypt a section, encrypted (committed, ideally with Git LFS)
|
|
122
|
+
finance/ the same section, decrypted (never committed)
|
|
123
|
+
clients/
|
|
124
|
+
northwind.tar.dcrypt
|
|
125
|
+
northwind/
|
|
126
|
+
.dcrypt/state.json what this machine last encrypted or decrypted (never committed)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Setting one up
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
dcrypt keys generate # once per machine
|
|
133
|
+
dcrypt guard snippet recipients > recipients.txt # then add each machine's "dcrypt keys show" line
|
|
134
|
+
dcrypt guard snippet gitignore > .gitignore # allow-list: everything is private unless named
|
|
135
|
+
dcrypt guard snippet gitattributes > .gitattributes # bundles go to Git LFS ("git lfs install")
|
|
136
|
+
dcrypt guard install # pre-commit hook
|
|
137
|
+
dcrypt doctor # checks all of the above
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Give every machine its own key, and add one **recovery** key that lives on no working machine, with
|
|
141
|
+
the word "recovery" in its label. `dcrypt doctor` and `dcrypt encrypt-section` warn until there is
|
|
142
|
+
one: without it, losing every machine key loses every section.
|
|
143
|
+
|
|
144
|
+
### Day to day
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
git pull
|
|
148
|
+
dcrypt decrypt-workspace # one passphrase prompt; none when nothing changed
|
|
149
|
+
# … edit files under finance/ …
|
|
150
|
+
dcrypt status # finance plaintext changed — run `dcrypt encrypt-section` …
|
|
151
|
+
dcrypt encrypt-section finance # no passphrase: encrypting uses public keys only
|
|
152
|
+
git add finance.tar.dcrypt && git commit
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
- **Encrypting is opt-in, one section at a time.** Nothing is encrypted, and no bundle is rewritten,
|
|
156
|
+
unless you name the section.
|
|
157
|
+
- **Nothing changes when nothing changed.** A section whose files are the same as its bundle is not
|
|
158
|
+
re-encrypted, so git sees no difference. Running it again after `recipients.txt` changed does
|
|
159
|
+
re-encrypt, to the new set of recipients.
|
|
160
|
+
- **One passphrase prompt.** `decrypt-workspace` unlocks your identity once and uses it for every
|
|
161
|
+
section, and does not ask at all when every section is in sync. The passphrase comes from the
|
|
162
|
+
prompt, `--passphrase-file`, `--passphrase-stdin` or `DCRYPT_PASSPHRASE`, never from argv.
|
|
163
|
+
- **A wrong passphrase never touches plaintext.** Each bundle is decrypted into a new folder beside
|
|
164
|
+
the section and checked, file by file, against the manifest inside it. Only when all of it is
|
|
165
|
+
there and correct does it replace the old folder. A wrong passphrase, a damaged or truncated
|
|
166
|
+
bundle, a full disk or Ctrl-C leaves the section exactly as it was; the other sections are still
|
|
167
|
+
decrypted, and the exit code says something failed.
|
|
168
|
+
- **Edits are not overwritten.** Plaintext with changes that are not encrypted yet is kept, and a
|
|
169
|
+
bundle that is newer than your plaintext is not replaced, unless you pass `--force`. When both
|
|
170
|
+
sides changed, both commands stop and say so.
|
|
171
|
+
- **Interrupt-safe.** Bundles and folders are written under a temporary name and renamed into
|
|
172
|
+
place. A run that was killed is tidied up by the next one, which puts back a folder that was
|
|
173
|
+
mid-swap.
|
|
174
|
+
- **File names are hidden.** A bundle is one encrypted file. The names, sizes and number of the
|
|
175
|
+
files inside are not visible; the bundle's total size, and the fingerprints of its recipients,
|
|
176
|
+
are.
|
|
177
|
+
- Decrypted files are created owner-only (`0600`, folders `0700`); the executable bit is kept.
|
|
178
|
+
|
|
179
|
+
`dcrypt status` shows one of these for each section:
|
|
180
|
+
|
|
181
|
+
| State | Meaning |
|
|
182
|
+
|-------|---------|
|
|
183
|
+
| `in sync` | the plaintext is what the bundle holds |
|
|
184
|
+
| `plaintext changed` | you edited files; `encrypt-section` when ready |
|
|
185
|
+
| `bundle changed` | the bundle is newer (a pull); `decrypt-workspace` updates the plaintext |
|
|
186
|
+
| `conflict` | both changed since they last agreed |
|
|
187
|
+
| `not decrypted` / `not encrypted` | only the bundle, or only the folder, exists |
|
|
188
|
+
| `unknown` | this machine has no record of the section; `decrypt-workspace` compares, and never overwrites a folder that differs |
|
|
189
|
+
| `not downloaded` | the bundle is still a Git LFS pointer; `git lfs pull` |
|
|
190
|
+
| `bundle unreadable` | the bundle is not a file `dcrypt` can read; restore it from git, or `encrypt-section --force` to make it again from the plaintext |
|
|
191
|
+
| `plaintext unreadable` | the folder holds a link, or a name a bundle cannot store |
|
|
192
|
+
|
|
193
|
+
A section that cannot be read is reported as such, and never stops the others from being reported or
|
|
194
|
+
decrypted.
|
|
195
|
+
|
|
196
|
+
### Keeping plaintext out of git
|
|
197
|
+
|
|
198
|
+
`dcrypt guard` reads what a commit would record and refuses three things: a file inside a section's
|
|
199
|
+
plaintext folder, a `*.dcrypt` file whose content is not encrypted, and a file `.gitignore` covers
|
|
200
|
+
that was added by force.
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
dcrypt guard # what is staged; this is what the pre-commit hook runs
|
|
204
|
+
dcrypt guard --all # everything tracked; for CI
|
|
205
|
+
dcrypt guard install # write the hook (leaves a hook it did not write alone without --force)
|
|
206
|
+
dcrypt guard snippet # gitignore, gitattributes, hook, ci, recipients
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
The `.gitignore` snippet is an allow-list: it ignores everything and then names what may be
|
|
210
|
+
committed, so a new file is private until a line says otherwise. The hook fails closed: if `dcrypt`
|
|
211
|
+
is not on the `PATH`, the commit is refused, not waved through.
|
|
212
|
+
|
|
213
|
+
`dcrypt doctor` checks Node.js, your identity, `recipients.txt` (including the recovery recipient),
|
|
214
|
+
every section, the hook, the ignore rules, Git LFS and whether anything tracked is plaintext. It
|
|
215
|
+
reads only, asks for no passphrase, and exits non-zero only when a check fails; warnings do not.
|
|
216
|
+
|
|
217
|
+
### What a bundle is, and is not
|
|
218
|
+
|
|
219
|
+
A bundle is a tar archive encrypted to the recipients in the [file format](#encrypting-files) above.
|
|
220
|
+
The archive is deterministic (sorted names, no owners, no timestamps), and its first entry is a
|
|
221
|
+
manifest listing every file's path, size and SHA-256. The manifest is what makes "unchanged" cheap
|
|
222
|
+
to establish and what an extraction is verified against.
|
|
223
|
+
|
|
224
|
+
- **It is an ordinary tar inside.** Without the workspace commands,
|
|
225
|
+
`dcrypt decrypt --in finance.tar.dcrypt --out finance.tar && tar -xf finance.tar` gets the files
|
|
226
|
+
back, along with the manifest as `.dcrypt-manifest.json`.
|
|
227
|
+
- **A bundle does not say who made it.** Recipient keys are public, so anyone who can write to the
|
|
228
|
+
repository can produce a bundle that decrypts. `decrypt-workspace` refuses a bundle that tries to
|
|
229
|
+
write outside its folder or whose content does not match its manifest, but it cannot tell you who
|
|
230
|
+
wrote that content. That comes from git: review, branch protection, signed commits.
|
|
231
|
+
- **Removing a recipient is not retroactive.** A key taken out of `recipients.txt` stops being used
|
|
232
|
+
the next time each section is encrypted (`status` shows which still need it). Bundles already in
|
|
233
|
+
git history stay readable with the old key, so rotate anything in them that matters.
|
|
234
|
+
- **Regular files only.** Links and special files are refused, empty folders are not kept,
|
|
235
|
+
`.DS_Store` is skipped, and ownership and timestamps are not recorded. A single file must be smaller
|
|
236
|
+
than 8 GiB. File names are stored NFC-normalized; a name containing a backslash is refused.
|
|
237
|
+
- None of this is audited: see [audit status](../../README.md#audit-status).
|
|
238
|
+
|
|
239
|
+
## Handling secrets
|
|
240
|
+
|
|
241
|
+
- **Passphrases are never read from argv.** `--passphrase` is rejected outright, because argv is
|
|
242
|
+
visible to every process on the machine. Use `--passphrase-file <path>`, `--passphrase-stdin`,
|
|
243
|
+
or the masked interactive prompt.
|
|
244
|
+
- Values can always be read with `--in <file>` or piped on stdin, and written with `--out <file>`
|
|
245
|
+
(created with mode `0600`) — so a secret never has to appear on your screen or in shell history.
|
|
246
|
+
- `dcrypt secrets run -- <cmd>` injects secrets into a child process's environment without ever
|
|
247
|
+
writing a plaintext `.env` to disk.
|
|
248
|
+
- `dcrypt keychain` has no plaintext mode. The old cosmology CLI stored the *plaintext* when you
|
|
249
|
+
passed `--encrypted`; that bug is not reproduced here.
|
|
250
|
+
|
|
251
|
+
## Non-interactive use
|
|
252
|
+
|
|
253
|
+
Every prompt has a flag, so the CLI works in CI. `dcrypt` only prompts on a terminal: when stdin is a
|
|
254
|
+
pipe or a file it is treated as data, never as answers, and a missing passphrase is an error instead
|
|
255
|
+
of a prompt.
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
dcrypt decrypt --in secret.dcrypt --passphrase-file /run/secrets/passphrase --out plain.txt
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Environment variables
|
|
262
|
+
|
|
263
|
+
Every variable the cosmology CLI read still works, plus `DCRYPT_`-prefixed aliases
|
|
264
|
+
(`DCRYPT_MNEMONIC`, `DCRYPT_SALT`, ...) for environments where the bare names would collide:
|
|
265
|
+
|
|
266
|
+
| Variable | Used by |
|
|
267
|
+
|----------|---------|
|
|
268
|
+
| `MNEMONIC` | `wallet address` / `wallet validate` |
|
|
269
|
+
| `SALT` | `cosmology decrypt` / `cosmology upgrade` |
|
|
270
|
+
| `ENCRYPTED_SALT` | the two-layer cosmology scheme |
|
|
271
|
+
| `KEYCHAIN_ACCOUNT` | keychain namespace (default `dcrypt`) |
|
|
272
|
+
| `DCRYPT_PASSPHRASE` | any command that asks for a passphrase |
|
|
273
|
+
|
|
274
|
+
Resolution order everywhere: explicit flag, then environment, then stdin, then the
|
|
275
|
+
interactive prompt.
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
SALT=my-salt dcrypt cosmology decrypt --in old.txt
|
|
279
|
+
MNEMONIC="..." dcrypt wallet address --network ethereum
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Add `--json` for machine-readable output, and check exit codes:
|
|
283
|
+
|
|
284
|
+
| Code | Meaning |
|
|
285
|
+
|------|---------|
|
|
286
|
+
| 1 | Usage error |
|
|
287
|
+
| 2 | Wrong passphrase, or the ciphertext was tampered with |
|
|
288
|
+
| 3 | Corrupt or unsupported input, including a bundle that does not match its manifest |
|
|
289
|
+
| 4 | Not found — including no identity on this machine, and a bundle that is still a Git LFS pointer |
|
|
290
|
+
| 5 | Your identity is not a recipient of this file |
|
|
291
|
+
|
|
292
|
+
## Storage layout
|
|
293
|
+
|
|
294
|
+
```text
|
|
295
|
+
~/.dcrypt/
|
|
296
|
+
config/identity.json X25519 identity, encrypted under your passphrase
|
|
297
|
+
data/keychain.json named secrets, each encrypted
|
|
298
|
+
data/vaults/<name>.json team secrets files
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
Managed with [appstash](https://www.npmjs.com/package/appstash), and shared byte-for-byte with the
|
|
302
|
+
desktop app, so both tools see the same vaults.
|
|
303
|
+
|
|
304
|
+
## Credits
|
|
305
|
+
|
|
306
|
+
**🛠 Built by the [Constructive](https://constructive.io) team — creators of modular Postgres tooling for secure, composable backends. If you like our work, contribute on [GitHub](https://github.com/constructive-io).**
|
|
307
|
+
|
|
308
|
+
## Disclaimer
|
|
309
|
+
|
|
310
|
+
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
|
|
311
|
+
|
|
312
|
+
No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Development
|
|
317
|
+
|
|
318
|
+
### Setup
|
|
319
|
+
|
|
320
|
+
1. Clone the repository:
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
git clone https://github.com/constructive-io/decryption.git
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
2. Install dependencies:
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
cd decryption
|
|
330
|
+
pnpm install
|
|
331
|
+
pnpm build
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
3. Test the package of interest:
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
cd packages/<packagename>
|
|
338
|
+
pnpm test:watch
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## Credits
|
|
342
|
+
|
|
343
|
+
**🛠 Built by the [Constructive](https://constructive.io) team — creators of modular Postgres tooling for secure, composable backends. If you like our work, contribute on [GitHub](https://github.com/constructive-io).**
|
|
344
|
+
|
|
345
|
+
## Disclaimer
|
|
346
|
+
|
|
347
|
+
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
|
|
348
|
+
|
|
349
|
+
No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Inquirerer } from 'inquirerer';
|
|
2
|
+
import { ParsedArgs } from 'minimist';
|
|
3
|
+
export declare const accountUsage = "\nAccount Command:\n\n dcrypt account <subcommand> [OPTIONS]\n\n Constructive accounts and their API keys, held in the local vault. This is the\n one part of dcrypt that talks to a server: the endpoint you name, nothing else.\n\nSubcommands:\n list List the accounts in the vault\n signup <email> Create an account on --endpoint, then store the session\n signin <email> Sign in and store the session\n signout <email> Sign out and drop the stored token\n forget <email> Remove the account and its keys from the vault\n link-code <email> <code> Answer this account's MFA step-ups with a vault code\n unlink-code <email> Stop answering its step-ups from the vault\n key list [email] List stored API keys\n key create <name> Mint an API key for --account\n key reveal <name> Print an API key secret\n key revoke <name> Revoke server-side, then delete the local copy\n key assign <name> <db> Serve this key as that database's data-plane token\n token [email] Print the bearer a harness would be given\n principal list [email] Scoped sub-identities, with their scopes and masks\n principal create <name> Create one \u2014 personal, or scoped to --org\n principal delete <id> Remove one server-side\n\nOptions:\n --endpoint <url> Auth endpoint (or DCRYPT_AUTH_ENDPOINT)\n --account <email> Which account a key command applies to\n --expires-days <n> Lifetime for a new key (default: no expiry)\n --access-level <level> Access level for a new key\n --database <id> Tag a new key as that database's data-plane token\n --principal <id> Mint the key as this principal, not as you\n --org <id> Scope a principal to this org; omit for a personal one\n --read-only The principal may only read\n --bypass-step-up The principal may skip MFA step-up (for CI)\n --password-file <path> Read the account password from a file\n --password-stdin Read the account password from stdin\n --json Machine-readable output\n --passphrase-file <p> Read the master password from a file\n --help, -h Show this help message\n\nExamples:\n dcrypt account signin dev@example.com --endpoint http://auth.localhost:3000/graphql\n dcrypt account key create ci --account dev@example.com --expires-days 30\n dcrypt account link-code dev@example.com \"Constructive dev\"\n dcrypt account key reveal ci\n dcrypt account token dev@example.com\n dcrypt account principal create ci-deploy --org <org-id> --read-only\n dcrypt account key create ci --principal <principal-id> --org <org-id>\n";
|
|
4
|
+
export declare const accountCommand: (argv: ParsedArgs, prompter: Inquirerer) => Promise<void>;
|