@types/keychain
TypeScript icon, indicating that this package has built-in type declarations

1.4.4 • Public • Published

Installation

npm install --save @types/keychain

Summary

This package contains type definitions for keychain (https://github.com/drudge/node-keychain).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/keychain.

index.d.ts

declare namespace keychainTypes {
    interface KeyChainBaseOptions {
        account: string;
        service: string;
        password: string;
        type?: "generic" | "internet";
    }

    type KeychainErrorCodes =
        | "UnsupportedPlatform"
        | "NoAccountProvided"
        | "NoServiceProvided"
        | "NoPasswordProvided"
        | "ServiceFailure"
        | "PasswordNotFound";

    type KeychainErrorType = `${KeychainErrorCodes}Error`;

    class KeychainError extends Error {
        code: KeychainErrorCodes;
        type: KeychainErrorType;
    }
}

declare function getPassword(
    options: Pick<keychainTypes.KeyChainBaseOptions, "account" | "service">,
    callback: (err: keychainTypes.KeychainError, password: string) => void,
): void;

declare function setPassword(
    options: keychainTypes.KeyChainBaseOptions,
    callback?: (err: keychainTypes.KeychainError) => void,
): void;

declare function deletePassword(
    options: Pick<keychainTypes.KeyChainBaseOptions, "account" | "service">,
    callback: (err: keychainTypes.KeychainError) => void,
): void;

declare const keychain: typeof keychainTypes & {
    getPassword: typeof getPassword;
    setPassword: typeof setPassword;
    deletePassword: typeof deletePassword;
};

export = keychain;

Additional Details

  • Last updated: Tue, 07 Nov 2023 09:09:38 GMT
  • Dependencies: none

Credits

These definitions were written by Lucas Santos.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/keychain

Weekly Downloads

1,533

Version

1.4.4

License

MIT

Unpacked Size

5.11 kB

Total Files

5

Last publish

Collaborators

  • types