hexo-blog-encrypt 4.1.0 → 4.2.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
@@ -1,374 +1,79 @@
1
1
  # hexo-blog-encrypt
2
2
 
3
- > Password-protect individual Hexo posts. Content is encrypted at build time
4
- > with AES-256-GCM and decrypted in the reader's browser with the Web Crypto
5
- > API. No server, no plaintext in the generated HTML.
3
+ Keep a post on your static Hexo blog, but share its contents only with readers who know the password. Hexo encrypts the body when you build; readers unlock it in their browser. No accounts or decryption server needed.
6
4
 
7
- **[▶ Live demo](https://d0n9x1n.github.io/hexo-blog-encrypt/)**: every demo password is `hello`.
5
+ **[Try a locked post](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/card/)** (demo password: `hello`) · [Read the guide](https://github.com/D0n9X1n/hexo-blog-encrypt/wiki/Getting-Started) · [简体中文](https://github.com/D0n9X1n/hexo-blog-encrypt/blob/master/ReadMe.zh.md)
8
6
 
9
- [![GitHub release](https://img.shields.io/github/v/release/D0n9X1n/hexo-blog-encrypt?include_prereleases&logo=github&label=release&color=brightgreen)](https://github.com/D0n9X1n/hexo-blog-encrypt/releases)
10
- [![npm](https://img.shields.io/npm/v/hexo-blog-encrypt?logo=npm&color=brightgreen)](https://www.npmjs.com/package/hexo-blog-encrypt)
11
- [![npm downloads](https://img.shields.io/npm/dm/hexo-blog-encrypt?logo=npm&label=downloads)](https://www.npmjs.com/package/hexo-blog-encrypt)
12
- [![License](https://img.shields.io/npm/l/hexo-blog-encrypt?color=brightgreen)](./LICENSE)
13
- [![Tests](https://github.com/D0n9X1n/hexo-blog-encrypt/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/D0n9X1n/hexo-blog-encrypt/actions/workflows/test.yml)
14
- [![Coverage](https://img.shields.io/badge/server%20coverage-100%25-brightgreen)](./docs/DEVELOPMENT.md)
15
- [![Live Demo](https://img.shields.io/badge/demo-online-brightgreen?logo=github)](https://d0n9x1n.github.io/hexo-blog-encrypt/)
16
- [![Node](https://img.shields.io/node/v/hexo-blog-encrypt?logo=node.js&color=brightgreen)](./package.json)
17
- [![Hexo](https://img.shields.io/npm/dependency-version/hexo-blog-encrypt/peer/hexo?logo=hexo&label=hexo)](https://hexo.io/)
18
- [![Dependencies](https://img.shields.io/badge/runtime%20dependencies-0-brightgreen)](./package.json)
19
- [![npm provenance](https://img.shields.io/badge/npm-provenance-blue?logo=npm)](https://www.npmjs.com/package/hexo-blog-encrypt#provenance)
20
- [![GitHub stars](https://img.shields.io/github/stars/D0n9X1n/hexo-blog-encrypt?style=flat&logo=github)](https://github.com/D0n9X1n/hexo-blog-encrypt/stargazers)
21
-
22
- English · [中文说明](./ReadMe.zh.md) · [Wiki](https://github.com/D0n9X1n/hexo-blog-encrypt/wiki) · [Releases](https://github.com/D0n9X1n/hexo-blog-encrypt/releases)
23
-
24
- ## Contents
25
-
26
- - [Highlights](#highlights)
27
- - [Live demo](#live-demo)
28
- - [Install](#install)
29
- - [Quick start](#quick-start)
30
- - [Configuration](#configuration)
31
- - [Theme integration](#theme-integration)
32
- - [Browser support](#browser-support)
33
- - [Why upgrade from v3?](#why-upgrade-from-v3)
34
- - [Upgrading from v3](#upgrading-from-v3)
35
- - [Contributing](#contributing)
36
- - [License](#license)
37
-
38
- ## Highlights
7
+ [![A Card password prompt beside the excerpt it reveals after a successful unlock](https://raw.githubusercontent.com/D0n9X1n/hexo-blog-encrypt/master/assets/readme/unlock.webp)](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/card/)
39
8
 
40
- | | |
41
- | --- | --- |
42
- | **Authenticated encryption** | [PBKDF2](https://www.rfc-editor.org/rfc/rfc8018)-SHA256 key derivation and [AES-256-GCM](https://csrc.nist.gov/pubs/sp/800/38/d/final). The GCM tag rejects wrong passwords and tampered ciphertext. |
43
- | **Native crypto only** | Node.js [`crypto`](https://nodejs.org/api/crypto.html) at build time, the browser [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) at read time. No runtime dependencies. |
44
- | **Per-post keys** | Each post has its own 32-byte salt and 12-byte nonce, so one cracked post does not speed up attacks on the others. |
45
- | **Front-matter or tag passwords** | Set `password:` on a post, or map tags to passwords in `_config.yml`. |
46
- | **Eight themes** | `default`, `blink`, `flip`, `shrink`, `surge`, `up`, `wave`, `xray`. Add your own by dropping in one HTML file. |
47
- | **Scripts keep working** | Scripts inside a decrypted post run in document order. A `hexo-blog-decrypt` event fires when the post is revealed. |
48
- | **Privacy by default** | Passwords and keys are not stored unless you opt in with `autoSave`. |
49
- | **Tested** | 100% server line, branch and function coverage, plus Playwright end-to-end tests across every theme. |
50
-
51
- ## Live demo
52
-
53
- Open the **[demo site](https://d0n9x1n.github.io/hexo-blog-encrypt/)**. All passwords are `hello`.
9
+ [![Release](https://img.shields.io/github/v/release/D0n9X1n/hexo-blog-encrypt)](https://github.com/D0n9X1n/hexo-blog-encrypt/releases)
10
+ [![npm](https://img.shields.io/npm/v/hexo-blog-encrypt)](https://www.npmjs.com/package/hexo-blog-encrypt)
11
+ [![License](https://img.shields.io/npm/l/hexo-blog-encrypt)](https://github.com/D0n9X1n/hexo-blog-encrypt/blob/master/LICENSE)
12
+ [![Tests](https://github.com/D0n9X1n/hexo-blog-encrypt/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/D0n9X1n/hexo-blog-encrypt/actions/workflows/test.yml)
13
+ [![Demo](https://img.shields.io/badge/demo-online-brightgreen)](https://d0n9x1n.github.io/hexo-blog-encrypt/)
54
14
 
55
- - [Theme gallery](https://d0n9x1n.github.io/hexo-blog-encrypt/tags/theme-demo/)
56
- - [Decrypt callback](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/callback/)
57
- - [Script loading order and cached keys](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/script-order/)
15
+ ## Lock your first post
58
16
 
59
- ## Install
17
+ From your Hexo site directory (Node.js 18+, Hexo 5+):
60
18
 
61
- ```bash
19
+ ```sh
62
20
  npm install --save hexo-blog-encrypt
63
21
  ```
64
22
 
65
- Requires Node.js 18 or later and Hexo 5 or later. The package is published to
66
- npm with [provenance](https://docs.npmjs.com/generating-provenance-statements)
67
- and mirrored to GitHub Packages as `@d0n9x1n/hexo-blog-encrypt`.
68
-
69
- ## Quick start
70
-
71
- Add a `password` to a post's front matter:
72
-
73
- ```markdown
74
- ---
75
- title: Hello World
76
- date: 2016-03-30 21:18:02
77
- password: hello
78
- ---
79
- ```
80
-
81
- Then rebuild and preview:
82
-
83
- ```bash
84
- hexo clean && hexo generate && hexo server
85
- ```
86
-
87
- The post body is replaced by a password form. Index pages show the `abstract`
88
- text instead of the content.
89
-
90
- ## Configuration
91
-
92
- Settings are resolved in this order:
93
-
94
- **post front matter > `_config.yml` `encrypt:` block > built-in defaults**
95
-
96
- A front-matter `password` takes precedence over a tag password.
97
-
98
- ### Front matter
99
-
100
- ```markdown
101
- ---
102
- title: Hello World
103
- tags:
104
- - encryptAsDiary
105
- date: 2016-03-30 21:12:21
106
- password: mikemessi
107
- abstract: Here's something encrypted, password is required to continue reading.
108
- message: Hey, password is required here.
109
- wrong_pass_message: Oh, this is an invalid password. Check and try again, please.
110
- theme: xray
111
- ---
112
- ```
113
-
114
- ### Site-wide `_config.yml`
23
+ Add a password to the front matter of **one** post. Use a long, unique passphrase instead of the demo password.
115
24
 
116
25
  ```yaml
117
- encrypt: # hexo-blog-encrypt
118
- abstract: Here's something encrypted, password is required to continue reading.
119
- message: Hey, password is required here.
120
- wrong_pass_message: Oh, this is an invalid password. Check and try again, please.
121
- theme: default
122
- silent: false
123
-
124
- # Encrypt every post that carries one of these tags.
125
- tags:
126
- - {name: encryptAsDiary, password: passwordA}
127
- - {name: encryptAsTips, password: passwordB}
128
-
129
- # Show a visible "Decrypt" button next to the password field.
130
- # Default: true.
131
- decryptButton:
132
- show: true
133
- text: Decrypt
134
-
135
- # Cache the derived AES key in localStorage so reloads skip the password
136
- # prompt. Default: false. Enable globally here or per post in front matter.
137
- # Entries are stored under `hbe.v4.<page path>`.
138
- autoSave: false
139
-
140
- # Keep the PBKDF2 salt stable across clean builds for the same post
141
- # permalink. Default: false. Useful with autoSave on Cloudflare Pages,
142
- # Vercel, Netlify, GitHub Actions, and other platforms that rebuild
143
- # generated HTML from a clean environment on every deploy.
144
- #
145
- # Only the salt is stable. The AES-GCM nonce stays random for every
146
- # encryption to avoid nonce reuse. If the post permalink changes, the
147
- # stable salt changes too, and the page's existing localStorage cache is
148
- # invalidated.
149
- stableSalt: false
150
-
151
- # PBKDF2 iteration count. Floor: 100_000. Recommended: 600_000 or more
152
- # (OWASP 2023 for PBKDF2-SHA256). Values below the recommendation log a
153
- # build warning. Default: 250_000.
154
- kdf:
155
- iterations: 250000
156
- ```
157
-
158
- When `autoSave` reads a cached key, it compares the cached salt with the
159
- current page salt. A nonce change alone does not delete the cache up front;
160
- the browser tries the cached key with the current page nonce and ciphertext.
161
- If AES-GCM authentication fails, the cache entry is cleared and the visitor is
162
- asked for the password again.
163
-
164
- **Saved keys and their exposure.** A saved key lives in `localStorage` under
165
- `hbe.v4.<page path>` and unlocks that post on this device until it is removed.
166
- Any script running on the same origin (your theme, analytics, comment
167
- widgets, or an injected script) can read it, so enable `autoSave` only when
168
- you trust every script on the site. After a post is revealed with a saved
169
- key, a **Forget saved key** button above it deletes the entry. Turning
170
- `autoSave` off for a post deletes that post's saved key on the next visit,
171
- and leftover v3 `hexo-blog-encrypt:#…` entries are removed automatically.
172
-
173
- ### Option reference
174
-
175
- | Option | Default | Description |
176
- | --- | --- | --- |
177
- | `password` | none | Encrypts the post. `""` disables encryption, including tag encryption. A matching tag entry without a password fails the build. |
178
- | `password: { env: NAME }` | none | Reads the password from environment variable `NAME` at build time (front matter, `encrypt.password` or `encrypt.tags[].password`). A missing or empty variable fails the build; the value is never logged or rendered. This keeps passwords out of config files, not out of plaintext Markdown you commit publicly. |
179
- | `abstract` | `Here's something encrypted…` | Excerpt shown on index and archive pages. |
180
- | `message` | `Hey, password is required here.` | Label of the password field. |
181
- | `wrong_pass_message` | `Oh, this is an invalid password…` | Inline error after a failed attempt. |
182
- | `theme` | `default` | One of the eight bundled themes. Unknown names fall back to `default` with a warning. |
183
- | `tags` | `[]` | `_config.yml` only. `{name, password}` pairs for tag encryption. |
184
- | `decryptButton.show` / `.text` | `true` / `Decrypt` | Visible submit button and its label. |
185
- | `autoSave` | `false` | Cache the derived key in `localStorage`. |
186
- | `stableSalt` | `false` | Derive the salt from the permalink so cached keys survive clean rebuilds. |
187
- | `kdf.iterations` | `250000` | PBKDF2 iterations. Must be an integer of at least 100,000. |
188
- | `silent` | `false` | Suppress build-time info logs. Warnings and errors still print. |
189
- | `wrong_hash_message` | `wrong_pass_message` | Deprecated alias. AES-GCM reports wrong passwords and tampering the same way. |
190
- | `template` | none | Deprecated alias of `theme`. |
191
-
192
- Boolean options (`autoSave`, `stableSalt`, `silent`, `decryptButton.show`) must be `true` or `false`. Quoted `"true"`/`"false"` are accepted with a warning; any other value fails the build.
193
-
194
- The default `abstract`, `message`, `wrong_pass_message` and `decryptButton.text` follow the post's `lang`/`language`, else the site `language`. `zh`, `zh-CN` and `zh-Hans` use Simplified Chinese; everything else uses English. Explicit values always win.
195
-
196
- ### Disable tag encryption for one post
197
-
198
- Set an empty password in that post's front matter:
199
-
200
- ```markdown
201
26
  ---
202
- title: Public post with an encrypted tag
203
- tags:
204
- - A Tag should be encrypted
205
- password: ""
27
+ title: Field notes
28
+ theme: wave
29
+ password: { env: POST_PASSWORD }
30
+ abstract: Notes from the trip. Ask me for the password.
206
31
  ---
207
32
  ```
208
33
 
209
- ## Theme integration
210
-
211
- ### After-decrypt event
212
-
213
- The plugin dispatches `hexo-blog-decrypt` once on `window` after each post is
214
- revealed. `event.detail.mode` is `manual` (password entered) or `cached`
215
- (saved key), and `event.detail.element` is the revealed container (useful when
216
- an index page shows several encrypted posts). Listen for it to re-run anything
217
- that scans the post body:
218
-
219
- ```js
220
- window.addEventListener('hexo-blog-decrypt', function (event) {
221
- // Reinitialize your theme's table of contents, syntax highlighting, etc.
222
- console.log('Decrypted:', event.detail.mode, event.detail.element);
223
- });
224
- ```
225
-
226
- ### PJAX and SPA themes
227
-
228
- The bundle initializes every encrypted post on the page once. It re-scans
229
- automatically on `pjax:complete`, `pjax:success`, `swup:contentReplaced` and
230
- `turbo:load` (dispatched on `document`). For other routers, call the idempotent
231
- initializer after swapping content:
232
-
233
- ```js
234
- window.hexoBlogEncrypt.init(); // whole document
235
- window.hexoBlogEncrypt.init(container); // only a subtree
236
- ```
237
-
238
- ### Scripts inside encrypted posts
239
-
240
- Scripts in a post run after it is decrypted. Since **4.0.3**, ordinary external
241
- scripts load in document order before later inline scripts run, so
242
- library-dependent code such as DPlayer initializes correctly. The decrypt event
243
- waits until restored external scripts load, fail, or reach a **15-second
244
- per-script deadline**. A timeout does not cancel a script; it can still execute
245
- later. Existing `onload` and `onerror` handlers are preserved. Explicit `async`
246
- scripts still load independently, and restored `defer` scripts do not recreate a
247
- document parsing phase. Inline `type="module"` scripts and asynchronous work
248
- inside scripts keep native scheduling and may finish after the decrypt event.
249
-
250
- ```markdown
251
- <script>
252
- // Runs after this post is decrypted.
253
- console.log('Hello from an encrypted post');
254
- </script>
255
- ```
256
-
257
- ### Table of contents
258
-
259
- **Never render an encrypted post's `post.origin` into generated HTML.** It
260
- holds plaintext for legacy Hexo integrations. A TOC hidden with
261
- `display:none` still publishes its headings. Search, feed and sitemap
262
- integrations must also exclude plaintext fields from encrypted posts.
263
-
264
- Render a server-side TOC only for unencrypted posts:
265
-
266
- ```ejs
267
- <% if (post.toc === true && !post.encrypt) { %>
268
- <div class="toc-article"><%- toc(post.content, {list_number: true}) %></div>
269
- <% } %>
270
- <%- post.content %>
271
- ```
34
+ Set `POST_PASSWORD` in your build environment, then run `npx hexo clean && npx hexo generate && npx hexo server`. Open the post, type the passphrase and press **Enter**. Deploy the generated site over **HTTPS**. To protect multiple posts with one rule, use [tag-based encryption](https://github.com/D0n9X1n/hexo-blog-encrypt/wiki/Tag-Based-Encryption).
272
35
 
273
- For encrypted posts, build the TOC in the browser inside the
274
- `hexo-blog-decrypt` handler from the revealed `#hexo-blog-encrypt` content.
36
+ **What stays public:** the title, the abstract, and any source Markdown or original media you publish separately. Keep private source out of public repositories. A visitor can download the ciphertext and try passwords offline; this is not a substitute for access-controlled hosting. [Security model →](https://github.com/D0n9X1n/hexo-blog-encrypt/wiki/Security-Model)
275
37
 
276
- ### Encryption themes
38
+ ## Choose a look
277
39
 
278
- Pick a theme per post with `theme:` in front matter, or for the whole site in
279
- `_config.yml`. Preview each one:
280
-
281
- [default](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/default/) ·
282
- [blink](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/blink/) ·
283
- [flip](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/flip/) ·
284
- [shrink](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/shrink/) ·
285
- [surge](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/surge/) ·
286
- [up](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/up/) ·
287
- [wave](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/wave/) ·
288
- [xray](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/xray/)
289
-
290
- To add a theme, see [docs/THEMES.md](./docs/THEMES.md).
291
-
292
- ## Browser support
293
-
294
- Decryption uses Web Crypto (`crypto.subtle`), which requires a **secure
295
- context**: HTTPS or `http://localhost`.
296
-
297
- | Browser | Minimum | Tested |
298
- | --- | --- | --- |
299
- | Chromium / Edge | 92+ | Automated: Playwright Chromium in CI, Hexo 7 and 8 |
300
- | Firefox | 90+ | Automated: Playwright Firefox in CI |
301
- | Safari (macOS) | 14+ | Automated: Playwright WebKit in CI (WebKit engine, not Safari itself) |
302
- | Safari (iOS) | 14+ | Manual only |
303
-
304
- Minimum versions come from Web Crypto and language feature support; CI runs
305
- the current Playwright builds, not these minimums.
40
+ | [Wave](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/wave/) | [Terminal](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/terminal/) |
41
+ | --- | --- |
42
+ | [![Wave’s curved underline sweeps across the focused password field](https://raw.githubusercontent.com/D0n9X1n/hexo-blog-encrypt/master/assets/readme/wave.webp)](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/wave/) | [![Terminal’s dark password prompt with a monospace label and a command-line caret](https://raw.githubusercontent.com/D0n9X1n/hexo-blog-encrypt/master/assets/readme/terminal.webp)](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/terminal/) |
306
43
 
307
- On plain HTTP from a non-localhost host, `crypto.subtle` is `undefined`, so
308
- decryption cannot run; the post shows an "open this page over HTTPS" message
309
- instead of the wrong-password error. Always serve production sites over HTTPS.
44
+ Set `theme:` per post or site-wide. All 11 prompts use the same encryption; the eight classics keep their distinct focus and filled states.
310
45
 
311
- ## Why upgrade from v3?
46
+ **Classic:** [default](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/default/) · [blink](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/blink/) · [flip](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/flip/) · [shrink](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/shrink/) · [surge](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/surge/) · [up](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/up/) · [wave](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/wave/) · [xray](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/xray/)
312
47
 
313
- v4 closes real security gaps and fixes v3's UX problems:
48
+ **Modern:** [minimal](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/minimal/) · [card](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/card/) · [terminal](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/theme/terminal/)
314
49
 
315
- - **Stronger crypto.** **AES-256-GCM** with a built-in authentication tag
316
- replaces v3's AES-CBC plus a separate HMAC: one primitive, one
317
- authentication path, and no CBC padding-oracle or HMAC-comparison bugs.
318
- - **Per-post salt and nonce.** v3 used the same salt for every post, so one
319
- password derived the same key everywhere. v4 derives an independent key per
320
- post, so an attacker cannot reuse PBKDF2 work across posts that share a
321
- password.
322
- - **Stronger KDF defaults.** v3 used **1,024** PBKDF2-SHA256 iterations. v4
323
- defaults to **250,000** (about 240 times more work per guess) and recommends
324
- 600,000 or more (OWASP 2023). Tune it per post with `kdf.iterations`.
325
- - **Privacy by default.** v3 always cached decrypted posts in `localStorage`,
326
- so anyone with later access to the device could read them again. v4 defaults
327
- to `autoSave: false`; you opt in per post or globally.
328
- - **Inline errors.** v3 showed a `window.alert()` dialog on a wrong password.
329
- v4 shows the error next to the field (`role="alert"`).
330
- - **Optional decrypt button** for readers who don't know Enter submits the form.
331
- - **Smaller bundle.** CryptoJS is gone; the browser bundle is about 6 KB
332
- minified.
333
- - **Tested.** 100% server coverage plus Playwright tests across all eight
334
- themes, on every push.
50
+ ## What to know before publishing
335
51
 
336
- The rationale for each change is on the wiki:
337
- [Migration v3 → v4](https://github.com/D0n9X1n/hexo-blog-encrypt/wiki/Migration-v3-to-v4).
52
+ Package **v4.2.0** writes format 5 and can still read format 4 posts. It uses scrypt and AES-256-GCM, with no runtime npm dependencies. Readers need HTTPS or localhost. Key caching is **off by default**; leave it off on shared devices.
338
53
 
339
- ## Upgrading from v3
54
+ <details>
55
+ <summary><strong>Passwords, saved keys and rebuilds</strong></summary>
340
56
 
341
- v4 changed the encrypted format (AES-GCM, per-post salt and nonce). v4 cannot
342
- read v3 output and v3 cannot read v4 output.
57
+ | Front matter | Effect |
58
+ | --- | --- |
59
+ | `password: { env: NAME }` | Read the password from the build environment. Also supported in `encrypt.tags[].password`. A missing or empty variable fails the build. |
60
+ | `password: ""` | Keep this post public even if a tag would otherwise encrypt it. |
343
61
 
344
- 1. Upgrade the plugin: `npm install --save hexo-blog-encrypt@^4`.
345
- 2. Rebuild from source: `hexo clean && hexo generate`.
346
- 3. Purge your CDN if you use one. Post HTML changes on every build because each
347
- encryption uses a fresh nonce. The runtime asset `lib/hbe.<hash>.js` is
348
- content-hashed and changes only when the bundle changes.
349
- 4. Optional: remove `wrong_hash_message` from your config and front matter. It
350
- is deprecated in v4 and will be removed in v5.
62
+ `autoSave` stores a non-extractable CryptoKey in IndexedDB, not the password: format 5 uses an HKDF base key; format 4 uses an AES-GCM key. Upgrading purges legacy raw keys, so readers may need to enter their password once. Same-origin code can still use the saved key. A reader can choose **Forget saved key**; `window.hexoBlogEncrypt.forget(target?)` confirms deletion only when the storage transaction completes.
351
63
 
352
- Your source `.md` files are not touched. See the
353
- [v4.0.0 release notes](https://github.com/D0n9X1n/hexo-blog-encrypt/releases/tag/v4.0.0)
354
- and [Releases](https://github.com/D0n9X1n/hexo-blog-encrypt/releases) for the
355
- full list of breaking changes.
64
+ `stableSalt` and `autoSave` default to false. On Cloudflare Pages, Vercel, Netlify or GitHub Actions, `stableSalt: true` can preserve that cache across clean builds. If the permalink changes, the old entry is invalidated. Each encryption still uses a random nonce. A commitment mismatch clears the entry; if AES-GCM authentication fails, the cache is cleared too.
356
65
 
357
- ## Contributing
66
+ </details>
358
67
 
359
- Issues and pull requests are welcome. Please read
360
- [CONTRIBUTING.md](./.github/CONTRIBUTING.md) and include reproduction steps,
361
- logs and your configuration when reporting a bug.
68
+ <details>
69
+ <summary><strong>Encryption, asset integrity and theme integrations</strong></summary>
362
70
 
363
- - [Architecture](./docs/ARCHITECTURE.md)
364
- - [Development](./docs/DEVELOPMENT.md)
365
- - [Releasing](./docs/RELEASING.md)
366
- - [Themes](./docs/THEMES.md)
71
+ The default is `scrypt` (`N=32768, r=8, p=3`); alternatives are `pbkdf2-sha256` (600000 iterations) and `pbkdf2-sha512` (220000). HKDF-SHA256 separates encryption and commitment values per envelope. Older bundles cannot read new posts: deploy HTML together with `css/hbe.<hex10>.css` and `lib/hbe.<hex10>.js`. SHA-384 checks cover the emitted bytes, assuming trusted HTML.
367
72
 
368
- ## License
73
+ Listen for `hexo-blog-decrypt` to rebuild a TOC or rerender MathJax. Never generate a TOC, feed or search index from private plaintext. The [encrypted TOC guide](https://github.com/D0n9X1n/hexo-blog-encrypt/wiki/Encrypted-TOC) includes the `hexo-encrypt-toc` skill. Ordinary external scripts run in document order, with a 15-second wait per script; `async` scripts and inline `type="module"` keep their native scheduling. [Try the script-order demo](https://d0n9x1n.github.io/hexo-blog-encrypt/demo/script-order/).
369
74
 
370
- [MIT](./LICENSE)
75
+ </details>
371
76
 
372
- ## Thanks
77
+ **[Browse the wiki](https://github.com/D0n9X1n/hexo-blog-encrypt/wiki)** · [Configuration](https://github.com/D0n9X1n/hexo-blog-encrypt/wiki/Configuration-Reference) · [Create a theme](https://github.com/D0n9X1n/hexo-blog-encrypt/wiki/Theme-Authoring) · [Troubleshooting](https://github.com/D0n9X1n/hexo-blog-encrypt/wiki/Troubleshooting)
373
78
 
374
- Collaborator: [xiazeyu](https://github.com/xiazeyu)
79
+ [Contribute](https://github.com/D0n9X1n/hexo-blog-encrypt/blob/master/.github/CONTRIBUTING.md) · [Report a vulnerability privately](https://github.com/D0n9X1n/hexo-blog-encrypt/blob/master/SECURITY.md) · [MIT license](https://github.com/D0n9X1n/hexo-blog-encrypt/blob/master/LICENSE) · Thanks to [xiazeyu](https://github.com/xiazeyu).