So it seems that electron has this module called keytar, but the documentation is lacking a lot, and I have no idea how to use it.
https://github.com/atom/node-keytar
My code right now is (in the main process)
const keytar = require('keytar');
...
keytar.setPassword('KeytarTest', 'AccountName', 'secret');
const secret = keytar.getPassword('KeytarTest', 'AccountName');
console.log(secret);
Which prints out
Promise { <pending> }
Could someone teach me how to get the actual password?
Ok so after looking around, I found out the answer. You call the resulting promise and operate on the argument to the promise.
keytar.setPassword('KeytarTest', 'AccountName', 'secret');
const secret = keytar.getPassword('KeytarTest', 'AccountName');
secret.then((result) => {
console.log("result: "+ result); // result will be 'secret'
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With