@williamthorsen/toolbelt.secrets 0.2.0 โ†’ 0.3.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/CHANGELOG.md CHANGED
@@ -2,9 +2,47 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## 0.3.1 โ€” 2026-10-02
6
+
7
+ ### ๐Ÿงช Tests
8
+
9
+ - Corrects test titles and one test input that misstated what their tests check, among them an `asNonEmptyArray` title that called a mutable array immutable and a `setDifference` test named for arrays that passed `Set` instances. (#353)
10
+
11
+ ### ๐Ÿ“š Documentation
12
+
13
+ - Audits the comments in every authored TypeScript, JavaScript, shell, and YAML source and every `tsconfig*.json` against the comment discipline, cutting comments that paraphrase the code or narrate history, rewriting doc descriptions in the third-person indicative, and adding descriptions to the functions, methods, and classes that had none. (#353)
14
+ - Revises READMEs, doc comments, and test names across the repository to follow the current `plain-speech` and writing-preference rules. (#354)
15
+ - Rewords the help text and messages printed by `tb-jira`, `tb-node`, and `tb-secret`, and the advice and skip reasons reported by the adoption kits, to follow the same writing conventions. (#354)
16
+
17
+ ## 0.3.0 โ€” 2026-09-15
18
+
19
+ ### ๐ŸŽ‰ Features
20
+
21
+ - ๐Ÿšจ **Breaking:** Move createTempTree from toolbelt.filesystem to toolbelt.testing (#313)
22
+
23
+ - Moves `CreateTempTreeOptions` and the `TempTree` handle to `@williamthorsen/toolbelt.testing/candidate` along with `createTempTree`.
24
+
25
+ Migration: Import `createTempTree`, `CreateTempTreeOptions`, and `TempTree` from `@williamthorsen/toolbelt.testing/candidate`, and declare `@williamthorsen/toolbelt.testing` in the manifest that declared `@williamthorsen/toolbelt.filesystem` for them.
26
+
27
+ ### โš™๏ธ Tooling
28
+
29
+ - Remove the stale repo-local cliff.toml and normalize changelog titles (#327)
30
+
31
+ - Stops `release-kit prepare` from printing a "skipped due to grouping error(s)" warning for each releasable workspace by letting it resolve the git-cliff template bundled with release-kit, previously overridden by the root `cliff.toml`.
32
+ - Excludes commits without a ticket prefix from future changelog entries.
33
+ - Renames the section titles in every `packages/*/.meta/changelog.json`, except `Dependency updates`, to the headings of release-kit's work-type taxonomy, such as "๐ŸŽ‰ Features" and "๐Ÿ—๏ธ Internal features", and regenerates each `CHANGELOG.md` so that release-kit orders existing and new sections by the same rule.
34
+ - Causes the next `release-kit prepare` to plan patch releases of `dstructs`, `hof`, and `sets`, which had no other commits since their last release, because the changelog commit touches every workspace.
35
+
36
+ ### ๐Ÿ“š Documentation
37
+
38
+ - Align prose with plain-speech doctrine and writing conventions (#306)
39
+
40
+ - Copy-edits prose across the repo: comments, test names, package READMEs, and `AGENTS.md`.
41
+ - Rewrites a few user-facing strings as well, among them `configure-project`'s help text and the errors from `parseProjectSpec`, `securityCommands`, and `hashString`.
42
+
5
43
  ## 0.2.0 โ€” 2026-09-06
6
44
 
7
- ### Features
45
+ ### ๐ŸŽ‰ Features
8
46
 
9
47
  - Add createKeychainStore and tb-secret to toolbelt.secrets (#276)
10
48
 
@@ -19,7 +57,7 @@ All notable changes to this project will be documented in this file.
19
57
  - Adds `resolveJiraSite`, `findJiraTokenSource`, and `JiraTransportError` to `@williamthorsen/toolbelt.atlassian/candidate`, so library code can resolve the site, name which link of the token chain would answer without reading the token, and tell a request that Jira rejected from one that never reached Jira.
20
58
  - Adds `promptSecret` and `UnstorableSecretError` to `@williamthorsen/toolbelt.secrets/candidate`, so a caller outside that package can prompt for a secret without echoing it and can tell a token refused by the keychain from a keychain that could not be reached.
21
59
 
22
- ### Bug fixes
60
+ ### ๐Ÿ› Bug fixes
23
61
 
24
62
  - Stop truncating a secret longer than 128 characters (#278)
25
63
 
@@ -38,7 +76,13 @@ All notable changes to this project will be documented in this file.
38
76
  - Fixes an issue where `tb-secret set` and `tb-jira auth set` failed with `EAGAIN: resource temporarily unavailable` when the producer of a piped credential delayed its first byte, as `tb-secret get`, `op read`, and `gh auth token` all do.
39
77
  - Stops `tb-secret`, `tb-jira`, and `tb-git` from crashing with an unhandled `EPIPE` when the reader on their stdout or stderr exits first, so that `tb-secret get | head -1` ends quietly, as a program that ignores `SIGPIPE` does.
40
78
 
41
- ### Documentation
79
+ ### ๐Ÿ—๏ธ Internal features
80
+
81
+ - Scaffold toolbelt.secrets for credential storage (#275)
82
+
83
+ Scaffolds `packages/secrets`, an empty workspace for storing and retrieving secrets in the OS credential store, publishing to npm as `@williamthorsen/toolbelt.secrets`.
84
+
85
+ ### ๐Ÿ“š Documentation
42
86
 
43
87
  - Repair the repository's prose and record every rejection's ground (#290)
44
88
 
@@ -48,10 +92,4 @@ All notable changes to this project will be documented in this file.
48
92
 
49
93
  - Revises documentation and comments to align with plain-speech doctrine and writing conventions.
50
94
 
51
- ### Internal
52
-
53
- - Scaffold toolbelt.secrets for credential storage (#275)
54
-
55
- Scaffolds `packages/secrets`, an empty workspace for storing and retrieving secrets in the OS credential store, publishing to npm as `@williamthorsen/toolbelt.secrets`.
56
-
57
95
  <!-- Generated by release-kit. Do not edit this file. Use .meta/changelog-overrides.json to override entries. -->
package/README.md CHANGED
@@ -2,49 +2,7 @@
2
2
 
3
3
  Utilities for storing and retrieving secrets in the OS credential store.
4
4
 
5
- <!-- section:release-notes -->
6
- ## Release notes โ€” v0.2.0 (2026-09-06)
7
-
8
- ### Features
9
-
10
- - Add createKeychainStore and tb-secret to toolbelt.secrets (#276)
11
-
12
- Adds the first exports to `@williamthorsen/toolbelt.secrets`: `createKeychainStore`, which stores and reads secrets in the macOS keychain with no external dependency. Also adds `tb-secret`, a command that exposes the same store to a shell caller.
13
-
14
- Supports macOS only.
15
-
16
- - Ship the tb-jira CLI and document toolbelt.atlassian (#295)
17
-
18
- - Adds the `tb-jira` binary to `@williamthorsen/toolbelt.atlassian`: Its `configure-project` subcommand reconciles a Jira project's statuses, workflow transitions, and board features against a spec file owned by the consuming repo, and `--dry-run` prints the plan and writes nothing.
19
- - Adds a `tb-jira auth` subcommand, which stores, replaces, and removes the Jira API token in the keychain and reports which source would supply it without printing the token.
20
- - Adds `resolveJiraSite`, `findJiraTokenSource`, and `JiraTransportError` to `@williamthorsen/toolbelt.atlassian/candidate`, so library code can resolve the site, name which link of the token chain would answer without reading the token, and tell a request that Jira rejected from one that never reached Jira.
21
- - Adds `promptSecret` and `UnstorableSecretError` to `@williamthorsen/toolbelt.secrets/candidate`, so a caller outside that package can prompt for a secret without echoing it and can tell a token refused by the keychain from a keychain that could not be reached.
22
-
23
- ### Bug fixes
24
-
25
- - Stop truncating a secret longer than 128 characters (#278)
26
-
27
- Fixes an issue where `tb-secret set` and `setSecret` stored the first 128 bytes of a longer secret and reported success, so an API token of ordinary length was silently corrupted. Secrets of up to ~2,000 bytes can now be stored; an empty secret or a secret that exceeds the limit is refused.
28
-
29
- At a terminal, `tb-secret set` now prompts for the secret twice. An abandoned prompt reports that nothing was stored.
30
-
31
- Separately, a write can now target a named keychain: `createKeychainStore` returns a writable store for any keychain, and `tb-secret set` now has a `--keychain` option.
32
-
33
- - Point every package bin at a committed wrapper (#296)
34
-
35
- - Points the `tb-git`, `tb-jira`, and `tb-secret` commands at committed wrappers under each package's `bin/`, so the target exists when the package manager links the command rather than only after a build.
36
-
37
- - Fix piped-stdin reads and unhandled EPIPE in the CLIs (#301)
38
-
39
- - Fixes an issue where `tb-secret set` and `tb-jira auth set` failed with `EAGAIN: resource temporarily unavailable` when the producer of a piped credential delayed its first byte, as `tb-secret get`, `op read`, and `gh auth token` all do.
40
- - Stops `tb-secret`, `tb-jira`, and `tb-git` from crashing with an unhandled `EPIPE` when the reader on their stdout or stderr exits first, so that `tb-secret get | head -1` ends quietly, as a program that ignores `SIGPIPE` does.
41
-
42
- ### Internal
43
-
44
- - Scaffold toolbelt.secrets for credential storage (#275)
45
-
46
- Scaffolds `packages/secrets`, an empty workspace for storing and retrieving secrets in the OS credential store, publishing to npm as `@williamthorsen/toolbelt.secrets`.
47
- <!-- /section:release-notes -->
5
+ <!-- section:release-notes --><!-- /section:release-notes -->
48
6
 
49
7
  ## Installation
50
8
 
@@ -52,21 +10,21 @@ Utilities for storing and retrieving secrets in the OS credential store.
52
10
  pnpm add @williamthorsen/toolbelt.secrets
53
11
  ```
54
12
 
55
- Requires Node.js 24 or later, and macOS: the one backend is the macOS keychain, reached through `/usr/bin/security`. Constructing a store on another platform throws, naming the platform, rather than failing later at the first call.
13
+ Requires Node.js 24 or later, and macOS: The one backend is the macOS keychain, reached through `/usr/bin/security`. Constructing a store on another platform throws, naming the platform, rather than failing later at the first call.
56
14
 
57
15
  ## How a secret is stored
58
16
 
59
- An item is named by a **service** and an **account**. The service is the caller's own name for the secret, never derived from a host or a URL, so one item can serve every product that accepts the same token. The account is optional and defaults to the empty account, which is matched exactly: a lookup on a service holding several accounts returns the one that is asked for, rather than an arbitrary one.
17
+ An item is named by a **service** and an **account**. The service is the caller's own name for the secret, never derived from a host or a URL, so one item can serve every product that accepts the same token. The account is optional and defaults to the empty account, which is matched exactly: A lookup on a service with several accounts returns the one that is asked for, rather than an arbitrary one.
60
18
 
61
- A secret reaches `security` through its interactive mode, which takes a whole command on stdin, so the secret never sits in an argument vector that any local process could read. It travels as hexadecimal, which carries every byte, a line break included, and every write is read back and compared before it is reported as stored.
19
+ Because the store passes a secret to `security` through its interactive mode, which takes a whole command on stdin, the secret never appears in an argument vector that any local process could read. It is sent as hexadecimal, which encodes every byte, a line break included, and every write is read back and compared before it is reported as stored.
62
20
 
63
- One command line carries the secret together with the service, the account, and the keychain, and `security` reads at most 4,095 bytes of it. That leaves room for a secret of roughly 2,000 bytes, and the exact ceiling falls as the other three grow. A secret that would not fit is refused, naming the room left; none is ever stored in part.
21
+ One command line contains the secret together with the service, the account, and the keychain, and `security` reads at most 4,095 bytes of it. That leaves room for a secret of roughly 2,000 bytes, and the exact ceiling falls as the other three grow. A secret that would not fit is refused, naming the room left; none is ever stored in part.
64
22
 
65
23
  An item created here is local to the Mac that created it. `security` offers no iCloud Keychain synchronization, so a secret stored on one machine has to be stored again on the next.
66
24
 
67
25
  ## CLI
68
26
 
69
- The package ships a `tb-secret` command exposing the store to a shell caller.
27
+ The package includes a `tb-secret` command exposing the store to a shell caller.
70
28
 
71
29
  ```sh
72
30
  pnpm add --global @williamthorsen/toolbelt.secrets # puts tb-secret on PATH
@@ -84,7 +42,7 @@ npx @williamthorsen/toolbelt.secrets get my-token # or run it without install
84
42
 
85
43
  | Option | Effect |
86
44
  | ----------------------- | ------------------------------------------------------- |
87
- | `-a, --account <name>` | Account holding the secret (default: the empty account) |
45
+ | `-a, --account <name>` | Account of the secret (default: the empty account) |
88
46
  | `-k, --keychain <path>` | Keychain to act on, rather than the default search list |
89
47
 
90
48
  At a terminal, `set` prompts for the secret twice and echoes nothing; piped, it reads stdin and drops one trailing newline, since `echo` adds one. The secret passes through this process either way.
@@ -149,11 +107,11 @@ store.findSecret({ account: 'me@example.com', service: 'atlassian-api-token' });
149
107
  // the token
150
108
  ```
151
109
 
152
- `findSecret` returns `undefined` where no item is stored, and throws where the keychain could not be reached, so absence is never confused with a failure. `deleteSecret` reports whether an item was there to remove.
110
+ `findSecret` returns `undefined` when no item is stored, and throws when the keychain could not be reached, so absence is never confused with a failure. `deleteSecret` reports whether an item was there to remove.
153
111
 
154
- `hasSecret` reads the item's attributes rather than its data. That is the difference worth knowing: retrieving a secret can raise a keychain access prompt where the item was created by another program, and an attribute lookup cannot.
112
+ `hasSecret` reads the item's attributes rather than its data. That is the difference worth knowing: Retrieving a secret can raise a keychain access prompt when the item was created by another program, and an attribute lookup cannot.
155
113
 
156
- `setSecret` rejects an empty secret, which the keychain would hold as an item indistinguishable from a stray one, and one too long for the command line that carries it. Both are `UnstorableSecretError`, which is exported: nothing was attempted, so a caller can tell a value that the keychain cannot carry from a keychain that it could not reach. Every other secret is stored and returned byte for byte, whatever it holds. Each write is read back and compared, so a secret that did not survive the round trip fails at the write rather than at a later caller. That readback retrieves the secret, so replacing an item created by another program can raise the keychain access prompt described above, and a write whose readback is refused is reported as unverified rather than as stored.
114
+ `setSecret` rejects an empty secret, which the keychain would store as an item indistinguishable from a stray one, and one too long for the command line that contains it. Both are `UnstorableSecretError`, which is exported: Nothing was attempted, so a caller can tell a value that the keychain cannot store from a keychain that it could not reach. Every other secret is stored and returned byte for byte, whatever it contains. Each write is read back and compared: A secret that did not survive the round trip fails at the write rather than at a later caller. Because that readback retrieves the secret, replacing an item created by another program can raise the keychain access prompt described above, and a write whose readback is refused is reported as unverified rather than as stored.
157
115
 
158
116
  ```ts
159
117
  const projectStore = createKeychainStore({ keychain: '/Users/me/Library/Keychains/project.keychain-db' });
@@ -169,7 +127,7 @@ A named keychain accepts a write like the default search list does. `SecretStore
169
127
  promptSecret(input: NodeJS.ReadableStream, output: NodeJS.WritableStream): Promise<string>;
170
128
  ```
171
129
 
172
- Reads a secret from a terminal without echoing it, asking twice and comparing, since nothing on screen shows what was typed. It rejects where the two entries differ, and where the input ends before a secret is entered, which is the one event that `Ctrl-C`, `Ctrl-D`, and a closed stream all share.
130
+ Reads a secret from a terminal without echoing it, asking twice and comparing, since nothing on screen shows what was typed. It rejects when the two entries differ, and when the input ends before a secret is entered, which is the one event that `Ctrl-C`, `Ctrl-D`, and a closed stream all share.
173
131
 
174
132
  ```ts
175
133
  import { promptSecret } from '@williamthorsen/toolbelt.secrets/candidate';
@@ -177,4 +135,4 @@ import { promptSecret } from '@williamthorsen/toolbelt.secrets/candidate';
177
135
  const secret = await promptSecret(process.stdin, process.stderr);
178
136
  ```
179
137
 
180
- The prompts go to `output` and the line being edited does not, so a caller passing `process.stderr` leaves `stdout` free for the command's own result. `security` has a prompt of its own, but it fills a 128-byte buffer and hands back nothing to verify, which is why this reads the secret instead.
138
+ The prompts go to `output` and the line being edited does not, so a caller passing `process.stderr` leaves `stdout` free for the command's own result. `security` has a prompt of its own, but it fills a 128-byte buffer and returns nothing to verify, which is why this reads the secret instead.
package/bin/tb-secret.js CHANGED
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // Imports only node builtins: a top-level import resolves before the gate below runs, so an unresolvable
3
+ // Imports only node builtins: A top-level import resolves before the gate below runs, so an unresolvable
4
4
  // dependency would replace this file's build-first message with ERR_MODULE_NOT_FOUND.
5
5
  import { existsSync } from 'node:fs';
6
6
 
7
- // Thin wrapper so pnpm can link the bin at install time, before `dist/` exists. The real entry point loads
7
+ // Thin wrapper so that pnpm can link the bin at install time, before `dist/` exists. The real entry point loads
8
8
  // at runtime from the build output.
9
9
  const entryPoint = new URL('../dist/esm/bin/tb-secret.js', import.meta.url);
10
10
 
11
- // Gate on the entry file itself: Node raises ERR_MODULE_NOT_FOUND for any unresolved module in the graph,
12
- // so keying the build-first message off the error code would also fire when the build is present and one
11
+ // Gate on the entry file itself: Because Node raises ERR_MODULE_NOT_FOUND for any unresolved module in the
12
+ // graph, keying the build-first message off the error code would also fire when the build is present and one
13
13
  // of its imports is missing.
14
14
  if (!existsSync(entryPoint)) {
15
15
  process.stderr.write(
@@ -10,13 +10,13 @@ export interface SecretQuery {
10
10
  export interface SecretStore {
11
11
  /** Removes a secret, reporting whether one was there to remove. */
12
12
  deleteSecret(query: SecretQuery): boolean;
13
- /** Reads a secret, returning `undefined` where none is stored. */
13
+ /** Reads a secret, returning `undefined` when none is stored. */
14
14
  findSecret(query: SecretQuery): string | undefined;
15
15
  /** Reports whether a secret is stored, without reading it. */
16
16
  hasSecret(query: SecretQuery): boolean;
17
17
  }
18
18
  /** A secret store that also accepts a new secret. */
19
19
  export interface WritableSecretStore extends SecretStore {
20
- /** Stores a secret, replacing one already held under the same service and account. */
20
+ /** Stores a secret, replacing one already stored under the same service and account. */
21
21
  setSecret(query: SecretQuery, secret: string): void;
22
22
  }
@@ -1,6 +1,7 @@
1
1
  /**
2
- * Reports a value that cannot reach `security` intact. It is distinct from a failure to reach the keychain,
3
- * since nothing was attempted: the caller gave a secret, service, or account that no command line can carry.
2
+ * The error for a value that cannot be passed to `security` intact. It is distinct from a failure to reach the
3
+ * keychain, since nothing was attempted: The caller gave a secret, service, or account that the command line cannot
4
+ * contain.
4
5
  *
5
6
  * @category Secrets
6
7
  * @experimental
@@ -1,6 +1,6 @@
1
1
  import type { WritableSecretStore } from './SecretStore.js';
2
2
  /**
3
- * Opens a macOS keychain as a secret store, or the default search list where no keychain is named. Throws off
3
+ * Opens a macOS keychain as a secret store, or the default search list when no keychain is named. Throws off
4
4
  * macOS.
5
5
  *
6
6
  * @category Secrets
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Reads a secret from a terminal without echoing it, asking twice and comparing, since nothing on screen shows
3
- * what was typed. `security` has a prompt of its own, but it fills a 128-byte buffer and hands back nothing to
3
+ * what was typed. `security` has a prompt of its own, but it fills a 128-byte buffer and returns nothing to
4
4
  * verify, so the secret is read here instead.
5
5
  *
6
6
  * @category Secrets
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Finds the manifest of the package owning a directory, ascending to the first `package.json` declaring a
3
3
  * `name`. One declaring none is a marker manifest, such as the `{"type": "commonjs"}` file left in `dist/`
4
- * by a dual-format build, and the ascent passes over it, so the answer is the owning package rather than
5
- * the nearest manifest. Throws where no ancestor declares a name.
4
+ * by a dual-format build, and the ascent passes over it, so the function returns the owning package's
5
+ * manifest rather than the nearest one. Throws when no ancestor declares a name.
6
6
  *
7
7
  * @internal
8
8
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Reads the version declared by the package owning a directory, defaulting to this module's own, which is
3
3
  * this package whether it runs from source under the test runner or from the build output once installed.
4
- * Throws where the owning manifest declares no string version.
4
+ * Throws when the owning manifest declares no string version.
5
5
  *
6
6
  * @internal
7
7
  */
@@ -1,12 +1,12 @@
1
1
  import type { WritableSecretStore } from '../3-candidate/SecretStore.js';
2
2
  /**
3
- * Runs the `tb-secret` command line, returning what to write and exit with rather than doing either, so the
4
- * whole surface is exercisable without a process. Every failure is reported through the result: Nothing throws.
3
+ * Runs the `tb-secret` command line, returning what to write and exit with rather than doing either, so that
4
+ * the whole surface is exercisable without a process. Every failure is reported through the result: Nothing throws.
5
5
  *
6
6
  * @internal
7
7
  */
8
8
  export declare function runTbSecret(args: string[], effects: TbSecretEffects): Promise<TbSecretResult>;
9
- /** The effects deferred to the entry point, which is what keeps the runner free of I/O. */
9
+ /** The effects deferred to the entry point, which keeps the runner free of I/O. */
10
10
  export interface TbSecretEffects {
11
11
  readonly createStore: (keychain: string | undefined) => WritableSecretStore;
12
12
  readonly isStdinTty: () => boolean;
@@ -32,7 +32,7 @@ Exit codes:
32
32
  3 The keychain could not be reached`;
33
33
  const DELETE_HELP = `Usage: tb-secret delete <service> [options]
34
34
 
35
- Remove a secret, exiting 1 where none is stored.
35
+ Remove a secret, exiting 1 when none is stored.
36
36
 
37
37
  Options:
38
38
  -h, --help Print this help
@@ -40,7 +40,7 @@ Options:
40
40
  -k, --keychain <path> Keychain to act on, rather than the default search list`;
41
41
  const GET_HELP = `Usage: tb-secret get <service> [options]
42
42
 
43
- Print a secret, exiting 1 where none is stored.
43
+ Print a secret, exiting 1 when none is stored.
44
44
 
45
45
  Options:
46
46
  -h, --help Print this help
@@ -48,7 +48,7 @@ Options:
48
48
  -k, --keychain <path> Keychain to read, rather than the default search list`;
49
49
  const HAS_HELP = `Usage: tb-secret has <service> [options]
50
50
 
51
- Exit 0 where a secret is stored and 1 where none is, printing nothing either way. The secret itself is never
51
+ Exit 0 when a secret is stored and 1 when none is, printing nothing either way. The secret itself is never
52
52
  read, so this raises no keychain access prompt.
53
53
 
54
54
  Options:
@@ -57,11 +57,11 @@ Options:
57
57
  -k, --keychain <path> Keychain to read, rather than the default search list`;
58
58
  const SET_HELP = `Usage: tb-secret set <service> [options]
59
59
 
60
- Store a secret, replacing one already held under the same service and account.
60
+ Store a secret, replacing one already stored under the same service and account.
61
61
 
62
62
  At a terminal the secret is prompted for twice and echoed nowhere; piped, it is read from stdin and one
63
- trailing newline is dropped, since \`echo\` adds one. Either way it reaches \`security\` inside a command that
64
- travels on stdin, so it never enters an argument vector that any local process could read.
63
+ trailing newline is dropped, since \`echo\` adds one. Either way it is passed to \`security\` inside a command
64
+ sent on stdin, so it never enters an argument vector that any local process could read.
65
65
 
66
66
  The stored secret is read back and compared before this command reports success. Replacing an item that
67
67
  another program created can therefore raise a keychain access prompt, since verifying the write reads the
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Rejects a platform that ships no `security` command, at construction rather than at the first call, so a
3
- * caller learns where its keystore is missing rather than what failed to run.
2
+ * Rejects a platform that has no `security` command, at construction rather than at the first call, so
3
+ * that a caller learns where its keystore is missing rather than what failed to run.
4
4
  *
5
5
  * @internal
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Rejects an empty secret, which the keychain would hold as an item indistinguishable from a stray one. Every
3
- * other value is storable: The secret reaches `security` as hexadecimal, which carries any byte sequence.
2
+ * Rejects an empty secret, which the keychain would store as an item indistinguishable from a stray one. Every
3
+ * other value is storable: The secret is passed to `security` as hexadecimal, which encodes any byte sequence.
4
4
  *
5
5
  * @internal
6
6
  */
@@ -1,7 +1,7 @@
1
1
  import type { WritableSecretStore } from '../3-candidate/SecretStore.js';
2
2
  import type { SecurityRunner } from './runSecurity.js';
3
3
  /**
4
- * Builds a store over one keychain, or over the default search list where none is named.
4
+ * Builds a store over one keychain, or over the default search list when none is named.
5
5
  *
6
6
  * @internal
7
7
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Extracts the secret from what `security find-generic-password -g` writes to stderr. That command prints the
3
- * secret in whichever of two forms fits: raw between quotes where every byte is printable ASCII, and
3
+ * secret in whichever of two forms fits: raw between quotes when every byte is printable ASCII, and
4
4
  * `0x<hex> "<escaped>"` otherwise. Only the hex form is unambiguous, so the quoted form is read verbatim and
5
5
  * a value that fits neither throws, since a wrong secret is worse than a failure.
6
6
  *
@@ -6,8 +6,7 @@ import type { SecretQuery } from '../3-candidate/SecretStore.js';
6
6
  */
7
7
  export declare function buildDeleteArgs(query: SecretQuery, keychain?: string): string[];
8
8
  /**
9
- * Builds the arguments that read a secret. `-g` is what prints it, in the two forms that
10
- * `parseSecurityPassword` reads.
9
+ * Builds the arguments that read a secret. `-g` prints it, in the two forms that `parseSecurityPassword` reads.
11
10
  *
12
11
  * @internal
13
12
  */
@@ -22,11 +21,11 @@ export declare function buildHasArgs(query: SecretQuery, keychain?: string): str
22
21
  /**
23
22
  * Composes the one command line that `security -i` runs to store a secret. Interactive mode takes the whole
24
23
  * command on stdin, which keeps the secret off argv, where any local process could read it, and away from the
25
- * 128-byte buffer that `security` fills when `-w` carries no value.
24
+ * 128-byte buffer that `security` fills when `-w` has no value.
26
25
  *
27
26
  * The secret goes in as `-X <hex>`. Its alphabet is closed, so no secret can alter the line's structure, and
28
- * every byte sequence is representable, a line break included. The service, account, and keychain have no such
29
- * form, so they are quoted instead and a line break in one is refused.
27
+ * every byte sequence is representable, a line break included. Because the service, account, and keychain have
28
+ * no such form, they are quoted instead and a line break in one is refused.
30
29
  *
31
30
  * @internal
32
31
  */
@@ -34,7 +34,7 @@ function assertLineFits(line, fixedBytes) {
34
34
  function assertOneLine(value, field) {
35
35
  if (!LINE_BREAK_PATTERN.test(value))
36
36
  return;
37
- throw new UnstorableSecretError(`The ${field} carries a line break, which \`security\` reads as the end of a command.`);
37
+ throw new UnstorableSecretError(`The ${field} contains a line break, which \`security\` reads as the end of a command.`);
38
38
  }
39
39
  function encodeHex(secret) {
40
40
  return Buffer.from(secret, 'utf8').toString('hex');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@williamthorsen/toolbelt.secrets",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Utilities for storing and retrieving secrets in the OS credential store",
5
5
  "keywords": [
6
6
  "credentials",
@@ -48,7 +48,7 @@
48
48
  "dist/*"
49
49
  ],
50
50
  "devDependencies": {
51
- "@williamthorsen/toolbelt.filesystem": "0.8.3"
51
+ "@williamthorsen/toolbelt.testing": "0.6.2"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=24.0.0"