localvault 1.6.0 → 1.6.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.
- checksums.yaml +4 -4
- data/README.md +23 -11
- data/lib/localvault/cli/sync.rb +30 -0
- data/lib/localvault/cli.rb +5 -4
- data/lib/localvault/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9cf502e2c11320a16bbf04e20ce1202d799d360775b664c1902c6ef337557302
|
|
4
|
+
data.tar.gz: 1504ab893d079a1308519a8dd9fdfd941560348fca5d92cc1548edd9f6bf6549
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5aee20035eb1f290f95648c146b7a05f650f033d2f4cfa4ee4dbc565133031871607974c8c3eca58009bf1a3b5fff53ff11940c8841b476d281909d8d72d6ac4
|
|
7
|
+
data.tar.gz: d8a9f184fc3c636742293a74901d24e12c7c8d48191b1816824e90cf0d7162f670373e78dd54ecc4bc6ef7daffbe6e73f1e341fdb786b258ba7ef3d8ffc1a4da
|
data/README.md
CHANGED
|
@@ -100,8 +100,10 @@ localvault exec -- rails server
|
|
|
100
100
|
| `login [TOKEN]` | Log in to InventList — auto-generates X25519 keypair + publishes public key |
|
|
101
101
|
| `login --status` | Show current login status |
|
|
102
102
|
| `logout` | Clear stored credentials |
|
|
103
|
-
| `sync
|
|
104
|
-
| `sync
|
|
103
|
+
| `sync` | Sync all vaults bidirectionally (push local, pull remote, detect conflicts) |
|
|
104
|
+
| `sync --dry-run` | Preview what sync would do without making changes |
|
|
105
|
+
| `sync push [NAME]` | Push one vault to cloud |
|
|
106
|
+
| `sync pull [NAME]` | Pull one vault from cloud (auto-unlocks if you have a key slot) |
|
|
105
107
|
| `sync status` | Show sync state for all vaults |
|
|
106
108
|
| `config set server URL` | Point at a custom server (default: inventlist.com) |
|
|
107
109
|
|
|
@@ -147,22 +149,32 @@ All commands accept `--vault NAME` (or `-v NAME`) to target a specific vault. De
|
|
|
147
149
|
Sync your vaults between machines — same passphrase, no team features needed:
|
|
148
150
|
|
|
149
151
|
```bash
|
|
150
|
-
# Machine A: push your
|
|
151
|
-
localvault sync
|
|
152
|
+
# Machine A: push all your vaults at once
|
|
153
|
+
localvault sync
|
|
152
154
|
|
|
153
|
-
# Machine B: install, login,
|
|
155
|
+
# Machine B: install, login, sync
|
|
154
156
|
brew install inventlist/tap/localvault
|
|
155
157
|
localvault login YOUR_TOKEN
|
|
156
|
-
localvault sync
|
|
157
|
-
localvault show
|
|
158
|
+
localvault sync # pulls everything, pushes local-only vaults
|
|
159
|
+
localvault show # enter your passphrase — same secrets
|
|
158
160
|
```
|
|
159
161
|
|
|
160
|
-
|
|
162
|
+
Or push/pull individual vaults:
|
|
161
163
|
|
|
162
164
|
```bash
|
|
163
|
-
localvault sync
|
|
164
|
-
#
|
|
165
|
-
#
|
|
165
|
+
localvault sync push production # push one vault
|
|
166
|
+
localvault sync pull production # pull one vault
|
|
167
|
+
localvault sync status # check what's synced vs local-only
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Preview before syncing:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
localvault sync --dry-run
|
|
174
|
+
# Vault Action Reason
|
|
175
|
+
# default skip up to date
|
|
176
|
+
# production push local changes
|
|
177
|
+
# staging pull remote changes
|
|
166
178
|
```
|
|
167
179
|
|
|
168
180
|
## Team Sharing
|
data/lib/localvault/cli/sync.rb
CHANGED
|
@@ -165,6 +165,15 @@ module LocalVault
|
|
|
165
165
|
|
|
166
166
|
# ── Core push logic ──────────────────────────────────────────
|
|
167
167
|
|
|
168
|
+
# Push a single vault to the cloud. Detects team vs personal mode,
|
|
169
|
+
# checks push authorization, packs the SyncBundle, uploads, and
|
|
170
|
+
# records the checksum in +.sync_state+ on success.
|
|
171
|
+
#
|
|
172
|
+
# Used by both the public +push+ command and the +all+ sync loop.
|
|
173
|
+
#
|
|
174
|
+
# @param vault_name [String] vault to push
|
|
175
|
+
# @param client [ApiClient] authenticated API client
|
|
176
|
+
# @return [Boolean] true on success, false on any error
|
|
168
177
|
def perform_push(vault_name, client)
|
|
169
178
|
store = Store.new(vault_name)
|
|
170
179
|
unless store.exists?
|
|
@@ -220,6 +229,14 @@ module LocalVault
|
|
|
220
229
|
|
|
221
230
|
# ── Core pull logic ──────────────────────────────────────────
|
|
222
231
|
|
|
232
|
+
# Pull a single vault from the cloud. Downloads the SyncBundle,
|
|
233
|
+
# writes meta.yml and secrets.enc locally, records +.sync_state+,
|
|
234
|
+
# and attempts automatic unlock via the user's identity key slot.
|
|
235
|
+
#
|
|
236
|
+
# @param vault_name [String] vault to pull
|
|
237
|
+
# @param client [ApiClient] authenticated API client
|
|
238
|
+
# @param force [Boolean] overwrite existing local vault (default: false)
|
|
239
|
+
# @return [Boolean] true on success, false on any error
|
|
223
240
|
def perform_pull(vault_name, client, force: false)
|
|
224
241
|
store = Store.new(vault_name)
|
|
225
242
|
if store.exists? && !force
|
|
@@ -267,6 +284,15 @@ module LocalVault
|
|
|
267
284
|
|
|
268
285
|
# ── Classification ───────────────────────────────────────────
|
|
269
286
|
|
|
287
|
+
# Determine the sync action for a single vault by comparing local,
|
|
288
|
+
# remote, and baseline state. Returns a hash with +:name+, +:action+
|
|
289
|
+
# (one of +:push+, +:pull+, +:skip+, +:conflict+), and +:reason+.
|
|
290
|
+
#
|
|
291
|
+
# @param name [String] vault name
|
|
292
|
+
# @param local_set [Set<String>] vaults that exist on disk
|
|
293
|
+
# @param remote_map [Hash{String => Hash}] remote vault info keyed by name
|
|
294
|
+
# @param my_handle [String] current user's InventList handle
|
|
295
|
+
# @return [Hash] +{name:, action:, reason:}+
|
|
270
296
|
def classify_vault(name, local_set, remote_map, my_handle)
|
|
271
297
|
l_exists = local_set.include?(name)
|
|
272
298
|
r_info = remote_map[name]
|
|
@@ -294,6 +320,10 @@ module LocalVault
|
|
|
294
320
|
{ name: name, action: action, reason: reason }
|
|
295
321
|
end
|
|
296
322
|
|
|
323
|
+
# Core decision matrix. Compares local/remote existence, checksums,
|
|
324
|
+
# and the stored baseline to decide: push, pull, skip, or conflict.
|
|
325
|
+
#
|
|
326
|
+
# @return [Array(Symbol, String)] +[action, reason]+ tuple
|
|
297
327
|
def determine_action(l_exists, r_exists, s_exists,
|
|
298
328
|
local_cs, remote_cs, baseline, is_read_only)
|
|
299
329
|
# Only local
|
data/lib/localvault/cli.rb
CHANGED
|
@@ -42,10 +42,11 @@ module LocalVault
|
|
|
42
42
|
shell.say " localvault copy KEY --to V Copy a secret to another vault"
|
|
43
43
|
shell.say ""
|
|
44
44
|
shell.say "SYNC (requires localvault login)"
|
|
45
|
-
shell.say " localvault sync push
|
|
46
|
-
shell.say " localvault sync
|
|
47
|
-
shell.say " localvault sync
|
|
48
|
-
shell.say " localvault sync
|
|
45
|
+
shell.say " localvault sync Sync all vaults bidirectionally (smart push/pull with conflict detection)"
|
|
46
|
+
shell.say " localvault sync --dry-run Show what would happen without making changes"
|
|
47
|
+
shell.say " localvault sync push [NAME] Push one vault to cloud"
|
|
48
|
+
shell.say " localvault sync pull [NAME] Pull one vault from cloud"
|
|
49
|
+
shell.say " localvault sync status Show sync status for all vaults"
|
|
49
50
|
shell.say ""
|
|
50
51
|
shell.say "TEAM SHARING (requires localvault login)"
|
|
51
52
|
shell.say " localvault dashboard Aggregate view: owned vaults, vaults shared with you, legacy shares"
|
data/lib/localvault/version.rb
CHANGED