-
-
Notifications
You must be signed in to change notification settings - Fork 433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: Add JS API for leveraging staticrypt in code #195
Comments
Interesting! So basically the idea would be to be able to have a import passwordProtect from 'staticrypt';
const passwordProtectedHtml = passwordProtect(plainTextHtml);
// write on disk, do whatever Something like that? A couple of places that can be used for inspiration are the index_template.html, which shows how to encrypt a file in-browser, or you can check-out how the As I'm writing this I'm realizing it might just be a matter of doing something like const hashedPassword = await cryptoEngine.hashPassword(password, salt);
const passwordProtectedHtml = await codec.init(cryptoEngine).encodeWithHashedPassword(plainTextHtml, hashedPassword); I guess there could be a wrapper with a simpler API if needed. One footgun here is on the salt - the remember-me feature (or auto-decrypt link) is dependent on the salt staying constant if you encrypt the file multiple times. That's why staticrypt generates a .staticrypt.json config file with just the salt by default (see more here). |
That points me in the right direction at least :) I think this project needs more documented samples like this where the functionality I'm looking for technically exists, but it isn't surfaced very well in the existing documentation, and the gotchas (like the salt in I would def be inclined to tinker with your suggestions and formulate some cookbook style snippets to accomplish my goals and submit them back to the project |
I have a plugin based static site generator that I would like to be able to staticrypt with.
It currently uses top-down render pipeline via a series of callbacks similar to Grunt.js, and it would be excellent if there was a JS API I could leverage in my codebase to generate the encrypted artifact.
I have a workaround in mind where I can write a plugin to write the contents to the output path and then encrypt the resulting output document on disk.
Having briefly looked at the codebase, I'm not sure where to start with a PR on this functionality, but I am curious if this is something y'all have considered or roadmapped?
The text was updated successfully, but these errors were encountered: