{"id":13490860,"url":"https://github.com/D0n9X1n/hexo-blog-encrypt","last_synced_at":"2025-03-28T07:31:31.078Z","repository":{"id":40641250,"uuid":"54977937","full_name":"D0n9X1n/hexo-blog-encrypt","owner":"D0n9X1n","description":"Yet, just another hexo plugin for security.","archived":false,"fork":false,"pushed_at":"2023-09-19T00:35:54.000Z","size":234,"stargazers_count":956,"open_issues_count":6,"forks_count":102,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-04-14T11:43:20.459Z","etag":null,"topics":["encrypt","hexo","security"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/hexo-blog-encrypt","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/D0n9X1n.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-29T13:27:20.000Z","updated_at":"2024-06-18T13:49:55.597Z","dependencies_parsed_at":"2024-06-18T13:49:55.174Z","dependency_job_id":"f4e8e12e-1191-4171-94e0-7c934eea0291","html_url":"https://github.com/D0n9X1n/hexo-blog-encrypt","commit_stats":{"total_commits":151,"total_committers":20,"mean_commits":7.55,"dds":0.4437086092715232,"last_synced_commit":"e91245d64ebae134254dc90fa57ad2dce206bcfe"},"previous_names":["mikecoder/hexo-blog-encrypt"],"tags_count":60,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/D0n9X1n%2Fhexo-blog-encrypt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/D0n9X1n%2Fhexo-blog-encrypt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/D0n9X1n%2Fhexo-blog-encrypt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/D0n9X1n%2Fhexo-blog-encrypt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/D0n9X1n","download_url":"https://codeload.github.com/D0n9X1n/hexo-blog-encrypt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245989108,"owners_count":20705758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["encrypt","hexo","security"],"created_at":"2024-07-31T19:00:51.583Z","updated_at":"2025-03-28T07:31:30.732Z","avatar_url":"https://github.com/D0n9X1n.png","language":"CSS","funding_links":[],"categories":["CSS","JavaScript"],"sub_categories":[],"readme":"# hexo-blog-encrypt\n\n![GitHub release (latest SemVer including pre-releases)](https://img.shields.io/github/v/release/D0n9x1n/hexo-blog-encrypt?include_prereleases)\n[![Build Status](https://scrutinizer-ci.com/g/MikeCoder/hexo-blog-encrypt/badges/build.png?b=master)](https://scrutinizer-ci.com/g/MikeCoder/hexo-blog-encrypt/build-status/master)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/MikeCoder/hexo-blog-encrypt/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/MikeCoder/hexo-blog-encrypt/?branch=master)\n\n[中文说明](./ReadMe.zh.md)\n\n## What's this\n\n- ~~First of all, the **BEST** post encryption plugin in the universe for hexo.(But what about the other plugins?)~~\n\n- It is for those who write a post, but don't want everyone to read it. Thus, password is required in certain pages to access these encrypted posts.\n\n- Encryption is simple on wordpress, emlog or other blog systems, except hexo. :(\n\n- So it's \"hexo-blog-encrypt\"'s time.\n\n## Features\n\n- Once you enter the correct password, you can get the access to encrypted posts, and the password is remembered locally. Press the button again, and the stored password will be erased. If there're scripts in the post, they will be executed once the post is decrypted.\n\n- Support preset tag-specified password.\n\n- All functions are provided by the native APIs. We use [Crypto](https://nodejs.org/dist/latest-v12.x/docs/api/crypto.html) in Node.js, and use [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) in Browsers.\n\n- [PBKDF2](https://tools.ietf.org/html/rfc2898), [SHA256](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf) is used to derive keys, We use [AES256-CBC](https://csrc.nist.gov/publications/detail/sp/800-38a/final) to encrypt and decrypt data, we also use [HMAC](https://csrc.nist.gov/csrc/media/publications/fips/198/1/final/documents/fips-198-1_final.pdf) to verify message authentication codes to make sure the posts are decrypted well and not modified.\n\n- Promise is widely used to make sure our main procedures are asynchronous, so that there is little chance for the process to be blocked, and the experience will be more fluent.\n\n- Template theme supported, you can use [`default`, `blink`, `flip`, `shrink`, `surge`, `up`, `wave`, `xray`] to set up your template theme, and [CHECK ONLINE](https://mhexo.github.io/tags/ThemeTests/).\n\n- Outdated browsers may not work well. In such case, please upgrade your browser.\n\n## Online demo\n\n- See [Demo Page](https://mhexo.github.io/), **all passwords are `hello`**.\n\n## Install\n\n- `npm install --save hexo-blog-encrypt`\n\n- or `yarn add hexo-blog-encrypt` (require [Yarn](https://yarnpkg.com/en/))\n\n## Quick start\n\n- Add the \"password\" value to your post's front matter like:\n\n```markdown\n\n---\ntitle: Hello World\ndate: 2016-03-30 21:18:02\npassword: hello\n---\n\n```\n\n- Then use `hexo clean \u0026\u0026 hexo g \u0026\u0026 hexo s` to see your encrypted post locally.\n\n## Password Priority\n\npost's front matter \u003e encrypt tags\n\n## Advanced settings\n\n### in post's front matter\n\n```markdown\n\n---\ntitle: Hello World\ntags:\n- encryptAsDiary\ndate: 2016-03-30 21:12:21\npassword: mikemessi\nabstract: Here's something encrypted, password is required to continue reading.\nmessage: Hey, password is required here.\nwrong_pass_message: Oh, this is an invalid password. Check and try again, please.\nwrong_hash_message: Oh, these decrypted content cannot be verified, but you can still have a look.\n---\n\n```\n\n### In `_config.yml`\n\n#### Example\n\n```yaml\n# Security\nencrypt: # hexo-blog-encrypt\n  abstract: Here's something encrypted, password is required to continue reading.\n  message: Hey, password is required here.\n  tags:\n  - {name: encryptAsDiary, password: passwordA}\n  - {name: encryptAsTips, password: passwordB}\n  wrong_pass_message: Oh, this is an invalid password. Check and try again, please.\n  wrong_hash_message: Oh, these decrypted content cannot be verified, but you can still have a look.\n\n```\n\n#### To disable tag encryption\n\nJust set the `password` property in front matter to `\"\"`.\n\nExample:\n\n```\n---\ntitle: Callback Test\ndate: 2019-12-21 11:54:07\ntags:\n    - A Tag should be encrypted\npassword: \"\"\n---\n\nUse a \"\" to disable tag encryption.\n```\n\n### Config priority\n\npost's front matter \u003e `_config.yml` (in the root directory) \u003e default\n\n### About Callback\nIn some blogs, some elements may not be displayed normally after decryption. This is a known issue. The current solution is to check the code in your blog to learn which functions are called when the onload event occurs.\nThen write these code at the end of your post. For example:\n\n```\n---\ntitle: Callback Test\ndate: 2019-12-21 11:54:07\ntags:\n    - Encrypted\n---\n\nThis is a blog to test Callback functions. You just need to add code at the end of your post as follows:\n\nIt will be called after the blog is decrypted.\n\n\u003cscript\u003e\n    // add script tag and code at the end of your post\n    alert(\"Hello World\");\n\u003c/script\u003e\n```\n\nDemo: [Callback Example](https://mhexo.github.io/2020/12/06/Callback-Test/).\n\n### After Decrypt Event\nThanks to @[f-dong](https://github.com/f-dong), we now will trigger a event named `hexo-blog-decrypt`, so you can add a call back to listen to that event.\n\n```\n// trigger event\nvar event = new Event('hexo-blog-decrypt');\nwindow.dispatchEvent(event);\n```\n\n### Encrypt TOC\n\nIf you has a post with TOC, you should change the code of your template. Take the default theme 'landscape' as an example:\n\n+ You should find the `article.ejs` file located at `hexo/themes/landscape/layout/_partial/article.ejs`.\n+ Find the code like \u003c% post.content %\u003e, which is usually at line 30.\n+ Replace the \u003c% post.content %\u003e with the following code block:\n\n```\n\u003c% if(post.toc == true){ %\u003e\n  \u003cdiv id=\"toc-div\" class=\"toc-article\" \u003c% if (post.encrypt == true) { %\u003estyle=\"display:none\" \u003c% } %\u003e\u003e\n    \u003cstrong class=\"toc-title\"\u003eIndex\u003c/strong\u003e\n      \u003c% if (post.encrypt == true) { %\u003e\n        \u003c%- toc(post.origin, {list_number: true}) %\u003e\n      \u003c% } else { %\u003e\n        \u003c%- toc(post.content, {list_number: true}) %\u003e\n      \u003c% } %\u003e\n  \u003c/div\u003e\n\u003c% } %\u003e\n\u003c%- post.content %\u003e\n```\n\n### Disable logging\nIf you want to disable the logging, you can add a silent property in `_config.yml` and set it to true.\n\n```yaml\n# Security\nencrypt: # hexo-blog-encrypt\n  silent: true\n```\n\nThis would disable the logging like `INFO  hexo-blog-encrypt: encrypting \"{Blog Name}\" based on Tag: \"EncryptedTag\".`.\n\n### Encrypt Theme\nPreviously, we use `template` to let users modify their own themes. Turn out that it's not a simple way. So, we are introducing this feature here.\n\nYou can simply use `theme` in `_config.yml` or in header like:\n\n#### In post's front matter\n\n```markdown\n---\ntitle: Theme test\ndate: 2019-12-21 11:54:07\ntags:\n    - A Tag should be encrypted\ntheme: xray\npassword: \"hello\"\n---\n```\n\n#### In `_config.yml`\n\nThis would be a default one.\n\n```yaml\n# Security\nencrypt: # hexo-blog-encrypt\n  abstract: Here's something encrypted, password is required to continue reading.\n  message: Hey, password is required here.\n  tags:\n  - {name: encryptAsDiary, password: passwordA}\n  - {name: encryptAsTips, password: passwordB}\n  theme: xray\n  wrong_pass_message: Oh, this is an invalid password. Check and try again, please.\n  wrong_hash_message: Oh, these decrypted content cannot be verified, but you can still have a look.\n\n```\n\nCheck them online, and PICK one:\n\n+ [default](https://mhexo.github.io/2020/12/23/Theme-Test-Default/)\n+ [blink](https://mhexo.github.io/2020/12/23/Theme-Test-Blink/)\n+ [shrink](https://mhexo.github.io/2020/12/23/Theme-Test-Shrink/)\n+ [flip](https://mhexo.github.io/2020/12/23/Theme-Test-Flip/)\n+ [up](https://mhexo.github.io/2020/12/23/Theme-Test-Up/)\n+ [surge](https://mhexo.github.io/2020/12/23/Theme-Test-Surge/)\n+ [wave](https://mhexo.github.io/2020/12/23/Theme-Test-Wave/)\n+ [xray](https://mhexo.github.io/2020/12/23/Theme-Test-Xray/)\n\n\n## License\n\nSee [LICENSE](./LICENSE) file.\n\n## Thanks\n\nCollaborator - [xiazeyu](https://github.com/xiazeyu)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FD0n9X1n%2Fhexo-blog-encrypt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FD0n9X1n%2Fhexo-blog-encrypt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FD0n9X1n%2Fhexo-blog-encrypt/lists"}