@kaynooo/cli-dev 0.6.1 → 0.7.2

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.
Files changed (3) hide show
  1. package/README.md +3 -3
  2. package/dist/cli.js +1201 -912
  3. package/package.json +5 -5
package/README.md CHANGED
@@ -8,7 +8,7 @@ bun add -g @kaynooo/cli-dev
8
8
 
9
9
  | Command | What it does |
10
10
  | --- | --- |
11
- | `dev password [length] [format] [-b\|--bcrypt [password]]` | `length` random bytes (default 32) as `hex`, `base64` (default) or `base64url`, printed and copied with `wl-copy` when it exists; `--bcrypt` prints the hash of the password given, or of a generated one |
11
+ | `dev password [length] [format] [-b\|--bcrypt [password]] [--copy]` | `length` random bytes (default 32) as `hex`, `base64` (default) or `base64url`, printed, and copied with `wl-copy` under `--copy`; `--bcrypt` prints the hash of the password given, or of a generated one |
12
12
  | `dev jwt [token]` | header and payload of a JWT, `iat`, `nbf` and `exp` as local and UTC dates with how far from now; the signature is not verified |
13
13
  | `dev ts [value]` | epoch seconds or milliseconds (told apart by size), an ISO date or date-time, or a duration such as `90m` or `2h30m`, as local and UTC dates; no value is now, `-` reads stdin |
14
14
  | `dev uuid [-n <count>] [--v7]` | random UUIDs, version 4 or 7 |
@@ -24,9 +24,9 @@ Fish completes it through the bin itself: `dev __complete`, installed for every
24
24
 
25
25
  ## Passwords and bcrypt
26
26
 
27
- The password is read from `crypto.getRandomValues` and written as `openssl rand -hex|-base64` does, `base64url` being that base64 with `+/` swapped for `-_` and the padding dropped. With a clipboard tool (`wl-copy`) the password is copied and `copied to clipboard` is said on stderr; `--no-copy` leaves the clipboard alone.
27
+ The password is read from `crypto.getRandomValues` and written as `openssl rand -hex|-base64` does, `base64url` being that base64 with `+/` swapped for `-_` and the padding dropped. `--copy` also puts the password on the clipboard through `wl-copy` (or xclip, xsel, pbcopy) and says `copied to clipboard` on stderr; without it the clipboard is left alone.
28
28
 
29
- `--bcrypt` hashes at cost 10. Bun writes bcrypt hashes with the `$2b$` prefix where `htpasswd -B` writes `$2y$`: the algorithm is identical, so `dev` rewrites the prefix to `$2y$`, the one Apache, nginx and traefik basic auth all accept (`$2b$` is accepted by fewer of them). With a generated password the hash prints on stdout, the password on stderr, and it is the password that is copied, as the password it replaces did.
29
+ `--bcrypt -` asks for the password masked on a terminal, or reads it from stdin, which keeps it out of the shell history. `--bcrypt` hashes at cost 10. Bun writes bcrypt hashes with the `$2b$` prefix where `htpasswd -B` writes `$2y$`: the algorithm is identical, so `dev` rewrites the prefix to `$2y$`, the one Apache, nginx and traefik basic auth all accept (`$2b$` is accepted by fewer of them). With a generated password the hash prints on stdout, the password on stderr, and it is the password that `--copy` copies, as the password it replaces did. bcrypt reads only the first 72 bytes of a password, so `--bcrypt` refuses a longer one rather than hash a prefix of it.
30
30
 
31
31
  ## Notes
32
32