Merge pull request #33639 from queeniema/update-keytar

Update keytar typings for v4.4.1
This commit is contained in:
Gabriela Britto
2019-03-08 13:22:32 -08:00
committed by GitHub
2 changed files with 19 additions and 5 deletions
+16 -4
View File
@@ -1,6 +1,9 @@
// Type definitions for keytar 4.0.2
// Type definitions for keytar 4.4.1
// Project: http://atom.github.io/node-keytar/
// Definitions by: Milan Burda <https://github.com/miniak>, Brendan Forster <https://github.com/shiftkey>, Hari Juturu <https://github.com/juturu>
// Definitions by: Milan Burda <https://github.com/miniak>
// Brendan Forster <https://github.com/shiftkey>
// Hari Juturu <https://github.com/juturu>
// Queenie Ma <https://github.com/queeniema>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -15,7 +18,7 @@
export declare function getPassword(service: string, account: string): Promise<string | null>;
/**
* Add the password for the service and account to the keychain.
* Save the password for the service and account to the keychain. Adds a new entry if necessary, or updates an existing entry if one exists.
*
* @param service The string service name.
* @param account The string account name.
@@ -36,7 +39,16 @@ export declare function setPassword(service: string, account: string, password:
export declare function deletePassword(service: string, account: string): Promise<boolean>;
/**
* Find a password for the service in the keychain.
* Find all accounts and password for the service in the keychain.
*
* @param service The string service name.
*
* @returns A promise for the credentials array.
*/
export declare function findCredentials(service: string): Promise<Array<{ account: string, password: string }>>;
/**
* Find a password for the service in the keychain. This is ideal for scenarios where an account is not required.
*
* @param service The string service name.
*
+3 -1
View File
@@ -8,6 +8,8 @@ let success: Promise<boolean>;
success = keytar.deletePassword('keytar-tests', 'username');
let password: Promise<string | null>;
password = keytar.findPassword('keytar-tests');
password = keytar.getPassword('keytar-tests', 'username');
let credentials: Promise<Array<{ account: string, password: string }>>;
credentials = keytar.findCredentials('keytar-tests');