keypin 0.8.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
@@ -104,13 +105,12 @@ keypin status [--json] # every key, when it's due, and any problem
104
105
  keypin check [folder] # check the map, vault items and logins, and write nothing
105
106
  keypin discover [folder] # every key name a project uses, where it's set, and a draft map
106
107
  # (--write saves the draft as keypin.toml and registers the project)
107
- keypin import <env-file> --vault <vault>
108
+ keypin import <env-file> [NAME...] --vault <vault>
108
109
  # move an env file's values into 1Password and map them
109
110
  keypin run -- <command> # run a command with the project's dev keys (--env for another)
110
111
  keypin publish <VARIABLE> # check each destination's account, then write the key
111
112
  keypin publish --all # publish every key, with one plan and one approval
112
113
  keypin publish --all --plan # show that plan without a terminal, and write nothing
113
- keypin rotate <VARIABLE> # replace a Cloudflare API token, then revoke the old one
114
114
  ```
115
115
 
116
116
  ### Check a setup
@@ -118,7 +118,7 @@ keypin rotate <VARIABLE> # replace a Cloudflare API token, then revoke the o
118
118
  `keypin check` checks a project before you publish, and changes nothing:
119
119
 
120
120
  - the map parses;
121
- - each `op://` reference's item and field exist, including a `rotate` section's admin item;
121
+ - each `op://` reference's item and field exist;
122
122
  - for each destination, the login keypin would use, who it acts as, the account it reaches, and how to fix a
123
123
  mismatch.
124
124
 
@@ -126,12 +126,19 @@ It reads each value to check its field, so 1Password asks you to approve it, and
126
126
  also notes a login stored in plain text, such as wrangler's. It exits 0 when everything checks out, and 1 with
127
127
  one line per problem. `--json` prints the same as JSON.
128
128
 
129
- Add `--plan` to `publish` or `rotate` to see the plan without a terminal. It changes nothing, and prints the
130
- command that does.
129
+ Add `--plan` to `publish` to see the plan without a terminal. It changes nothing, and prints the command that
130
+ does.
131
131
 
132
- `import`, `publish` and `rotate` show a plan and wait for you to type `yes`. `--yes` approves `import`, which only
133
- creates new items. For `publish` and `rotate`, it skips that only for routine updates: it never approves a first
134
- write, a changed account or vault item, or a revoke. `keypin --help` lists the exit codes.
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.
135
142
 
136
143
  ## Docs
137
144
 
@@ -143,8 +150,6 @@ write, a changed account or vault item, or a revoke. `keypin --help` lists the e
143
150
  1Password.
144
151
  - [Publishing](https://github.com/caiopizzol/keypin/blob/main/docs/publishing.md): destinations, account checks and
145
152
  approvals.
146
- - [Rotation](https://github.com/caiopizzol/keypin/blob/main/docs/rotation.md): how `rotate` works, and the admin
147
- token it needs.
148
153
  - [Notes](https://github.com/caiopizzol/keypin/blob/main/docs/notes.md): `wrangler dev`, and the files keypin keeps.
149
154
  - [Development](https://github.com/caiopizzol/keypin/blob/main/docs/development.md): install from source, checks and
150
155
  releases.