You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
17
17
18
18
### Added
19
19
20
-
-**Migration script (`npm run upgrade`)** — fully implemented `scripts/migrate-encryption.js` for v6.0.0 encryption scheme upgrades. Two modes: **fast** (rename-only for v2 schemes and `convergent-v1`) and **full** (re-encryption for v1 whole/framed schemes that lacked AAD). Supports `--execute` (default dry-run), `--passphrase`, and `--cwd`. Reads every vault entry, classifies it, and reports what will/did change.
20
+
-**Migration script (`npm run upgrade`)** — fully implemented `scripts/migrate-encryption.js` for v6.0.0 encryption scheme upgrades. Two modes: **fast** (rename-only for v2 schemes and `convergent-v1`) and **full** (re-encryption for v1 whole/framed schemes that lacked AAD). Supports `--execute` (default dry-run), `--passphrase`, `--key-file`, privacy-vault key options, and `--cwd`. Reads every vault entry, classifies it, and reports what will/did change.
21
21
-**`CasService.readManifestRaw()`** — reads a manifest from a Git tree OID and returns the raw decoded object without Manifest construction or scheme assertion. Migration entry point for inspecting legacy manifests.
22
22
-**`CasService``legacyMode` constructor option** — when `true`, `readManifest()` maps legacy scheme identifiers (v1/v2) to their current names instead of throwing `LEGACY_SCHEME`. Legacy v1 manifests (no AAD) are correctly decrypted without AAD during restore.
23
23
-**`mapToCurrentScheme()` and `isLegacyNoAad()` in `schemes.js`** — public helpers for mapping legacy scheme strings to current names and detecting v1 no-AAD schemes.
@@ -58,7 +58,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
58
58
-**Plaintext+compressed restore is now streaming** — compressed unencrypted data uses `_restoreCompressedStreaming` instead of the buffered path, eliminating the `maxRestoreBufferSize` constraint for this case.
59
59
-**`formatVersion` stamped into new manifests** — new manifests include a `formatVersion` field carrying the package semver at store time. The field is optional on read for backward compatibility with older manifests.
60
60
-**`CryptoPort._buildMeta` default scheme** — changed to the current `whole` identifier.
61
-
-**CompressionPort extraction** — `CasService` no longer imports `node:zlib`, `node:stream`, or `node:util` directly. Compression is now delegated through a `CompressionPort` abstract port with a `NodeCompressionAdapter` default implementation. The`CasService`constructor accepts an optional `compressionAdapter` parameter for injecting alternative implementations. Public API unchanged; internal refactor only.
61
+
-**CompressionPort extraction** — `CasService` no longer imports `node:zlib`, `node:stream`, or `node:util` directly. Compression is now delegated through a `CompressionPort` abstract port. Direct`CasService`construction must inject `compressionAdapter`; the facade still provides the Node gzip default for normal callers.
62
62
-**AES-GCM adapter enforcement** — Node, Bun, and Web Crypto decrypt paths now all reject malformed AES-256-GCM metadata at the adapter boundary, enforce the declared algorithm before decrypting, and reject short or malformed nonce/tag fields before any runtime-specific decrypt call runs.
63
63
-**Buffered restore adapter contract** — hard-limited buffered restore modes now require `readBlobStream()` on the persistence adapter instead of silently degrading to whole-blob `readBlob()` fallback behavior. Plaintext restore keeps the compatibility fallback.
64
64
-**KDF salt shape hardening** — stored KDF salt metadata now rejects malformed base64 at both the manifest schema layer and the runtime stored-KDF policy path, keeping vault metadata and passphrase-restore behavior aligned before derive work starts.
The migration script handles both fast (rename-only for v2 schemes) and full (re-encryption with AAD for v1 schemes) migration paths. The main `src/` codebase throws `LEGACY_SCHEME` if it encounters a v1/v2 identifier.
302
+
The migration script handles both fast (rename-only for v2 schemes) and full (re-encryption with AAD for v1 schemes) migration paths. Full migration accepts either `--passphrase` or `--key-file`. For privacy-enabled vaults, add `--vault-passphrase`, `--vault-passphrase-file`, or `--vault-key-file` when the vault passphrase differs from the content passphrase. The main `src/` codebase throws `LEGACY_SCHEME` if it encounters a v1/v2 identifier.
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,7 +89,7 @@ Three encryption schemes are supported:
89
89
|`framed`| Bounded frames | Slug + frame index | Default for fixed-chunk encrypted stores — streaming decrypt with per-frame AAD binding |
90
90
|`convergent`| Per-chunk deterministic | Derived from content hash |**Default for CDC + encryption** — preserves deduplication across encrypted stores. Implemented as a standalone `ConvergentEncryption` service. |
91
91
92
-
Legacy schemes (`whole-v1`, `whole-v2`, `framed-v1`, `framed-v2`, `convergent-v1`) are no longer accepted and throw a `LEGACY_SCHEME` error. Run `npm run upgrade` (or `node scripts/migrate-encryption.js`) to migrate existing vault entries. The script auto-detects whether each entry needs a rename-only (fast) or full re-encryption (v1 schemes without AAD) and defaults to dry-run mode.
92
+
Legacy schemes (`whole-v1`, `whole-v2`, `framed-v1`, `framed-v2`, `convergent-v1`) are no longer accepted and throw a `LEGACY_SCHEME` error. Run `npm run upgrade` (or `node scripts/migrate-encryption.js`) to migrate existing vault entries. The script auto-detects whether each entry needs a rename-only (fast) or full re-encryption (v1 schemes without AAD), accepts either `--passphrase` or `--key-file` for full migrations, supports privacy-vault key options, and defaults to dry-run mode.
93
93
94
94
**Envelope encryption** wraps a random Data Encryption Key (DEK) with one or more Key Encryption Keys (KEKs). Each recipient is labeled, enabling multi-recipient access to the same encrypted content. Key rotation replaces the KEK wrapping without re-encrypting data blobs.
Copy file name to clipboardExpand all lines: UPGRADING.md
+18-3Lines changed: 18 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ If you have an existing vault with encrypted assets:
11
11
npm run upgrade
12
12
13
13
# Apply the migration
14
-
npm run upgrade -- --execute --passphrase <your-vault-passphrase>
14
+
npm run upgrade -- --execute --passphrase <your-content-passphrase>
15
15
```
16
16
17
17
If you only use the library API (no vault), skip to [API Changes](#api-changes).
@@ -54,12 +54,26 @@ npm run upgrade
54
54
55
55
# Execute: migrate all vault entries
56
56
npm run upgrade -- --execute --passphrase <passphrase>
57
+
58
+
# Or migrate entries encrypted with a raw 32-byte key
59
+
npm run upgrade -- --execute --key-file ./asset.key
57
60
```
58
61
59
62
The migration script has two modes:
60
63
61
64
-**Fast mode** (v2 schemes + convergent): renames the scheme in the manifest metadata. No re-encryption. Seconds.
62
-
-**Full mode** (v1 schemes): restores through the legacy pipeline (decrypts without AAD), then re-stores with the current scheme (encrypts with AAD). Requires passphrase.
65
+
-**Full mode** (v1 schemes): restores through the legacy pipeline (decrypts without AAD), then re-stores with the current scheme (encrypts with AAD). Requires `--passphrase` or `--key-file`.
66
+
67
+
Privacy-enabled vaults need the vault encryption key to list and update slugs.
68
+
If the vault passphrase differs from the content passphrase, pass
69
+
`--vault-passphrase`, `--vault-passphrase-file`, or `--vault-key-file`.
70
+
When no explicit vault key option is provided, `--passphrase` is reused for the
71
+
privacy vault.
72
+
73
+
Recipient-encrypted v1 manifests are not automatically full-migrated because
74
+
preserving recipient access requires the original recipient key set. Re-store
75
+
those assets with current recipients after restoring them with a matching
76
+
recipient key.
63
77
64
78
Original blobs are never deleted — Git's garbage collection only removes unreferenced objects after `git gc`.
65
79
@@ -202,7 +216,8 @@ These are new capabilities that don't require migration:
202
216
CasError: Legacy encryption scheme "whole-v1" is no longer supported.
203
217
```
204
218
205
-
Run `npm run upgrade -- --execute --passphrase <pass>` to migrate.
219
+
Run `npm run upgrade -- --execute --passphrase <pass>` or
220
+
`npm run upgrade -- --execute --key-file <path>` to migrate.
0 commit comments