keypin 0.7.0 → 0.9.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/README.md CHANGED
@@ -20,14 +20,14 @@
20
20
  </p>
21
21
 
22
22
  Each project lists its keys in a `keypin.toml`: names, vault items and destinations, never values. keypin runs your
23
- commands with dev keys, publishes keys to GitHub Actions and Cloudflare Workers, and rotates Cloudflare API tokens.
24
- It reads values from 1Password only while a command runs, and never writes them to disk.
23
+ commands with dev keys, publishes keys to GitHub Actions and Cloudflare Workers, and reminds you when a key is due
24
+ for rotation. It reads values from 1Password only while a command runs, and never writes them to disk.
25
25
 
26
26
  ## Install
27
27
 
28
28
  You need [Bun](https://bun.sh) 1.4.4 or newer and the [1Password](https://1password.com/downloads) desktop app.
29
29
  To publish, you also need a [`gh`](https://cli.github.com) login for GitHub, or a
30
- [`wrangler`](https://developers.cloudflare.com/workers/wrangler/) login for Cloudflare (macOS only for now).
30
+ [`wrangler`](https://developers.cloudflare.com/workers/wrangler/) login for Cloudflare (macOS or Linux).
31
31
 
32
32
  ```sh
33
33
  bun add -g keypin
@@ -84,15 +84,16 @@ keypin publish API_TOKEN # write the prod value to the GitHub secret
84
84
 
85
85
  ### Coming from a .env
86
86
 
87
- `keypin import` moves a `.env` file's values into new 1Password items and maps them:
87
+ `keypin import` moves a `.env` file's keys into new 1Password items and maps them. Name the keys, and plain
88
+ settings such as `PORT` stay in the file:
88
89
 
89
90
  ```sh
90
- keypin import .env --vault Private --account my.1password.com
91
+ keypin import .env STRIPE_KEY DATABASE_URL --vault Private --account my.1password.com
91
92
  ```
92
93
 
93
- It shows each item it will create and waits for you to type `yes`. It never overwrites an item, and it never changes
94
- the `.env` file. It names any variable it left only in the file; move those, then delete the file yourself, and
95
- `keypin run -- <command>` provides the values.
94
+ Without names, it imports every variable. It shows each item it will create and waits for you to type `yes`. It
95
+ never overwrites an item, and it never changes the `.env` file: it tells you which lines to remove from it, and
96
+ `keypin run -- <command>` provides those values.
96
97
  See [Import](https://github.com/caiopizzol/keypin/blob/main/docs/import.md).
97
98
 
98
99
  ## Commands
@@ -101,23 +102,43 @@ See [Import](https://github.com/caiopizzol/keypin/blob/main/docs/import.md).
101
102
  keypin init [folder] # register a project and write a keypin.toml
102
103
  keypin unregister [folder] # stop listing a project (its keypin.toml stays)
103
104
  keypin status [--json] # every key, when it's due, and any problem
105
+ keypin check [folder] # check the map, vault items and logins, and write nothing
104
106
  keypin discover [folder] # every key name a project uses, where it's set, and a draft map
105
107
  # (--write saves the draft as keypin.toml and registers the project)
106
- keypin import <env-file> --vault <vault>
108
+ keypin import <env-file> [NAME...] --vault <vault>
107
109
  # move an env file's values into 1Password and map them
108
110
  keypin run -- <command> # run a command with the project's dev keys (--env for another)
109
111
  keypin publish <VARIABLE> # check each destination's account, then write the key
110
112
  keypin publish --all # publish every key, with one plan and one approval
111
113
  keypin publish --all --plan # show that plan without a terminal, and write nothing
112
- keypin rotate <VARIABLE> # replace a Cloudflare API token, then revoke the old one
113
114
  ```
114
115
 
115
- Add `--plan` to `publish` or `rotate` to see the plan without a terminal. It changes nothing, and prints the
116
- command that does.
116
+ ### Check a setup
117
117
 
118
- `import`, `publish` and `rotate` show a plan and wait for you to type `yes`. `--yes` approves `import`, which only
119
- creates new items. For `publish` and `rotate`, it skips that only for routine updates: it never approves a first
120
- write, a changed account or vault item, or a revoke. `keypin --help` lists the exit codes.
118
+ `keypin check` checks a project before you publish, and changes nothing:
119
+
120
+ - the map parses;
121
+ - each `op://` reference's item and field exist;
122
+ - for each destination, the login keypin would use, who it acts as, the account it reaches, and how to fix a
123
+ mismatch.
124
+
125
+ It reads each value to check its field, so 1Password asks you to approve it, and it never prints a value. It
126
+ also notes a login stored in plain text, such as wrangler's. It exits 0 when everything checks out, and 1 with
127
+ one line per problem. `--json` prints the same as JSON.
128
+
129
+ Add `--plan` to `publish` to see the plan without a terminal. It changes nothing, and prints the command that
130
+ does.
131
+
132
+ `import` and `publish` show a plan and wait for you to type `yes`. `--yes` approves `import`, which only creates
133
+ new items. For `publish`, it skips that only for routine updates: it never approves a first write, or a changed
134
+ account or vault item. `keypin --help` lists the exit codes.
135
+
136
+ ### Rotate a key
137
+
138
+ `keypin status` shows when each key is due, from its `rotate_every` and its item's `rotated` date. To rotate one,
139
+ make a new value where the key comes from (the provider's dashboard, for example), paste it into the 1Password
140
+ field, set `rotated` to today, then run `keypin publish <VARIABLE>`. Revoke the old value once everything uses the
141
+ new one.
121
142
 
122
143
  ## Docs
123
144
 
@@ -129,8 +150,6 @@ write, a changed account or vault item, or a revoke. `keypin --help` lists the e
129
150
  1Password.
130
151
  - [Publishing](https://github.com/caiopizzol/keypin/blob/main/docs/publishing.md): destinations, account checks and
131
152
  approvals.
132
- - [Rotation](https://github.com/caiopizzol/keypin/blob/main/docs/rotation.md): how `rotate` works, and the admin
133
- token it needs.
134
153
  - [Notes](https://github.com/caiopizzol/keypin/blob/main/docs/notes.md): `wrangler dev`, and the files keypin keeps.
135
154
  - [Development](https://github.com/caiopizzol/keypin/blob/main/docs/development.md): install from source, checks and
136
155
  releases.