How to use the keytar.findCredentials function in keytar

To help you get started, we’ve selected a few keytar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dracan / tomatoad / src / main / slack / slack.main.js View on Github external
loadAuthTokens: function(successCallback) {
        keytar.findCredentials("Tomatoad_Slack").then(creds => {
            _authTokens = {}

            let remaining = creds.length

            if(creds.length === 0) {
                successCallback()
            }

            creds.forEach(cred => {
                // Note that I'm re-looking up the password using getPassword rather than just
                // using the cred.password field because of this bug ...
                // https://github.com/atom/node-keytar/issues/96
                // Once released, I can remove the getPassword call and just use cred.password.

                keytar.getPassword("Tomatoad_Slack", cred.account).then(pw => {
                    _authTokens[cred.account] = pw;
github shanehofstetter / youtrack-cli / src / utils / credentialStore.ts View on Github external
public static set(username: string, password: string): Promise {
        return keytar.findCredentials(SERVICE_NAME).then((credentials) => {
            return Promise.all(credentials.map((credential) => {
                keytar.deletePassword(SERVICE_NAME, credential.account);
            })).then(() => {
                return keytar.setPassword(SERVICE_NAME, username, password);
            });
        }).catch(() => {
            return keytar.setPassword(SERVICE_NAME, username, password);
        });
    }
github mskims / genie-music-player / index.js View on Github external
function clearCredentials() {
    return keytar.findCredentials(KEYTAR_SERVICE_NAME).then(credentials => {
        credentials.map(credential => {
            keytar.deletePassword(KEYTAR_SERVICE_NAME, credential.account)
        })
    })
}
github alexcroox / jira-timer-menubar / main / keychain.js View on Github external
async getCredentials () {
    try {
      const credentials = await keychain.findCredentials(keychainService)

      if (!credentials || !credentials.length)
        throw 'No credentials yet'

      log.info('Set credentials')

      this.authKey = credentials[0].password
      this.baseUrl = credentials[0].account

      this.credentials = credentials[0]

      return credentials[0]
    } catch (error) {
      return error
    }
  }
github shanehofstetter / youtrack-cli / src / utils / credentialStore.ts View on Github external
public static get(): Promise {
        return keytar.findCredentials(SERVICE_NAME).then((credentials) => {
            if (credentials.length > 0) {
                return credentials[0];
            }
            return null;
        });
    }
github iotaledger / trinity-wallet / src / desktop / native / preload / Electron.js View on Github external
listKeychain: () => {
        return keytar.findCredentials(KEYTAR_SERVICE);
    },
github Yamazaki93 / MetroGit / app / infrastructure / secure.js View on Github external
function clearCache() {
    return keytar.findCredentials(app).then(creds => {
        let reqs = [];
        creds.forEach((c) => {
            reqs.push(keytar.deletePassword(app, c.account));
        });
        return Promise.all(reqs);
    }).catch(err => {
        window.webContents.send('Secure-ClearCacheFailed', { error: 'GENERIC', detail: err });
    });
}
github fatihacet / CoinTop / src / renderer / services / credentials.js View on Github external
async getCredentials() {
    return keytar.findCredentials(APP_NAME);
  },
  async removeCredential(exchange) {

keytar

Bindings to native Mac/Linux/Windows password APIs

MIT
Latest version published 3 years ago

Package Health Score

58 / 100
Full package analysis