@napi-rs/keyring
Version:
https://github.com/hwchen/keyring-rs Node.js binding via https://napi.rs
110 lines (107 loc) • 3.78 kB
TypeScript
/* tslint:disable */
/* eslint-disable */
/* auto-generated by NAPI-RS */
export interface Credential {
account: string
password: string
}
/** find credentials by service name */
export function findCredentials(service: string): Array<Credential>
/** find credentials by service name */
export function findCredentialsAsync(service: string, signal?: AbortSignal | undefined | null): Promise<Array<Credential>>
export class AsyncEntry {
/**
* Create an entry for the given service and username.
*
* The default credential builder is used.
*/
constructor(service: string, username: string)
/**
* Create an entry for the given target, service, and username.
*
* The default credential builder is used.
*/
static withTarget(service: string, username: string, target: string): AsyncEntry
/**
* Set the password for this entry.
*
* Can return an [Ambiguous](Error::Ambiguous) error
* if there is more than one platform credential
* that matches this entry. This can only happen
* on some platforms, and then only if a third-party
* application wrote the ambiguous credential.
*/
setPassword(password: string, signal?: AbortSignal | undefined | null): Promise<void>
/**
* Retrieve the password saved for this entry.
*
* Returns a [NoEntry](Error::NoEntry) error if there isn't one.
*
* Can return an [Ambiguous](Error::Ambiguous) error
* if there is more than one platform credential
* that matches this entry. This can only happen
* on some platforms, and then only if a third-party
* application wrote the ambiguous credential.
*/
getPassword(signal?: AbortSignal | undefined | null): Promise<string | undefined>
/**
* Delete the password for this entry.
*
* Returns a [NoEntry](Error::NoEntry) error if there isn't one.
*
* Can return an [Ambiguous](Error::Ambiguous) error
* if there is more than one platform credential
* that matches this entry. This can only happen
* on some platforms, and then only if a third-party
* application wrote the ambiguous credential.
*/
deletePassword(signal?: AbortSignal | undefined | null): Promise<boolean>
}
export class Entry {
/**
* Create an entry for the given service and username.
*
* The default credential builder is used.
*/
constructor(service: string, username: string)
/**
* Create an entry for the given target, service, and username.
*
* The default credential builder is used.
*/
static withTarget(service: string, username: string, target: string): Entry
/**
* Set the password for this entry.
*
* Can return an [Ambiguous](Error::Ambiguous) error
* if there is more than one platform credential
* that matches this entry. This can only happen
* on some platforms, and then only if a third-party
* application wrote the ambiguous credential.
*/
setPassword(password: string): void
/**
* Retrieve the password saved for this entry.
*
* Returns a [NoEntry](Error::NoEntry) error if there isn't one.
*
* Can return an [Ambiguous](Error::Ambiguous) error
* if there is more than one platform credential
* that matches this entry. This can only happen
* on some platforms, and then only if a third-party
* application wrote the ambiguous credential.
*/
getPassword(): string | null
/**
* Delete the password for this entry.
*
* Returns a [NoEntry](Error::NoEntry) error if there isn't one.
*
* Can return an [Ambiguous](Error::Ambiguous) error
* if there is more than one platform credential
* that matches this entry. This can only happen
* on some platforms, and then only if a third-party
* application wrote the ambiguous credential.
*/
deletePassword(): boolean
}