node-cipher icon indicating copy to clipboard operation
node-cipher copied to clipboard

Webpack loader

Open Ansimorph opened this issue 7 years ago • 2 comments

Hi,

First of all: Thanks for node-cipher. It's a really nice tool!

Because I wanted to keep my file processing logic in webpack and not add it to package.json I ended up writing a small webpack loader that decrypts assets enrcypted by node-cipher: https://github.com/Ansimorph/decryption-loader

Feel free to give me feedback if you see any issues with the decryption process.

Would you mind a PR that adds this option to the tips-section of the documentation?

Ansimorph avatar Nov 05 '18 08:11 Ansimorph

Oh this is neat, thanks! You can also just use the NodeCipher API to decrypt assets that were encrypted via the nodecipher CLI tool instead of messing with crypto. It might not be what you need in this case though, since it expects an input/output file.

~I'd also recommend taking a look at NodeCipher.Defaults. Use these to define the default settings for the decryption loader instead of creating two sources of truth~ Oh, never mind, looks like those aren't publicly accessible :( I'll have to fix that some time

PR's welcome :)

nathanbuchar avatar Nov 07 '18 21:11 nathanbuchar

PR is underway.

I'd love to use your API and delegate all the actual logic to node-cipher, but webpack loaders really shouldn't work directly on the filesystem. Each loader is just a function transforming buffers or strings.

I'll be watching your repo, in case the defaults become public :)

Ansimorph avatar Nov 08 '18 09:11 Ansimorph