@williamthorsen/toolbelt.secrets 0.3.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,6 +2,18 @@
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
+
5
17
  ## 0.3.0 โ€” 2026-09-15
6
18
 
7
19
  ### ๐ŸŽ‰ Features
package/README.md CHANGED
@@ -2,17 +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.3.0 (2026-09-15)
7
-
8
- ### ๐ŸŽ‰ Features
9
-
10
- - ๐Ÿšจ **Breaking:** Move createTempTree from toolbelt.filesystem to toolbelt.testing (#313)
11
-
12
- - Moves `CreateTempTreeOptions` and the `TempTree` handle to `@williamthorsen/toolbelt.testing/candidate` along with `createTempTree`.
13
-
14
- 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.
15
- <!-- /section:release-notes -->
5
+ <!-- section:release-notes --><!-- /section:release-notes -->
16
6
 
17
7
  ## Installation
18
8
 
@@ -24,9 +14,9 @@ Requires Node.js 24 or later, and macOS: The one backend is the macOS keychain,
24
14
 
25
15
  ## How a secret is stored
26
16
 
27
- 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.
28
18
 
29
- 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 encodes 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.
30
20
 
31
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.
32
22
 
@@ -34,7 +24,7 @@ An item created here is local to the Mac that created it. `security` offers no i
34
24
 
35
25
  ## CLI
36
26
 
37
- 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.
38
28
 
39
29
  ```sh
40
30
  pnpm add --global @williamthorsen/toolbelt.secrets # puts tb-secret on PATH
@@ -52,7 +42,7 @@ npx @williamthorsen/toolbelt.secrets get my-token # or run it without install
52
42
 
53
43
  | Option | Effect |
54
44
  | ----------------------- | ------------------------------------------------------- |
55
- | `-a, --account <name>` | Account holding the secret (default: the empty account) |
45
+ | `-a, --account <name>` | Account of the secret (default: the empty account) |
56
46
  | `-k, --keychain <path>` | Keychain to act on, rather than the default search list |
57
47
 
58
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.
@@ -117,11 +107,11 @@ store.findSecret({ account: 'me@example.com', service: 'atlassian-api-token' });
117
107
  // the token
118
108
  ```
119
109
 
120
- `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.
121
111
 
122
- `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.
123
113
 
124
- `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 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 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.
125
115
 
126
116
  ```ts
127
117
  const projectStore = createKeychainStore({ keychain: '/Users/me/Library/Keychains/project.keychain-db' });
@@ -137,7 +127,7 @@ A named keychain accepts a write like the default search list does. `SecretStore
137
127
  promptSecret(input: NodeJS.ReadableStream, output: NodeJS.WritableStream): Promise<string>;
138
128
  ```
139
129
 
140
- 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.
141
131
 
142
132
  ```ts
143
133
  import { promptSecret } from '@williamthorsen/toolbelt.secrets/candidate';
@@ -145,4 +135,4 @@ import { promptSecret } from '@williamthorsen/toolbelt.secrets/candidate';
145
135
  const secret = await promptSecret(process.stdin, process.stderr);
146
136
  ```
147
137
 
148
- 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
@@ -4,12 +4,12 @@
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 contain.
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,7 +1,7 @@
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
  */
@@ -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 encodes 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
  *
@@ -24,8 +24,8 @@ export declare function buildHasArgs(query: SecretQuery, keychain?: string): str
24
24
  * 128-byte buffer that `security` fills when `-w` has no value.
25
25
  *
26
26
  * The secret goes in as `-X <hex>`. Its alphabet is closed, so no secret can alter the line's structure, and
27
- * every byte sequence is representable, a line break included. The service, account, and keychain have no such
28
- * 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.
29
29
  *
30
30
  * @internal
31
31
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@williamthorsen/toolbelt.secrets",
3
- "version": "0.3.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.testing": "0.6.0"
51
+ "@williamthorsen/toolbelt.testing": "0.6.2"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=24.0.0"