Closed T0nio closed 1 year ago
Thanks! :)
To keep the core pagecrypt library small, I'd prefer to let users of pagecrypt to handle cases like this with a custom script or build process.
For your use case, I'd suggest you use the pagecrypt JS API to encrypt the pages you need to protect with the same password.
Here's an example of how this can look like: https://github.com/Greenheart/svelte-encrypted-spa/blob/main/scripts/postbuild.js
To make it work with multiple files, you could run await encrypt(inputFile, outputFile, password)
multiple times and changing inputFile
and outputFile
for each file, while keeping password
the same for all files.
Basically
// Assuming you want to overwrite the raw HTML files with the encrypted output.
// If not, change the destination file path to output somewhere else.
const inputFiles = {
'build/index.html': 'build/index.html',
'build/page2.html': 'build/page2.html',
}
const PASSWORD = 'ash33dug1k23hkjasflg12g3jhasgduy213haisf'
await Promise.all(inputFiles.map(inputFile => encrypt(inputFile, inputFile, PASSWORD)))
Good luck! :smile:
Hello !
Thanks for that project ! (: I use it to protect a simple static site with 2 pages. So I encrypt the 2 pages by executing
pagecrypt
twice with the same password. But when I browse to the pages, it asks me the password in every page. If I understand well, it's because there is one key saved in the SessionStore, and I have two keys for the same password.Would it be possible to either:
Thanks for your help (: A