diff --git a/docs/components/CustomHomePage.tsx b/docs/components/CustomHomePage.tsx new file mode 100644 index 0000000..0e02561 --- /dev/null +++ b/docs/components/CustomHomePage.tsx @@ -0,0 +1,77 @@ +import React from 'react' + +const Root: React.FC<{ children: React.ReactNode }> = ({ children }) => ( +
{description}
+ {isExternal && } + + ); + +export const CustomHomePage = { + Root, + Headline, + Subhead, + TileGrid, + Tile, +}; \ No newline at end of file diff --git a/docs/pages/chat-widget/chat-widget.md b/docs/pages/chat-widget/chat-widget.md new file mode 100644 index 0000000..79b84c3 --- /dev/null +++ b/docs/pages/chat-widget/chat-widget.md @@ -0,0 +1,19 @@ +--- +description: "Embed a floating inbox chat widget built with XMTP on your website" +--- + +# Embed a floating inbox chat widget built with XMTP + +You can embed a "floating inbox" chat widget built with XMTP on your website. + +You can use one of these floating inbox quickstart example apps to get started: + +- [For JavaScript](https://github.com/xmtp/xmtp-quickstart-reactjs) + +- [With React hooks](https://github.com/xmtp/xmtp-quickstart-hooks) + +- [With Next.js hooks](https://github.com/xmtp/xmtp-quickstart-hooks-next) + +For example, here's a screenshot of the floating inbox chat widget built with the JavaScript quickstart app. You can also try out the [JavaScript quickstart app](https://xmtp-quickstart-reactjs.vercel.app/). + +![Screenshot of the floating inbox chat widget](https://raw.githubusercontent.com/xmtp/docs-xmtp-org/main/docs/pages/img/floating-inbox.png) diff --git a/docs/pages/dms/client.mdx b/docs/pages/client/create-client.mdx similarity index 66% rename from docs/pages/dms/client.mdx rename to docs/pages/client/create-client.mdx index 0969270..0931697 100644 --- a/docs/pages/dms/client.mdx +++ b/docs/pages/client/create-client.mdx @@ -4,31 +4,50 @@ description: Learn how to create and configure an XMTP client # Create and configure an XMTP client -The XMTP message API revolves around a network client that allows retrieving and sending messages to other network participants. A client must be connected to a wallet on startup. The client will request a wallet signature in two cases: - -1. To sign the newly generated key bundle. This happens only the very first time when key bundle is not found in storage. -2. To sign a random salt used to encrypt the key bundle in storage. This happens every time the client is started (including the very first time). +The XMTP message API revolves around a network client that allows retrieving and sending messages to other network participants. ## Create a client -A client is created that requires passing in a connected wallet that implements the Signer interface. +To create an XMTP client, it must be connected to a wallet on startup. You must pass in a connected wallet that implements the Signer interface. This wallet is required for authentication and encryption purposes. + +For more information about wallet signature requests, see [Account signatures](/protocol/signatures). + +Clients created by XMTP v3 SDKs can also support XMTP v2 messages if the wallet is an EOA. At a high-level, XMTP v3 is used to support group chat and XMTP v2 is used to support 1:1 chat. + +In the near future, XMTP v3 will support both group and 1:1 chat with Messaging Layer Security (MLS). Have questions or feedback? Post to the [XMTP Community Forums](https://community.xmtp.org/c/development/58). + +Group chat is currently supported in Kotlin, Swift, React Native, and Node.js. + +In the near future, XMTP v3 will also support group chat for the web. + +For more information about the work being done to support group chat for the web, see this [SQLite, WebAssembly, and Diesel](https://www.youtube.com/watch?v=qnCeXsqqKcY&t=240s) talk in the XMTP Developer Community Call. + +If your mobile app provides group chat, you must explicitly configure your client to enable this functionality by setting the `enableV3` client option to `true`. + +:::tip[Best practice for mobile apps] -[Use client configuration options](#configure-the-client) to change parameters of a client's network connection. +Regardless of whether your mobile app provides group chat, set the `enableV3` client option to `true` to benefit from other aspects of the upgraded XMTP v3 protocol. Enabling v3 doesn't stop your app's support for XMTP v2 functionality. + +::: + +For more information about client options, including how to set your client's network environment, see [client configuration options](#configure-the-client). :::code-group ```ts [JavaScript] import { Client } from "@xmtp/xmtp-js"; + // Create the client with a `Signer` from your application -const xmtp = await Client.create(signer, { env: "dev" }); +const xmtp = await Client.create(signer, { + env: "production", +}); ``` -Parameter | Default | Description | |
---|---|---|---|
appVersion | `undefined` | Add a client app version identifier that's included with API requests. **Production apps are strongly encouraged to set this value.** For example, you can use the following format: `appVersion: APP_NAME + '/' + APP_VERSION`. Setting this value provides telemetry that shows which apps are using the XMTP client SDK. This information can help XMTP developers provide app support, especially around communicating important SDK updates, including deprecations and required upgrades. | |
env | `DEV` | Connect to the specified XMTP network environment. Valid values include `DEV`, `.PRODUCTION`, or `LOCAL`. For important details about working with these environments, see [XMTP `production` and `dev` network environments](#xmtp-network-environments). | |
Parameter | +Default | +Description | +|
env | +`DEV` | +Connect to the specified XMTP network environment. Valid values include `DEV`, `.PRODUCTION`, or `LOCAL`. For important details about working with these environments, see [XMTP production and dev network environments](#xmtp-network-environments). | +|
enableV3 | +`false` | +To support group chat (a feature of XMTP v3), set to `true`. As a best practice, regardless of whether your mobile app provides group chat, set `enableV3` to `true` to benefit from other aspects of the upgraded XMTP v3 protocol. Enabling v3 doesn't stop your app's support for XMTP v2 functionality. | +|
appContext | +null | +Required if `enableV3` is set to `true`. | +|
dbEncryptionKey | +null | +Required 32-byte array for database encryption if `enableV3` is `true`. For information about recommended key storage for Kotlin, [Android Keystore system](https://developer.android.com/privacy-and-security/keystore). | +|
dbDirectory | +xmtp_db | +Optional. Specify a database directory. If no directory is specified, the value is set to `xmtp_db` by default. | +|
appVersion | +`undefined` | +Add a client app version identifier that's included with API requests. Production apps are strongly encouraged to set this value. For example, you can use the following format: `appVersion: APP_NAME + '/' + APP_VERSION`. Setting this value provides telemetry that shows which apps are using the XMTP client SDK. This information can help XMTP developers provide app support, especially around communicating important SDK updates, including deprecations and required upgrades. |
+
Parameter | Default | Description | |
---|---|---|---|
appVersion | `undefined` | Add a client app version identifier that's included with API requests. **Production apps are strongly encouraged to set this value.** For example, you can use the following format: `appVersion: APP_NAME + '/' + APP_VERSION`. Setting this value provides telemetry that shows which apps are using the XMTP client SDK. This information can help XMTP developers provide app support, especially around communicating important SDK updates, including deprecations and required upgrades. | |
env | `dev` | Connect to the specified XMTP network environment. Valid values include `.dev`, `.production`, or `.local`. For important details about working with these environments, see [XMTP `production` and `dev` network environments](#xmtp-network-environments). | |
Parameter | +Default | +Description | +|
env | +`dev` | +Connect to the specified XMTP network environment. Valid values include `.dev`, `.production`, or `.local`. For important details about working with these environments, see [XMTP production and dev network environments](#xmtp-network-environments). | +|
enableV3 | +`false` | +To support group chat (a feature of XMTP v3), set to `true`. As a best practice, regardless of whether your app provides group chat, set `enableV3` to `true` to benefit from other aspects of the upgraded XMTP v3 protocol. Enabling v3 doesn't stop your app's support for XMTP v2 functionality. | +|
dbEncryptionKey | +null | +Required 32-byte array for database encryption if `enableV3` is `true`. For information about recommended key storage for Swift, see [Protecting keys with the Secure Enclave](https://developer.apple.com/documentation/security/protecting-keys-with-the-secure-enclave). | +|
dbDirectory | +xmtp_db | +Optional. Specify a database directory. If no directory is specified, the value is set to `xmtp_db` by default. | +|
appVersion | +`undefined` | +Add a client app version identifier that's included with API requests. Production apps are strongly encouraged to set this value. For example, you can use the following format: `appVersion: APP_NAME + '/' + APP_VERSION`. Setting this value provides telemetry that shows which apps are using the XMTP client SDK. This information can help XMTP developers provide app support, especially around communicating important SDK updates, including deprecations and required upgrades. |
+