Type alias Web5ConnectOptions

Web5ConnectOptions: {
    agent?: Web5Agent;
    agentVault?: HdIdentityVault;
    connectedDid?: string;
    didCreateOptions?: DidCreateOptions;
    password?: string;
    recoveryPhrase?: string;
    registration?: {
        onFailure: ((error) => void);
        onSuccess: (() => void);
    };
    sync?: string;
    techPreview?: TechPreviewOptions;
    walletConnectOptions?: ConnectOptions;
}

Optional overrides that can be provided when calling Web5.connect.

Type declaration

  • Optional agent?: Web5Agent

    Provide a Web5Agent implementation. Defaults to creating a local Web5UserAgent if one isn't provided

  • Optional agentVault?: HdIdentityVault

    Provide an instance of a HdIdentityVault implementation. Defaults to a LevelDB-backed store with an insecure, static unlock password if one isn't provided. To allow the app user to enter a secure password of their choosing, provide an initialized HdIdentityVault instance.

  • Optional connectedDid?: string

    Specify an existing DID to connect to.

  • Optional didCreateOptions?: DidCreateOptions

    Override defaults configured options for creating a DID during connect. See DidCreateOptions for available options.

  • Optional password?: string

    The Web5 app password is used to protect data on the device the application is running on.

    Only the end user should know this password: it should not be stored on the device or transmitted over the network.

    This password is crucial for the security of an identity vault that stores the local Agent's cryptographic keys and decentralized identifier (DID). The vault's content is encrypted using the password, making it accessible only to those who know the password.

    App users should be advised to use a strong, unique passphrase that is not shared across different services or applications. The password should be kept confidential and not be exposed to unauthorized entities. Losing the password may result in irreversible loss of access to the vault's contents.

  • Optional recoveryPhrase?: string

    The recoveryPhrase is a unique, secure key for recovering the identity vault.

    This phrase is a series of 12 words generated securely and known only to the user. It plays a critical role in the security of the identity vault by enabling the recovery of the vault's contents, including cryptographic keys and the Agent's decentralized identifier (DID), across different devices or if the original device is compromised or lost.

    The recovery phrase is akin to a master key, as anyone with access to this phrase can restore and access the vault's contents. It’s combined with the app password to encrypt the vault's content.

    Unlike a password, the recovery phrase is not intended for regular use but as a secure backup method for vault recovery. Losing this phrase can result in permanent loss of access to the vault's contents, as it cannot be reset or retrieved if forgotten.

    Users should treat the recovery phrase with the highest level of security, ensuring it is never shared, stored online, or exposed to potential threats. It is the user's responsibility to keep this phrase safe to maintain the integrity and accessibility of their secured data. It is recommended to write it down and store it in a secure location, separate from the device and digital backups.

  • Optional registration?: {
        onFailure: ((error) => void);
        onSuccess: (() => void);
    }

    If the registration option is provided, the agent DID and the connected DID will be registered with the DWN endpoints provided by techPreview or didCreateOptions.

    If registration fails, the onFailure callback will be called with the error. If registration is successful, the onSuccess callback will be called.

    • onFailure: ((error) => void)

      Called when any of the DWN registrations fail

        • (error): void
        • Parameters

          • error: any

          Returns void

    • onSuccess: (() => void)

      Called when all of the DWN registrations are successful

        • (): void
        • Returns void

  • Optional sync?: string

    Enable synchronization of DWN records between local and remote DWNs. Sync defaults to running every 2 minutes and can be set to any value accepted by ms(). To disable sync set to 'off'.

  • Optional techPreview?: TechPreviewOptions

    Override defaults configured during the technical preview phase. See TechPreviewOptions for available options.

  • Optional walletConnectOptions?: ConnectOptions

    When specified, external wallet connect flow is triggered. This param currently will not work in apps that are currently connected. It must only be invoked at registration with a reset and empty DWN and agent.