StatiCrypt
Password protect a static HTML page, decrypted in-browser
README
StatiCrypt
🌱 Supporting: If you want to support StatiCrypt development you can do so by clicking on the sponsor button. See how donations are used. Thank you!
<a href="https://github.com/sponsors/robinmoisson"><img src="https://user-images.githubusercontent.com/5664025/234358001-65dfb967-19ab-49da-a8f5-27deca92ceb1.png" alt="Sponsor" /></a>
CLI
Installation
- ```bash
- npm install staticrypt
- ```
Examples
These examples will create a .staticrypt.json file in the current directory, see the FAQ as to why. You can prevent it by setting the--config flag to "false".
- ```bash
- # this will prompt you for the password, which won't stay in your terminal command history
- staticrypt test.html
- # you can also pass the password as an argument
- staticrypt test.html -p <long-password>
- ```
- ```bash
- # the password is in the STATICRYPT_PASSWORD env variable, you won't be prompted
- staticrypt test.html
- ```
- ```bash
- # this will encrypt test_A.html and test_B.html
- staticrypt test_A.html test_B.html
- # => encrypted files are in encrypted/test_A.html and encrypted/test_B.html
- # you can also use the -r flag to recursively encrypt all files in a directory
- staticrypt dir_to_encrypt -r
- # => encrypted files are in encrypted/dir_to_encrypt/...
- # if you don't want to include the directory name in the output path, you can use dir_to_encrypt/*
- # instead. `-r` will include potential subdirectories as well
- staticrypt dir_to_encrypt/* -r
- # => encrypted files are in encrypted/...
- ```
- ```bash
- # you can also pass '--share' without specifying the URL to get the `#staticrypt_pwd=...`
- staticrypt test.html --share https://example.com/encrypted.html
- # => https://example.com/encrypted.html#staticrypt_pwd=5bfbf1343c7257cd7be23ecd74bb37fa2c76d041042654f358b6255baeab898f
- ```
- ```bash
- # either commit the .staticrypt.json config file - you can generate a random salt and
- # config file on your local machine with:
- staticrypt --salt
- # or hardcode the salt in the encryption command in the CI script:
- staticrypt test.html --salt 12345678901234567890123456789012
- ```
- ```bash
- # use your own custom template
- staticrypt test.html -t my/own/password_template.html
- # or customize the default template
- staticrypt test.html --template-color-primary "#fd45a4" --template-title "My custom title" --template-instructions "To unlock this file, you should..." ...
- ```
- ```bash
- staticrypt encrypted/test.html --decrypt
- # => decrypted file is in decrypted/test.html
- ```
CLI Reference
HOW STATICRYPT WORKS
FAQ
Is it secure?
Can I customize the password prompt?
Can I support multiple users with different passwords?
Why doesn't StatiCrypt work in HTTP?
Why does StatiCrypt create a config file?
How does the "Remember me" checkbox work?
"Logging out"
Encrypting multiple pages
Is the "Remember me" checkbox secure?
Can I remove the "Remember me" checkbox?
Contributing
🙏 Thank you!
Opening PRs and issues
Security
Guidelines to contributing
Source map
Build
- ```
- npm install
- npm run build
- ```