/* auto-generated by NAPI-RS */
/* eslint-disable */
export declare namespace autofill {
  /** Response for the lock status of the desktop client. */
  export interface LockStatusResponse {
    /** Whether the desktop client is unlocked. */
    isUnlocked: boolean
  }
  /**
   * Store native desktop status information to use for IPC communication
   * between the application and the credential provider.
   */
  export interface NativeStatus {
    key: string
    value: string
  }
  /** Request to assert a credential. */
  export interface PasskeyAssertionRequest {
    /** Relying Party ID for the request. */
    rpId: string
    /** SHA-256 hash of the `clientDataJSON` for the assertion request. */
    clientDataHash: Array<number>
    /** User verification preference. */
    userVerification: UserVerification
    /** Details about the window of the WebAuthn client. */
    clientWindow: WindowDetails
    /** List of allowed credential IDs. */
    allowedCredentials: Array<Array<number>>
    /**
     * Native context required for callbacks to the OS. Format differs on the OS.
     * # Operating System Differences
     *
     * ## macOS
     * A UUID representing the request.
     *
     * ## Windows
     * On Windows, this is a base64-string representing the following data:
     * `request transaction id (GUID, 16 bytes) || SHA-256(pluginOperationRequest)`
     * The hash is required to be passed back to the OS when calling the
     * Windows Hello passkey user verification API.
     */
    context: string
  }
  /** Response for a passkey assertion request. */
  export interface PasskeyAssertionResponse {
    /** Relying Party ID. */
    rpId: string
    /** The user ID for the credential that was previously given to the OS. */
    userHandle: Array<number>
    /** The signature for the WebAuthn attestation response. */
    signature: Array<number>
    /** SHA-256 hash of the `clientDataJSON` used in the assertion. */
    clientDataHash: Array<number>
    /** The WebAuthn authenticator data structure. */
    authenticatorData: Array<number>
    /** The ID for the attested credential. */
    credentialId: Array<number>
  }
  /** Request to assert a credential without user interaction. */
  export interface PasskeyAssertionWithoutUserInterfaceRequest {
    /** Relying Party ID. */
    rpId: string
    /** SHA-256 hash of the `clientDataJSON` for the assertion request. */
    clientDataHash: Array<number>
    /** User verification preference. */
    userVerification: UserVerification
    /** Details about the window of the WebAuthn client. */
    clientWindow: WindowDetails
    /** The allowed credential ID for the request. */
    credentialId: Array<number>
    /** The user name for the credential that was previously given to the OS. */
    userName?: string
    /** The user ID for the credential that was previously given to the OS. */
    userHandle?: Array<number>
    /**
     * The app-specific local identifier for the credential, in our case, the
     * cipher ID.
     */
    recordIdentifier?: string
    /**
     * Native context required for callbacks to the OS. Format differs on the OS.
     * # Operating System Differences
     *
     * ## macOS
     * A UUID representing the request.
     *
     * ## Windows
     * On Windows, this is `request transaction id () || SHA-256(pluginOperationRequest)`.
     * The hash is required to be passed back to the OS when calling the
     * Windows Hello passkey user verification API.
     */
    context: string
  }
  /** Request to create a credential. */
  export interface PasskeyRegistrationRequest {
    /** Relying Party ID for the request. */
    rpId: string
    /** SHA-256 hash of the `clientDataJSON` for the registration request. */
    clientDataHash: Array<number>
    /** User verification preference. */
    userVerification: UserVerification
    /** Details about the window of the WebAuthn client. */
    clientWindow: WindowDetails
    /** The user name for the credential that was previously given to the OS. */
    userName: string
    /** The user ID for the credential that was previously given to the OS. */
    userHandle: Array<number>
    /** Supported key algorithms in COSE format. */
    supportedAlgorithms: Array<number>
    /** List of excluded credential IDs. */
    excludedCredentials: Array<Array<number>>
    /**
     * Native context required for callbacks to the OS. Format differs by OS.
     * # Operating System Differences
     *
     * ## macOS
     * A UUID representing the request.
     *
     * ## Windows
     * On Windows, this is a base64-string representing the following data:
     * `request transaction id (GUID, 16 bytes) || SHA-256(pluginOperationRequest)`
     * The hash is required to be passed back to the OS when calling the
     * Windows Hello passkey user verification API.
     */
    context: string
  }
  /** Response for a passkey registration request. */
  export interface PasskeyRegistrationResponse {
    /** Relying Party ID. */
    rpId: string
    /** SHA-256 hash of the `clientDataJSON` used in the registration. */
    clientDataHash: Array<number>
    /** The ID for the created credential. */
    credentialId: Array<number>
    /** WebAuthn attestation object. */
    attestationObject: Array<number>
  }
  /** Coordinates representing a point on the screen. */
  export interface Position {
    x: number
    y: number
  }
  /** User verification preference for WebAuthn requests. */
  export const enum UserVerification {
    Preferred = 'preferred',
    Required = 'required',
    Discouraged = 'discouraged'
  }
  /** Details about a native window. */
  export interface WindowDetails {
    /**
     * Coordinates of the center of the window, relative to
     * the top-left point on the screen.
     * # Operating System Differences
     *
     * ## macOS
     * Note that macOS APIs gives points relative to the bottom-left point on the
     * screen by default, so the y-coordinate will be flipped.
     *
     * ## Windows
     * On Windows, this must be logical pixels, not physical pixels.
     */
    position: Position
    /**
     * Byte string representing the native OS window handle.
     * # Operating System Differences
     *
     * ## macOS
     * Unused.
     *
     * ## Windows
     * On Windows, this is a HWND.
     */
    handle?: Array<number>
  }
  /** Response to window handle request. */
  export interface WindowHandleQueryResponse {
    /** Whether the desktop client is currently visible. */
    isVisible: boolean
    /** Whether the desktop client is currently focused. */
    isFocused: boolean
    /**
     * Byte string representing the native OS window handle for the desktop client.
     * # Operating System Differences
     *
     * ## macOS
     * Unused.
     *
     * ## Windows
     * On Windows, this is a HWND.
     */
    handle: Array<number>
  }
}
export declare namespace autofill {
  export class AutofillIpcServer {
    /**
     * Create and start the IPC server without blocking.
     *
     * @param name The endpoint name to listen on. This name uniquely identifies the IPC
     * connection and must be the same for both the server and client. @param callback
     * The functions that will be called whenever a message of the
     * corresponding type is received from a client.
     */
    static listen(name: string, callbacks: AutofillIpcCallbacks): Promise<AutofillIpcServer>
    /** Return the path to the IPC server. */
    getPaths(): Array<string>
    /** Stop the IPC server. */
    stop(): void
    completeRegistration(clientId: number, sequenceNumber: number, response: PasskeyRegistrationResponse): number
    completeAssertion(clientId: number, sequenceNumber: number, response: PasskeyAssertionResponse): number
    completeLockStatus(clientId: number, sequenceNumber: number, response: LockStatusResponse): number
    completeWindowHandleQuery(clientId: number, sequenceNumber: number, response: WindowHandleQueryResponse): number
    completeError(clientId: number, sequenceNumber: number, error: string): number
  }
  export interface AutofillIpcCallbacks {
    /**
     * Function to execute when a passkey registration request is received.
     *
     * The `context` field should be stored, as the cancel_request_callback
     * will use the same value to identify the request to be cancelled.
     */
  registrationCallback: { (error: null, clientId: number, sequenceNumber: number, message: PasskeyRegistrationRequest): void; (error: Error, clientId: number, sequenceNumber: number, message: null): void; }
  /**
   * Function to execute when a passkey assertion request is received.
   *
   * The `context` field should be stored, as the cancel_request_callback
   * will use the same value to identify the request to be cancelled.
   */
  assertionCallback: { (error: null, clientId: number, sequenceNumber: number, message: PasskeyAssertionRequest): void; (error: Error, clientId: number, sequenceNumber: number, message: null): void; }
  /**
   * Function to execute when a passkey assertion request is received and the UI must not be
   * shown.
   *
   * The `context` field should be stored, as the cancel_request_callback
   * will use the same value to identify the request to be cancelled.
   */
  assertionWithoutUserInterfaceCallback: { (error: null, clientId: number, sequenceNumber: number, message: PasskeyAssertionWithoutUserInterfaceRequest): void; (error: Error, clientId: number, sequenceNumber: number, message: null): void; }
  /** Function to execute when a notification of the autofill provider's status is received. */
  nativeStatusCallback: { (error: null, clientId: number, sequenceNumber: number, message: NativeStatus): void; (error: Error, clientId: number, sequenceNumber: number, message: null): void; }
  /** Function to execute to retrieve the lock status of the vault. */
  lockStatusCallback: { (error: null, clientId: number, sequenceNumber: number): void; (error: Error, clientId: number, sequenceNumber: number, message: null): void; }
  /** Function to execute to retrieve the native OS window handle of the main application. */
  windowHandleQueryCallback: { (error: null, clientId: number, sequenceNumber: number): void; (error: Error, clientId: number, sequenceNumber: number, message: null): void; }
  /**
   * Function to cancel a request. The `message` parameter is the context
   * string that was passed on the initial request.
   */
  cancelRequestCallback: { (error: null, clientId: number, sequenceNumber: number, message: string): void; (error: Error, clientId: number, sequenceNumber: number, message: null): void; }
  }
  export function runCommand(value: string): Promise<string>
}

export declare namespace autostart {
  export interface AutostartConfig {
    execPath: string
    autostartFlag: string
  }
  export function setAutostart(enabled: boolean, config: AutostartConfig): Promise<void>
}

export declare namespace autotype_mvp {
  export function getForegroundWindowTitle(): string
  export function typeInput(input: Array<number>, keyboardShortcut: Array<string>): void
}

export declare namespace biometrics {
  export class BiometricLockSystem {

  }
  export function authenticate(biometricLockSystem: BiometricLockSystem, hwnd: Buffer, message: string): Promise<boolean>
  export function authenticateAvailable(biometricLockSystem: BiometricLockSystem): Promise<boolean>
  export function enrollPersistent(biometricLockSystem: BiometricLockSystem, userId: string, key: Buffer): Promise<void>
  export function hasPersistent(biometricLockSystem: BiometricLockSystem, userId: string): Promise<boolean>
  export function initBiometricSystem(): BiometricLockSystem
  export function provideKey(biometricLockSystem: BiometricLockSystem, userId: string, key: Buffer): Promise<void>
  export function unenroll(biometricLockSystem: BiometricLockSystem, userId: string): Promise<void>
  export function unlock(biometricLockSystem: BiometricLockSystem, userId: string, hwnd: Buffer): Promise<Buffer>
  export function unlockAvailable(biometricLockSystem: BiometricLockSystem, userId: string): Promise<boolean>
}

export declare namespace chromium_importer {
  export function getAvailableProfiles(browser: string, masBuild: boolean): Promise<Array<ProfileInfo>>
  /** Returns OS aware metadata describing supported Chromium based importers as a JSON string. */
  export function getMetadata(masBuild: boolean): Record<string, NativeImporterMetadata>
  export function importLogins(browser: string, profileId: string, masBuild: boolean): Promise<Array<LoginImportResult>>
  export interface Login {
    url: string
    username: string
    password: string
    note: string
  }
  export interface LoginImportFailure {
    url: string
    username: string
    error: string
  }
  export interface LoginImportResult {
    login?: Login
    failure?: LoginImportFailure
  }
  export interface NativeImporterMetadata {
    id: string
    loaders: Array<string>
    instructions: string
  }
  /** Pre-translated picker dialog strings supplied by the renderer. */
  export interface PickerStrings {
    message: string
    expectedLocationLabel: string
    prompt: string
  }
  export interface ProfileInfo {
    id: string
    name: string
  }
  export function requestBrowserAccess(browser: string, pickerStrings: PickerStrings, masBuild: boolean): Promise<void>
}

export declare namespace clipboards {
  export function read(): Promise<string>
  export function write(text: string, password: boolean): Promise<void>
}

export declare namespace ipc {
  export class NativeIpcServer {
    /**
     * Create and start the IPC server without blocking.
     *
     * @param name The endpoint name to listen on. This name uniquely identifies the IPC
     * connection and must be the same for both the server and client. @param callback
     * This function will be called whenever a message is received from a client.
     */
    static listen(name: string, callback: (error: null | Error, message: IpcMessage) => void): Promise<NativeIpcServer>
    /** Return the paths to the IPC server. */
    getPaths(): Array<string>
    /** Stop the IPC server. */
    stop(): void
    /**
     * Send a message over the IPC server to all the connected clients
     *
     * @return The number of clients that the message was sent to. Note that the number of
     * messages actually received may be less, as some clients could disconnect before
     * receiving the message.
     */
    send(message: string): number
    /** Send a message to a specific connected client by ID. */
    sendTo(clientId: number, message: string): void
  }
  export interface IpcMessage {
    clientId: number
    kind: IpcMessageType
    message?: string
  }
  export const enum IpcMessageType {
    Connected = 0,
    Disconnected = 1,
    Message = 2
  }
}

export declare namespace logging {
  export function initNapiLog(jsLogFn: ((err: Error | null, arg0: LogLevel, arg1: string) => any)): void
  export const enum LogLevel {
    Trace = 0,
    Debug = 1,
    Info = 2,
    Warn = 3,
    Error = 4
  }
}

export declare namespace passkey_authenticator {
  export function register(): void
}

export declare namespace passwords {
  /**
   * Delete the stored password from the keychain.
   * Throws {@link Error} with message {@link PASSWORD_NOT_FOUND} if the password does not exist.
   */
  export function deletePassword(service: string, account: string): Promise<void>
  /**
   * Fetch the stored password from the keychain.
   * Throws {@link Error} with message {@link PASSWORD_NOT_FOUND} if the password does not exist.
   */
  export function getPassword(service: string, account: string): Promise<string>
  /** Checks if the os secure storage is available */
  export function isAvailable(): Promise<boolean>
  /** The error message returned when a password is not found during retrieval or deletion. */
  export const PASSWORD_NOT_FOUND: string
  /**
   * Save the password to the keychain. Adds an entry if none exists otherwise updates the
   * existing entry.
   */
  export function setPassword(service: string, account: string, password: string): Promise<void>
}

export declare namespace powermonitors {
  export function isLockMonitorAvailable(): Promise<boolean>
  export function onLock(callback: ((err: Error | null, ) => any)): Promise<void>
}

export declare namespace processisolations {
  export function disableCoredumps(): Promise<void>
  export function isCoreDumpingDisabled(): Promise<boolean>
  export function isolateProcess(): Promise<void>
}

export declare namespace sshagent {
  export class SshAgentState {

  }
  export function clearKeys(agentState: SshAgentState): void
  export function isRunning(agentState: SshAgentState): boolean
  export function lock(agentState: SshAgentState): void
  export interface PrivateKey {
    privateKey: string
    name: string
    cipherId: string
  }
  export function serve(callback: ((err: Error | null, arg: SshUiRequest) => Promise<boolean>)): Promise<SshAgentState>
  export function setKeys(agentState: SshAgentState, newKeys: Array<PrivateKey>): void
  export interface SshKey {
    privateKey: string
    publicKey: string
    keyFingerprint: string
  }
  export interface SshUiRequest {
    cipherId?: string
    isList: boolean
    processName: string
    isForwarding: boolean
    namespace?: string
  }
  export function stop(agentState: SshAgentState): void
}

export declare namespace sshagent_v2 {
  /** Wrapper for Electron to be able to interface with the agent directly. */
  export class SshAgentState {
    /**
     * Creates a new [`BitwardenSSHAgent`] and starts the server.
     *
     * # Arguments
     *
     * * `sign_callback` - Allows agent to get approval for sign requests
     * * `list_callback` - Allows agent to get approval for list key requests
     */
    static serve(signCallback: ((err: Error | null, arg: SignRequestData) => Promise<boolean>), listCallback: ((err: Error | null, ) => Promise<boolean>)): Promise<SshAgentState>
    stop(): void
    isRunning(): boolean
    replace(newKeys: Array<SshKeyData>): void
  }
  export type SSHAgentState = SshAgentState
  /** SSH public key data */
  export interface PublicKey {
    alg: string
    blob: Array<number>
  }
  /** A sign request's SIG namespace */
  export const enum SIGNamespace {
    Git = 'git',
    File = 'file',
    Unsupported = 'unsupported'
  }
  /** SSH sign request fields. */
  export interface SignRequest {
    publicKey: PublicKey
    processName?: string
    isForwarding: boolean
    namespace?: SIGNamespace
    hostFingerprint?: string
  }
  /** Data for a sign request, including vault cipher context. */
  export interface SignRequestData {
    signRequest: SignRequest
    cipherId?: string
  }
  /** SSH key data, sent from Electron. */
  export interface SshKeyData {
    privateKey: string
    name: string
    cipherId: string
  }
}

export declare namespace windows_registry {
  export function createKey(key: string, subkey: string, value: string): Promise<void>
  export function deleteKey(key: string, subkey: string): Promise<void>
}
