how to use keytar electron

JavaScript
const keytar = require('keytar');

keytar.setPassword('KeytarTest', 'AccountName', 'secret');

const secret = keytar.getPassword('KeytarTest', 'AccountName');
secret.then((result) => {
    console.log("result: "+ result); // result will be 'secret'
});
Source

Also in JavaScript: