diff --git a/keytar/index.d.ts b/keytar/index.d.ts index 12dbd63316..5a27c0c984 100644 --- a/keytar/index.d.ts +++ b/keytar/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for keytar 3.0.0 +// Type definitions for keytar 3.0.2 // Project: http://atom.github.io/node-keytar/ -// Definitions by: Milan Burda +// Definitions by: Milan Burda , Brendan Forster // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -12,7 +12,7 @@ * * @returns the string password or null on failures. */ -export declare function getPassword(service: string, account: string): string; +export declare function getPassword(service: string, account: string): string | null; /** * Add the password for the service and account to the keychain. @@ -31,9 +31,9 @@ export declare function addPassword(service: string, account: string, password: * @param service The string service name. * @param account The string account name. * - * @returns the string password or null on failures. + * @returns true on success, false on failure */ -export declare function deletePassword(service: string, account: string): string; +export declare function deletePassword(service: string, account: string): boolean; /** * Replace the password for the service and account in the keychain. @@ -56,4 +56,4 @@ export declare function replacePassword(service: string, account: string, passwo * * @returns the string password or null on failures. */ -export declare function findPassword(service: string): string; +export declare function findPassword(service: string): string | null; diff --git a/keytar/keytar-tests.ts b/keytar/keytar-tests.ts index 91a43ebbe9..d523050650 100644 --- a/keytar/keytar-tests.ts +++ b/keytar/keytar-tests.ts @@ -1,8 +1,13 @@ import keytar = require('keytar'); -keytar.addPassword('keytar-tests', 'username', 'password'); -keytar.deletePassword('keytar-tests', 'username'); -keytar.findPassword('keytar-tests'); -keytar.getPassword('keytar-tests', 'username'); -keytar.replacePassword('keytar-tests', 'username', 'password'); +let success: boolean = false; + +success = keytar.addPassword('keytar-tests', 'username', 'password'); +success = keytar.deletePassword('keytar-tests', 'username'); +success = keytar.replacePassword('keytar-tests', 'username', 'password'); + +let password: string = ''; + +password = keytar.findPassword('keytar-tests'); +password = keytar.getPassword('keytar-tests', 'username');