nwjs / nw.js

Call all Node.js modules directly from DOM/WebWorker and enable a new way of writing applications with all Web technologies.
https://nwjs.io
MIT License
40.3k stars 3.88k forks source link

DPAPI or something similar #8207

Open jssuttles opened 3 weeks ago

jssuttles commented 3 weeks ago

Issue Type

Before opening an issue, please search and see if it has already been raised.

Please use our mailing list or Gitter chatroom to ask questions. The issue tracker is only for bugs and feature requests, in English only. Please note that issues without a repro or code snippet are less likely to be resolved.

Current/Missing Behavior

I'm looking for something that will be able to encrypt and decrypt data for a machine. I see that electron has something like https://www.electronjs.org/docs/latest/api/safe-storage. I've tried incorporating keytar (which is archived) or @azure/msal-node-extensions (https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/extensions/msal-node-extensions). The latter was promising, but I couldn't get nwjs to run it. I was able to get it running in a node.js environment, but when I tried to get it to run using nwjs, it would stall out. When I tried to create a fork in nwjs into node.js, it also failed to load.

Expected/Proposed Behavior

There is a way to encrypt and decrypt data using something like DPAPI for windows.

Additional Info

ayushmanchhabra commented 3 weeks ago

If MSAL runs in Node, it should run in NW.js. You'll have to rebuild the native modules using NW.js's Node headers.

node-gyp rebuild --target=22.2.0 --nodedir=path/to/nw/node/headers

Using 22.2.0 since nw version is 0.89.0

ayushmanchhabra commented 2 weeks ago

https://github.com/nodejs/node-gyp?tab=readme-ov-file#build-for-third-party-nodejs-runtimes node-gyp has supported third party runtimes for a while. NW.js v0.89.0 uses Node v22.2.0. node-gyp v10 should be compatible with it but I haven't personally tried it out.