/* auto-generated by NAPI-RS */ /* eslint-disable */ export declare class AsyncEntry { /** * Create an entry for the given service and username. * * The default credential builder is used. * * An optional [EntryOptions] bag controls platform-specific behavior; it is * accepted on all platforms but currently only used on Linux, where it can * pin the entry to a specific credential store. */ constructor(service: string, username: string, options?: EntryOptions | undefined | null) /** * Create an entry for the given target, service, and username. * * The default credential builder is used. * * An optional [EntryOptions] bag controls platform-specific behavior; it is * accepted on all platforms but currently only used on Linux, where it can * pin the entry to a specific credential store. */ static withTarget(target: string, service: string, username: string, options?: EntryOptions | undefined | null): 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 /** * Set the secret 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. */ setSecret(secret: Uint8Array, signal?: AbortSignal | undefined | null): Promise /** * Retrieve the password saved for this entry. * * Returns no password 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 /** * Retrieve the secret saved for this entry. * * Returns no secret if there isn't one. * * Rejects if the credential store cannot be read, for example when it is * locked or inaccessible. * * Can reject with 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. */ getSecret(signal?: AbortSignal | undefined | null): Promise /** * Delete the underlying credential for this entry. * * Resolves `true` if a credential was deleted, and `false` if there was no * credential to delete. * * Rejects if the credential exists but could not be deleted, for example * when the store is locked or inaccessible. A failed deletion is never * reported as `false`, so a `false` result always means the credential is * absent from the store. * * Can reject with 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. * * Note: This does _not_ affect the lifetime of the [Entry] * structure, which is controlled by Rust. It only * affects the underlying credential store. */ deleteCredential(signal?: AbortSignal | undefined | null): Promise /** Alias for `deleteCredential` */ deletePassword(signal?: AbortSignal | undefined | null): Promise } export declare class Entry { /** * Create an entry for the given service and username. * * The default credential builder is used. * * An optional [EntryOptions] bag controls platform-specific behavior; it is * accepted on all platforms but currently only used on Linux, where it can * pin the entry to a specific credential store. */ constructor(service: string, username: string, options?: EntryOptions | undefined | null) /** * Create an entry for the given target, service, and username. * * The default credential builder is used. * * An optional [EntryOptions] bag controls platform-specific behavior; it is * accepted on all platforms but currently only used on Linux, where it can * pin the entry to a specific credential store. */ static withTarget(target: string, service: string, username: string, options?: EntryOptions | undefined | null): 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 /** * Set the secret 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. */ setSecret(secret: Uint8Array): void /** * Retrieve the password saved for this entry. * * Returns no password 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 /** * Retrieve the secret saved for this entry. * * Returns no secret if there isn't one. * * Throws if the credential store cannot be read, for example when it is * locked or inaccessible. * * Can throw 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. */ getSecret(): Array | null /** * Delete the underlying credential for this entry. * * Returns `true` if a credential was deleted, and `false` if there was no * credential to delete. * * Throws if the credential exists but could not be deleted, for example * when the store is locked or inaccessible. A failed deletion is never * reported as `false`, so a `false` result always means the credential is * absent from the store. * * Can throw 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. * * Note: This does _not_ affect the lifetime of the [Entry] * structure, which is controlled by Rust. It only * affects the underlying credential store. */ deleteCredential(): boolean /** Alias for `deleteCredential` */ deletePassword(): boolean } export interface Credential { account: string password: string } /** * Options for creating an `Entry` or `AsyncEntry`. * * All options are platform-specific: they are accepted on every platform but * only take effect where documented. Leaving an option absent keeps the * current default behavior. */ export interface EntryOptions { /** Linux-only options; ignored on other platforms. */ linux?: LinuxEntryOptions } /** find credentials by service name */ export declare function findCredentials(service: string, target?: string | undefined | null): Array /** find credentials by service name */ export declare function findCredentialsAsync(service: string, target?: string | undefined | null, signal?: AbortSignal | undefined | null): Promise> /** Linux-only entry options; ignored on other platforms. */ export interface LinuxEntryOptions { /** * Require a specific Linux credential store. When absent, the default * auto-fallback selection is used (Secret Service, falling back to the * kernel keyring). Requiring a store that is unavailable throws instead of * falling back. */ store?: LinuxStore } /** * A Linux credential store that entries can be pinned to. * * Linux only; ignored on other platforms. Requiring a store that is * unavailable on this machine throws instead of falling back. */ export type LinuxStore = 'secret-service' | 'keyutils'