Client
Defined in: sdks/js/browser-sdk/src/Client.ts:76
Client for interacting with the XMTP network
Type Parameters
Section titled “Type Parameters”ContentTypes
Section titled “ContentTypes”ContentTypes = ExtractCodecContentTypes
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Client<
ContentTypes>(options?):Client<ContentTypes>
Defined in: sdks/js/browser-sdk/src/Client.ts:103
Creates a new XMTP client instance
This class is not intended to be initialized directly.
Use Client.create or Client.build instead.
Parameters
Section titled “Parameters”options?
Section titled “options?”Optional configuration for the client
Returns
Section titled “Returns”Client<ContentTypes>
Accessors
Section titled “Accessors”accountIdentifier
Section titled “accountIdentifier”Get Signature
Section titled “Get Signature”get accountIdentifier():
Identifier|undefined
Defined in: sdks/js/browser-sdk/src/Client.ts:297
Gets the account identifier for this client
Returns
Section titled “Returns”Identifier | undefined
appVersion
Section titled “appVersion”Get Signature
Section titled “Get Signature”get appVersion():
string|undefined
Defined in: sdks/js/browser-sdk/src/Client.ts:346
Gets the app version used by the client
Returns
Section titled “Returns”string | undefined
conversations
Section titled “conversations”Get Signature
Section titled “Get Signature”get conversations():
Conversations<ContentTypes>
Defined in: sdks/js/browser-sdk/src/Client.ts:318
Gets the conversations manager for this client
Returns
Section titled “Returns”Conversations<ContentTypes>
debugInformation
Section titled “debugInformation”Get Signature
Section titled “Get Signature”get debugInformation():
DebugInformation
Defined in: sdks/js/browser-sdk/src/Client.ts:325
Gets the debug information helpers for this client
Returns
Section titled “Returns”Get Signature
Section titled “Get Signature”get env():
string|undefined
Defined in: sdks/js/browser-sdk/src/Client.ts:353
Gets the label used for the default database file name
Returns
Section titled “Returns”string | undefined
inboxId
Section titled “inboxId”Get Signature
Section titled “Get Signature”get inboxId():
string|undefined
Defined in: sdks/js/browser-sdk/src/Client.ts:290
Gets the inbox ID associated with this client
Returns
Section titled “Returns”string | undefined
installationId
Section titled “installationId”Get Signature
Section titled “Get Signature”get installationId():
string|undefined
Defined in: sdks/js/browser-sdk/src/Client.ts:304
Gets the installation ID for this client
Returns
Section titled “Returns”string | undefined
installationIdBytes
Section titled “installationIdBytes”Get Signature
Section titled “Get Signature”get installationIdBytes():
Uint8Array<ArrayBufferLike> |undefined
Defined in: sdks/js/browser-sdk/src/Client.ts:311
Gets the installation ID bytes for this client
Returns
Section titled “Returns”Uint8Array<ArrayBufferLike> | undefined
isReady
Section titled “isReady”Get Signature
Section titled “Get Signature”get isReady():
boolean
Defined in: sdks/js/browser-sdk/src/Client.ts:283
Gets whether the client has been initialized
Returns
Section titled “Returns”boolean
libxmtpVersion
Section titled “libxmtpVersion”Get Signature
Section titled “Get Signature”get libxmtpVersion():
string|undefined
Defined in: sdks/js/browser-sdk/src/Client.ts:339
Gets the version of libxmtp used in the bindings
Returns
Section titled “Returns”string | undefined
options
Section titled “options”Get Signature
Section titled “Get Signature”get options():
ClientOptions|undefined
Defined in: sdks/js/browser-sdk/src/Client.ts:269
Gets the client options
Returns
Section titled “Returns”ClientOptions | undefined
preferences
Section titled “preferences”Get Signature
Section titled “Get Signature”get preferences():
Preferences
Defined in: sdks/js/browser-sdk/src/Client.ts:332
Gets the preferences manager for this client
Returns
Section titled “Returns”signer
Section titled “signer”Get Signature
Section titled “Get Signature”get signer():
Signer|undefined
Defined in: sdks/js/browser-sdk/src/Client.ts:276
Gets the signer associated with this client
Returns
Section titled “Returns”Signer | undefined
Methods
Section titled “Methods”archiveMetadata()
Section titled “archiveMetadata()”archiveMetadata(
data,key):Promise<ArchiveMetadata>
Defined in: sdks/js/browser-sdk/src/Client.ts:927
Load the metadata for an archive to see what it contains
Parameters
Section titled “Parameters”Uint8Array
The archive data as bytes
Uint8Array
Encryption key for the archive
Returns
Section titled “Returns”Promise<ArchiveMetadata>
Promise that resolves with the archive metadata
canMessage()
Section titled “canMessage()”canMessage(
identifiers):Promise<Map<string,boolean>>
Defined in: sdks/js/browser-sdk/src/Client.ts:728
Checks if the client can message the specified identifiers
Parameters
Section titled “Parameters”identifiers
Section titled “identifiers”The identifiers to check
Returns
Section titled “Returns”Promise<Map<string, boolean>>
Whether the client can message the identifiers
changeRecoveryIdentifier()
Section titled “changeRecoveryIdentifier()”changeRecoveryIdentifier(
identifier):Promise<void>
Defined in: sdks/js/browser-sdk/src/Client.ts:696
Changes the recovery identifier for the client’s inbox
Requires a signer, use Client.create to create a client with a signer.
Parameters
Section titled “Parameters”identifier
Section titled “identifier”The new recovery identifier
Returns
Section titled “Returns”Promise<void>
Throws
Section titled “Throws”if no signer is available
close()
Section titled “close()”close():
Promise<void>
Defined in: sdks/js/browser-sdk/src/Client.ts:173
Shutdown the client
Returns
Section titled “Returns”Promise<void>
createArchive()
Section titled “createArchive()”createArchive(
key,opts?):Promise<Uint8Array<ArrayBufferLike>>
Defined in: sdks/js/browser-sdk/src/Client.ts:894
Export archive data to bytes for later restoration
Parameters
Section titled “Parameters”Uint8Array
Encryption key for the archive
Archive options specifying what to include (defaults to consent and messages)
Returns
Section titled “Returns”Promise<Uint8Array<ArrayBufferLike>>
Promise that resolves with the archive data as bytes
fetchInboxIdByIdentifier()
Section titled “fetchInboxIdByIdentifier()”fetchInboxIdByIdentifier(
identifier):Promise<string|undefined>
Defined in: sdks/js/browser-sdk/src/Client.ts:808
Fetches the inbox ID for a given identifier from the local database If not found, fetches from the network
Parameters
Section titled “Parameters”identifier
Section titled “identifier”The identifier to look up
Returns
Section titled “Returns”Promise<string | undefined>
The inbox ID, if found
fetchKeyPackageStatuses()
Section titled “fetchKeyPackageStatuses()”fetchKeyPackageStatuses(
installationIds):Promise<Map<string,KeyPackageStatus>>
Defined in: sdks/js/browser-sdk/src/Client.ts:868
Fetches the key package statuses from the network for the specified installation IDs
Parameters
Section titled “Parameters”installationIds
Section titled “installationIds”string[]
The installation IDs to check
Returns
Section titled “Returns”Promise<Map<string, KeyPackageStatus>>
The key package statuses
fetchLatestInboxUpdatesCount()
Section titled “fetchLatestInboxUpdatesCount()”fetchLatestInboxUpdatesCount(
inboxIds):Promise<Map<string,number>>
Defined in: sdks/js/browser-sdk/src/Client.ts:738
Fetches the latest inbox updates count for the specified inbox IDs
Parameters
Section titled “Parameters”inboxIds
Section titled “inboxIds”string[]
The inbox IDs to check
Returns
Section titled “Returns”Promise<Map<string, number>>
Map of inbox IDs to their updates count
fetchOwnInboxUpdatesCount()
Section titled “fetchOwnInboxUpdatesCount()”fetchOwnInboxUpdatesCount():
Promise<number>
Defined in: sdks/js/browser-sdk/src/Client.ts:754
Fetches the latest inbox updates count for the client’s inbox
Returns
Section titled “Returns”Promise<number>
The latest inbox updates count
importArchive()
Section titled “importArchive()”importArchive(
data,key):Promise<void>
Defined in: sdks/js/browser-sdk/src/Client.ts:913
Import an archive from bytes
Parameters
Section titled “Parameters”Uint8Array
The archive data as bytes
Uint8Array
Encryption key for the archive
Returns
Section titled “Returns”Promise<void>
Promise that resolves when the archive is imported
init()
Section titled “init()”init(
identifier):Promise<void>
Defined in: sdks/js/browser-sdk/src/Client.ts:145
Initializes the client with the provided identifier
This is not meant to be called directly.
Use Client.create or Client.build instead.
Parameters
Section titled “Parameters”identifier
Section titled “identifier”The identifier to initialize the client with
Returns
Section titled “Returns”Promise<void>
isRegistered()
Section titled “isRegistered()”isRegistered():
Promise<boolean>
Defined in: sdks/js/browser-sdk/src/Client.ts:718
Checks if the client is registered with the XMTP network
Returns
Section titled “Returns”Promise<boolean>
Whether the client is registered
refreshServerConfiguration()
Section titled “refreshServerConfiguration()”refreshServerConfiguration():
Promise<ServerConfiguration>
Defined in: sdks/js/browser-sdk/src/Client.ts:973
Fetches the backend configuration now and rewrites the stored copy (CFG-082)
The snapshot this client holds is unchanged; a new value takes effect at the next build.
Returns
Section titled “Returns”Promise<ServerConfiguration>
The configuration that was fetched
register()
Section titled “register()”register():
Promise<void>
Defined in: sdks/js/browser-sdk/src/Client.ts:513
Registers the client with the XMTP network
Requires a signer, use Client.create to create a client with a signer.
Returns
Section titled “Returns”Promise<void>
Throws
Section titled “Throws”if no signer is available
removeAccount()
Section titled “removeAccount()”removeAccount(
identifier):Promise<void>
Defined in: sdks/js/browser-sdk/src/Client.ts:597
Removes an account from the client’s inbox
Requires a signer, use Client.create to create a client with a signer.
Parameters
Section titled “Parameters”identifier
Section titled “identifier”The identifier of the account to remove
Returns
Section titled “Returns”Promise<void>
Throws
Section titled “Throws”if no signer is available
revokeAllOtherInstallations()
Section titled “revokeAllOtherInstallations()”revokeAllOtherInstallations():
Promise<void>
Defined in: sdks/js/browser-sdk/src/Client.ts:621
Revokes all other installations of the client’s inbox
Requires a signer, use Client.create to create a client with a signer.
Returns
Section titled “Returns”Promise<void>
Throws
Section titled “Throws”if no signer is available
revokeInstallations()
Section titled “revokeInstallations()”revokeInstallations(
installationIds):Promise<void>
Defined in: sdks/js/browser-sdk/src/Client.ts:651
Revokes specific installations of the client’s inbox
Requires a signer, use Client.create to create a client with a signer.
Parameters
Section titled “Parameters”installationIds
Section titled “installationIds”Uint8Array<ArrayBufferLike>[]
The installation IDs to revoke
Returns
Section titled “Returns”Promise<void>
Throws
Section titled “Throws”if no signer is available
serverConfiguration()
Section titled “serverConfiguration()”serverConfiguration():
ServerConfiguration
Defined in: sdks/js/browser-sdk/src/Client.ts:957
Gets what the backend published about itself, as resolved when this client was built (CFG-080)
A worker action cannot be synchronous, so the snapshot is captured from the init result and answered from the main thread. A refresh rewrites the stored copy; it never changes this value.
Returns
Section titled “Returns”The configuration snapshot this client holds
Throws
Section titled “Throws”if the client is not initialized
signWithInstallationKey()
Section titled “signWithInstallationKey()”signWithInstallationKey(
signatureText):Promise<Uint8Array<ArrayBufferLike>>
Defined in: sdks/js/browser-sdk/src/Client.ts:818
Signs a message with the installation key
Parameters
Section titled “Parameters”signatureText
Section titled “signatureText”string
The text to sign
Returns
Section titled “Returns”Promise<Uint8Array<ArrayBufferLike>>
The signature
syncAllDeviceSyncGroups()
Section titled “syncAllDeviceSyncGroups()”syncAllDeviceSyncGroups():
Promise<GroupSyncSummary>
Defined in: sdks/js/browser-sdk/src/Client.ts:942
Manually sync all device sync groups
Returns
Section titled “Returns”Promise<GroupSyncSummary>
Promise that resolves with a summary of the sync operation
unsafe_addAccount()
Section titled “unsafe_addAccount()”unsafe_addAccount(
newAccountSigner,allowInboxReassign?):Promise<void>
Defined in: sdks/js/browser-sdk/src/Client.ts:554
Adds a new account to the client inbox
WARNING: This function should be used with caution. Adding a wallet already associated with an inbox ID will cause the wallet to lose access to that inbox.
The allowInboxReassign parameter must be true to reassign an inbox
already associated with a different account.
Requires a signer, use Client.create to create a client with a signer.
Parameters
Section titled “Parameters”newAccountSigner
Section titled “newAccountSigner”The signer for the new account
allowInboxReassign?
Section titled “allowInboxReassign?”boolean = false
Whether to allow inbox reassignment
Returns
Section titled “Returns”Promise<void>
Throws
Section titled “Throws”if no signer is available
Throws
Section titled “Throws”if allowInboxReassign is false
Throws
Section titled “Throws”if the account is already associated with an inbox ID
unsafe_addAccountSignatureText()
Section titled “unsafe_addAccountSignatureText()”unsafe_addAccountSignatureText(
newIdentifier,allowInboxReassign?):Promise<{signatureRequestId:string;signatureText:string; }>
Defined in: sdks/js/browser-sdk/src/Client.ts:388
Creates signature text for adding a new account to the client’s inbox
WARNING: This function should be used with caution. It is only provided for use in special cases where the provided workflows do not meet the requirements of an application.
It is highly recommended to use the unsafe_addAccount method instead.
Parameters
Section titled “Parameters”newIdentifier
Section titled “newIdentifier”The identifier of the new account
allowInboxReassign?
Section titled “allowInboxReassign?”boolean = false
Whether to allow inbox reassignment
Returns
Section titled “Returns”Promise<{ signatureRequestId: string; signatureText: string; }>
The signature text and signature request ID
Throws
Section titled “Throws”if allowInboxReassign is false
unsafe_applySignatureRequest()
Section titled “unsafe_applySignatureRequest()”unsafe_applySignatureRequest(
signer,signatureRequestId):Promise<void>
Defined in: sdks/js/browser-sdk/src/Client.ts:496
Applies a signature request to the client
WARNING: This function should be used with caution. It is only provided for use in special cases where the provided workflows do not meet the requirements of an application.
It is highly recommended to use the register, unsafe_addAccount,
removeAccount, revokeAllOtherInstallations, revokeInstallations,
or changeRecoveryIdentifier method instead.
Parameters
Section titled “Parameters”signer
Section titled “signer”The signer to use
signatureRequestId
Section titled “signatureRequestId”string
The ID of the signature request to apply
Returns
Section titled “Returns”Promise<void>
unsafe_changeRecoveryIdentifierSignatureText()
Section titled “unsafe_changeRecoveryIdentifierSignatureText()”unsafe_changeRecoveryIdentifierSignatureText(
identifier):Promise<{signatureRequestId:string;signatureText:string; }>
Defined in: sdks/js/browser-sdk/src/Client.ts:475
Creates signature text for changing the recovery identifier for this client’s inbox
WARNING: This function should be used with caution. It is only provided for use in special cases where the provided workflows do not meet the requirements of an application.
It is highly recommended to use the changeRecoveryIdentifier method instead.
Parameters
Section titled “Parameters”identifier
Section titled “identifier”The new recovery identifier
Returns
Section titled “Returns”Promise<{ signatureRequestId: string; signatureText: string; }>
The signature text and signature request ID
unsafe_createInboxSignatureText()
Section titled “unsafe_createInboxSignatureText()”unsafe_createInboxSignatureText():
Promise<{signatureRequestId?:string;signatureText?:string; }>
Defined in: sdks/js/browser-sdk/src/Client.ts:368
Creates signature text for creating a new inbox
WARNING: This function should be used with caution. It is only provided for use in special cases where the provided workflows do not meet the requirements of an application.
It is highly recommended to use the register method instead.
Returns
Section titled “Returns”Promise<{ signatureRequestId?: string; signatureText?: string; }>
The signature text and signature request ID
unsafe_removeAccountSignatureText()
Section titled “unsafe_removeAccountSignatureText()”unsafe_removeAccountSignatureText(
identifier):Promise<{signatureRequestId:string;signatureText:string; }>
Defined in: sdks/js/browser-sdk/src/Client.ts:414
Creates signature text for removing an account from the client’s inbox
WARNING: This function should be used with caution. It is only provided for use in special cases where the provided workflows do not meet the requirements of an application.
It is highly recommended to use the removeAccount method instead.
Parameters
Section titled “Parameters”identifier
Section titled “identifier”The identifier of the account to remove
Returns
Section titled “Returns”Promise<{ signatureRequestId: string; signatureText: string; }>
The signature text and signature request ID
unsafe_revokeAllOtherInstallationsSignatureText()
Section titled “unsafe_revokeAllOtherInstallationsSignatureText()”unsafe_revokeAllOtherInstallationsSignatureText():
Promise<{signatureRequestId:string;signatureText:string|undefined; }>
Defined in: sdks/js/browser-sdk/src/Client.ts:433
Creates signature text for revoking all other installations of the client’s inbox
WARNING: This function should be used with caution. It is only provided for use in special cases where the provided workflows do not meet the requirements of an application.
It is highly recommended to use the revokeAllOtherInstallations method instead.
Returns
Section titled “Returns”Promise<{ signatureRequestId: string; signatureText: string | undefined; }>
The signature text and signature request ID
unsafe_revokeInstallationsSignatureText()
Section titled “unsafe_revokeInstallationsSignatureText()”unsafe_revokeInstallationsSignatureText(
installationIds):Promise<{signatureRequestId:string;signatureText:string; }>
Defined in: sdks/js/browser-sdk/src/Client.ts:455
Creates signature text for revoking specific installations of the client’s inbox
WARNING: This function should be used with caution. It is only provided for use in special cases where the provided workflows do not meet the requirements of an application.
It is highly recommended to use the revokeInstallations method instead.
Parameters
Section titled “Parameters”installationIds
Section titled “installationIds”Uint8Array<ArrayBufferLike>[]
The installation IDs to revoke
Returns
Section titled “Returns”Promise<{ signatureRequestId: string; signatureText: string; }>
The signature text and signature request ID
verifySignedWithInstallationKey()
Section titled “verifySignedWithInstallationKey()”verifySignedWithInstallationKey(
signatureText,signatureBytes):Promise<boolean>
Defined in: sdks/js/browser-sdk/src/Client.ts:831
Verifies a signature was made with the installation key
Parameters
Section titled “Parameters”signatureText
Section titled “signatureText”string
The text that was signed
signatureBytes
Section titled “signatureBytes”Uint8Array
The signature bytes to verify
Returns
Section titled “Returns”Promise<boolean>
Whether the signature is valid
verifySignedWithPublicKey()
Section titled “verifySignedWithPublicKey()”verifySignedWithPublicKey(
signatureText,signatureBytes,publicKey):Promise<boolean>
Defined in: sdks/js/browser-sdk/src/Client.ts:849
Verifies a signature was made with a public key
Parameters
Section titled “Parameters”signatureText
Section titled “signatureText”string
The text that was signed
signatureBytes
Section titled “signatureBytes”Uint8Array
The signature bytes to verify
publicKey
Section titled “publicKey”Uint8Array
The public key to verify against
Returns
Section titled “Returns”Promise<boolean>
Whether the signature is valid
build()
Section titled “build()”
staticbuild<ContentCodecs>(identifier,options):Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>
Defined in: sdks/js/browser-sdk/src/Client.ts:243
Creates a new client instance with an identifier
Clients created with this method must already be registered. Any methods called that require a signer will throw an error.
Type Parameters
Section titled “Type Parameters”ContentCodecs
Section titled “ContentCodecs”ContentCodecs extends ContentCodec[] = []
Parameters
Section titled “Parameters”identifier
Section titled “identifier”The identifier to use
options
Section titled “options”DistributiveOmit<ClientOptions, "codecs"> & object
Optional configuration for the client
Returns
Section titled “Returns”Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>
A new client instance
canMessage()
Section titled “canMessage()”
staticcanMessage(identifiers,optionsOrBackend):Promise<Map<string,boolean>>
Defined in: sdks/js/browser-sdk/src/Client.ts:759
Check identifiers with an explicit backend or network options.
Parameters
Section titled “Parameters”identifiers
Section titled “identifiers”optionsOrBackend
Section titled “optionsOrBackend”Returns
Section titled “Returns”Promise<Map<string, boolean>>
create()
Section titled “create()”
staticcreate<ContentCodecs>(signer,options):Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>
Defined in: sdks/js/browser-sdk/src/Client.ts:208
Creates a new client instance with a signer
Type Parameters
Section titled “Type Parameters”ContentCodecs
Section titled “ContentCodecs”ContentCodecs extends ContentCodec[] = []
Parameters
Section titled “Parameters”signer
Section titled “signer”The signer to use for authentication
options
Section titled “options”DistributiveOmit<ClientOptions, "codecs"> & object
Optional configuration for the client
Returns
Section titled “Returns”Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>
A new client instance
fetchInboxStates()
Section titled “fetchInboxStates()”
staticfetchInboxStates(inboxIds,optionsOrBackend):Promise<InboxState[]>
Defined in: sdks/js/browser-sdk/src/Client.ts:680
Fetch inbox states with an explicit backend or network options.
Parameters
Section titled “Parameters”inboxIds
Section titled “inboxIds”string[]
optionsOrBackend
Section titled “optionsOrBackend”Returns
Section titled “Returns”Promise<InboxState[]>
fetchLatestInboxUpdatesCount()
Section titled “fetchLatestInboxUpdatesCount()”
staticfetchLatestInboxUpdatesCount(inboxIds,optionsOrBackend):Promise<Map<string,number>>
Defined in: sdks/js/browser-sdk/src/Client.ts:776
Fetch inbox update counts with an explicit backend or network options.
Parameters
Section titled “Parameters”inboxIds
Section titled “inboxIds”string[]
optionsOrBackend
Section titled “optionsOrBackend”Returns
Section titled “Returns”Promise<Map<string, number>>
fetchServerConfiguration()
Section titled “fetchServerConfiguration()”
staticfetchServerConfiguration(optionsOrUrl):Promise<ServerConfiguration>
Defined in: sdks/js/browser-sdk/src/Client.ts:990
Reads a backend’s configuration with no database, no client, and no credential (CFG-081)
Parameters
Section titled “Parameters”optionsOrUrl
Section titled “optionsOrUrl”string | NetworkOptions
The backend URL, or network options carrying it
Returns
Section titled “Returns”Promise<ServerConfiguration>
The configuration the backend publishes
revokeInstallations()
Section titled “revokeInstallations()”
staticrevokeInstallations(signer,inboxId,installationIds,optionsOrBackend):Promise<void>
Defined in: sdks/js/browser-sdk/src/Client.ts:669
Revoke installations with an explicit backend or network options.
Parameters
Section titled “Parameters”signer
Section titled “signer”inboxId
Section titled “inboxId”string
installationIds
Section titled “installationIds”Uint8Array<ArrayBufferLike>[]
optionsOrBackend
Section titled “optionsOrBackend”Returns
Section titled “Returns”Promise<void>

