diff --git a/docs/spaces/01-Intro-Push-Spaces.mdx b/docs/spaces/01-Intro-Push-Spaces.mdx new file mode 100644 index 0000000000..178fdacbc8 --- /dev/null +++ b/docs/spaces/01-Intro-Push-Spaces.mdx @@ -0,0 +1,286 @@ +--- +id: spaces +title: Intro to Push Spaces +hide_title: true +slug: ./ +displayed_sidebar: pushSpacesSidebar +sidebar_position: 1 +image: "/assets/docs/previews/spaces--intro_to_push_spaces.png" +--- + +# Intro to Push Spaces + +Push Spaces Protocol is a versatile tool that supports decentralized Audio Spaces in a chain-agnostic way and offers diverse use cases for any dApp. It's compatible with both frontend and backend development, allowing easy integration with web applications using frameworks like React or vanilla JavaScript. + + + Introduction | Push Spaces | Push Documentation + + +import { + ItemV, + ItemH, + Span, + Button, + Image, + ModalContainer, + ModalSmall, + ModalMid, + ModalWrapper, + AImp, + ModalMidEqual, +} from "@site/src/css/SharedStyling"; + +## Why Push Spaces? + +Push Spaces brings native multi-wallets audio calling functionality. As a standalone offering or as part of [Push Group Chat](/docs/chat "Techinal documentation on how to integrate Push Chat"). This enables a native, seamless web3 wallet first experience for real time communication and opens up the possibilites for — + +- **Group Audio Calls** without the user going to any other platform +- **Web3 social real time audio group calls** +- **Web3 DAO community calls** +- **Creator economy** via incentivized calls +- **Seamless Web3 gaming** +- **Streaming** + +## How Push Spaces works? + +Push Spaces utilizes [Push Notifications](/docs/notifications) to exchange peer info and intent for connection which is then fed into [WebRTC](https://webrtc.org/ "Learn about WebRCT") for peer to peer connection between all the peers that are connected to each other forming a mesh conenction. + +Three hidden notifications are fired to wallet (initialization, handshake, completion) to enable wallet to wallet calling. Mesh architecture is used to enable multiple wallets joining. All communication from Push Video is signed and validated by a set of nodes, which are together called Push Network. + +## SDKs + + + +{" "} + + + window.open( + "https://github.com/ethereum-push-notification-service/push-sdk", + "_blank", + ) + } +> + + + + Javascript + + + + + + + +{" "} + + + window.open( + "https://github.com/ethereum-push-notification-service/push-sdk", + "_blank", + ) + } +> + + + + React + + + + + + + +{" "} + + + window.open( + "https://github.com/ethereum-push-notification-service/push-sdk", + "_blank", + ) + } +> + + + + React Native + + + + + + + +{" "} + + + window.open( + "https://github.com/ethereum-push-notification-service/push-restapi-dart", + "_blank", + ) + } +> + + + + Dart + + + + + + + +{" "} + + + window.open( + "https://github.com/ethereum-push-notification-service/push-kotlin-sdk", + "_blank", + ) + } +> + + + + Kotlin + + + + + + + +{" "} + + + window.open( + "https://github.com/ethereum-push-notification-service/push-swift-sdk", + "_blank", + ) + } +> + + + + Swift + + + + + + + + diff --git a/docs/spaces/01-build/01-Develop-Get-Started.mdx b/docs/spaces/01-build/01-Develop-Get-Started.mdx new file mode 100644 index 0000000000..a6f41d1293 --- /dev/null +++ b/docs/spaces/01-build/01-Develop-Get-Started.mdx @@ -0,0 +1,371 @@ +--- +id: docs-video-develop-get-started +title: Get Started +hide_title: true +slug: ./get-started +displayed_sidebar: pushSpacesSidebar +sidebar_position: 1 +image: "/assets/docs/previews/docs_spaces_develop--get_started.png" +--- + +# Get started + +Push Spaces provides a web3-native solution for creating and engaging in live audio environments, enabling direct communication between wallets, groups, NFT communities, or conditional (gated) audiences. Leveraging the Push SDK API, it simplifies the complexities involved in authentication, encryption, digital signature, and the streaming of live audio, ensuring a secure and seamless experience. It facilitates the establishment of decentralized audio spaces, empowering users to effortlessly host, join, and interact within the web3 ecosystem. + + + Start Building | Push Spaces | Push Documentation + + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; +import ReactPlayer from "react-player"; +import { + ModalContainer, + ModalSmall, + ModalWrapper, + AImp, +} from "@site/src/css/SharedStyling"; + +## Speed run + +The following speed run is designed to give you a quick overview of usage and demonstrates how Push Spaces can be integrated successfully in minimal lines of code. + + + + +```js + // Import Push SDK & ethers + import { CONSTANTS, PushAPI, TYPES } from '@pushprotocol/restapi'; + import { ethers } from "ethers"; + + // data is a variable that will store the space's latest state + let data: TYPES.SPACE.DATA = CONSTANTS.SPACE.INITIAL_DATA; + + // Function to update the space's state (Internally used by the SDK) + const setData = (fn) => { + data = fn(data); + }; + + // Creating a random signer from a wallet, ideally this is the wallet you will connect + const signer = ethers.Wallet.createRandom(); + + // Initialize wallet user, use 'PROD' instead of 'STAGING' for mainnet apps + const userAlice = await PushAPI.initialize(signer, { + env: CONSTANTS.ENV.STAGING, + }); + + // Let's create a new space + const AliceSpace = await userAlice.space.create("My Cool Space", { + description: "This is a space description", // description of the space + participants: { + listeners: [], // wallet addresses of the listeners, can be empty. You can also add listeners later after creating the space + speakers: [], // wallet addresses of the speakers, can be empty. You can also add speakers later after creating the space + }, + image: "data:image/png;base64,iVBORw0K..", // space icon in base64 format + schedule: { + start: new Date(new Date().getTime() + 5 * 60000); , // start date of the space + }, + }); + + // Initialising the Push Space API + const userAliceSpace = await userAlice.space.initialize({ + onChange: setData, + spaceId: spaceId, // Space ID that you want to join/start + }); + + // Join/Start the space + await userAliceSpace.start(); // Since we are the creator of the space, we will start the space + + // Enable your audio + await userAliceSpace.activateUserAudio(); + + // Toggle your Microphone + await userAliceSpace.current.config({ + audio: !data.connectionData.local.audio, + }); + + // We can use Stream to listen to any latest Space events for the given user (Alice) + const stream = await userAlice.initStream([CONSTANTS.STREAM.SPACE]); + + // Setup listener for latest space events + stream.on(CONSTANTS.STREAM.SPACE, async (data) => { + console.log("Space Event", data); + }); + + // connect the stream + await Stream.connect(); + +``` + + + + +## Installation + + + + +```js +// Install Libraries +npm install @pushprotocol/restapi@latest ethers +``` + + + + +## Quickstart from SDK repos + + + +{" "} + + + window.open( + "https://github.com/ethereum-push-notification-service/push-sdk", + "_blank", + ) + } +> + + + + Javascript + + + + + + + +{" "} + + + window.open( + "https://github.com/ethereum-push-notification-service/push-sdk", + "_blank", + ) + } +> + + + + React + + + + + + + +{" "} + + + window.open( + "https://github.com/ethereum-push-notification-service/push-sdk", + "_blank", + ) + } +> + + + + React Native + + + + + + + +{" "} + + + window.open( + "https://github.com/ethereum-push-notification-service/push-restapi-dart", + "_blank", + ) + } +> + + + + Dart + + + + + + + +{" "} + + + window.open( + "https://github.com/ethereum-push-notification-service/push-kotlin-sdk", + "_blank", + ) + } +> + + + + Kotlin + + + + + + + +{" "} + + + window.open( + "https://github.com/ethereum-push-notification-service/push-swift-sdk", + "_blank", + ) + } +> + + + + Swift + + + + + + + + + +## Workshop Video + + +
+ +## Testing + +### Push SDK playground and full API coverage + +Full API coverage with sample runable code can be found in the examples below: + +- [Push SDK Playground](https://github.com/ethereum-push-notification-service/push-sdk/blob/main/packages/examples/sdk-backend-node/video/index.ts) to checkout abstracted API calls in action. Follow Push SDK playground tutorial for step by step guide. +- [React Components Example](https://github.com/ethereum-push-notification-service/push-sdk/blob/main/packages/examples/sdk-frontend-react/src/app/Video/index.tsx) to checkout frontend components of Push Chat for easy integration in any React app. Follow Push SDK React playground for step by step guide. +- Push SDK React Playground is also hosted live at [https://react-playground.push.org/](https://react-playground.push.org/#/video) diff --git a/docs/spaces/01-build/02-Develop-Initialize-User.mdx b/docs/spaces/01-build/02-Develop-Initialize-User.mdx new file mode 100644 index 0000000000..ae24cf7ed3 --- /dev/null +++ b/docs/spaces/01-build/02-Develop-Initialize-User.mdx @@ -0,0 +1,307 @@ +--- +id: docs-spaces-develop-initialize-user +title: Initialize User +hide_title: true +slug: ./initialize-user +displayed_sidebar: pushSpacesSidebar +sidebar_position: 2 +image: "/assets/docs/previews/docs_spaces_develop--initialize_user.png" +--- + +# Initialize user overview + +Before you can start using Push Spaces, you will need to initialize a user or re-authenticate the user. To do so you will use `PushAPI.initialize` call from `@pushprotocol/restapi` package. + + + Initialize User | Push Spaces | Push Documentation + + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; +import Details from "@theme/Details"; + +## Initialize user API + + + + +```typescript +import { PushAPI, CONSTANTS, TYPES } from "@pushprotocol/restapi"; + +// Initialize wallet user +// PushAPI.initialize(signer, {options?}); +// 'CONSTANTS.ENV.PROD' -> mainnet apps | 'CONSTANTS.ENV.STAGING' -> testnet apps +const userAlice = await PushAPI.initialize(signer, { + env: CONSTANTS.ENV.STAGING, +}); + +// Check for errors in userAlice's initialization and handle them if any +if (userAlice.errors.length > 0) { + // Handle Errors Here +} +``` + + + + +> Note: If a signer is not provided, or if an invalid signer is passed, or the SDK fails to generate or decrypt keys for the signer, the PushAPI will switch to Read mode. + +The function automatically initializes and returns the **Push user profile** object if one doesn't exist for the user or alternatively creates a new profile if the user has not been onboarded to Push network. This profile is used to interact with all function calls moving forward. + +--- + +### Using for Wallet Addresses + +Push supports wallet addresses (EVM, with non-EVM coming soon). Simply passing the signer will ensure that the PushAPI is initialized with address of the wallet (derived by the signer). + +:::tip +Passing **null** in the `signer` enables **Read Only Mode**. Read only mode allows you to use certain APIs that are not sensitive in nature like reading user profile, listing notifications that are not encrypted by the sender, listing chats, etc. +::: + +--- + +### Using for Lens / Cyberconnect / Any NFTs + +Push also supports Lens, Cyberconnect, NFT wallets and any EVM or non-EVM wallets ensuring cross-chain messaging or cross-nft messaging can become a reality. + +You will need to pass the `account` parameter in `options` object while initializing to target them. This will ensure that the PushAPI is initialized for the right account. + +**Example** + +- **NFT profile** - Pass **`nft:{chain_standard}:{nftChainId}:{nftContractAddress}:{nftTokenId}`** +- _`account`_ - `nft:eip155:11155111:0x42af3147f17239341477113484752D5D3dda997B:2:1683058528` + +Read about [supported wallet standards](/docs/chat/supported-wallet-standards) to understand all supported formats for `account` parameter. + +--- + +### Initialize user parameters + +When initializing your user, you can customize the process using several parameters. Here's a breakdown: + +| Param | Type | Sub-Type | Default | Remarks | +| ---------- | ------------------------ | -------------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| _`signer`_ | `SignerType` | - | - | Ethers or Viem Signer. Pass **null** and provide `account` to enable **read only mode** | +| `options` | `PushAPIInitializeProps` | - | - | Optional configuration properties for initializing the PushAPI. | +| - | `options.env` | `ENV` | `staging` | API env - 'prod' or 'staging'. | +| - | `options.progressHook` | `(progress: ProgressHookType) => void` | - | A callback function to receive progress updates during initialization. Expand **Progress Hook Type and Response** dropdown below to learn more | +| - | `options.account` | `string` | - | The [account](/docs/chat/supported-wallet-standards "Push Chat support wallet standards") to associate user with. If not provided, it is derived from signer. | +| - | `options.version` | `string` | `ENC_TYPE_V3` | The [encryption version](/docs/chat/concepts/encryption-version-in-push-chat) to use for the PushAPI. | +| - | `options.versionMeta` | `{ NFTPGP_V1 ?: password: string }` | - | Metadata related to the encryption version, including a password if needed. | +| - | `options.autoUpgrade` | `boolean` | `true` | If `true`, upgrades encryption keys to latest encryption version. | +| - | `options.origin` | `string` | - | Specify origin or source while creating a Push Profile. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+Informs about individual progress stages during user creation / updates if progresshook as a callback function is passed during API call. + +| Param | Type | Subtype | Default | Remarks | +| ---------- | ------------------------ | -------- | ------- | ------------------------------------------------------ | +| `progress` | `object` | - | - | progress object that is passed in the callback | +| - | `Progress.progressId` | `string` | - | Predefined, ID associated with the progress objects | +| - | `Progress.progressTitle` | `string` | - | Predefined, title associated with the progress objects | +| - | `Progress.progressInfo` | `string` | - | Predefined, info associated with the progress objects | +| - | `Progress.level` | `string` | - | Predefined, Level associated with the progress objects | + +_`Progress object details`_ + +| Progress.id | Progress.level | Progress.title | Progress.info | +| ------------------------ | -------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `PUSH-CREATE-01` | `INFO` | Generating Secure Profile Signature | This step is only done for first time users and might take a few seconds. PGP keys are getting generated to provide you with secure yet seamless chat | +| `PUSH-CREATE-02` | `INFO` | Signing Generated Profile | This step is only done for first time users. Please sign the message to continue. | +| `PUSH-CREATE-03` | `INFO` | Encrypting Generated Profile | Encrypting your keys. Please sign the message to continue. | +| `PUSH-CREATE-04` | `INFO` | Syncing Generated Profile | Please sign the message to continue. Steady lads, chat is almost ready! | +| `PUSH-CREATE-05` | `SUCCESS` | Setup Complete | - | +| `PUSH-UPGRADE-01` | `INFO` | `Deprecated` Generating New Profile Signature | Trying to Upgrade Push Chat Keys to latest version. Please sign the message to continue. | +| `PUSH-UPGRADE-02` | `INFO` | Decrypting Old Profile | Trying to Upgrade Push Chat Keys to latest version. Please sign the message to continue. | +| `PUSH-UPGRADE-03` | `INFO` | `Deprecated` Syncing New Profile | Please sign the message to continue. Steady lads, chat is almost ready! | +| `PUSH-UPGRADE-04` | `INFO` | `Deprecated` Decrypting Old Profile | Trying to Upgrade Push Chat Keys to latest version. Please sign the message to continue. | +| `PUSH-UPGRADE-05` | `SUCCESS` | Upgrade Completed, Welcome to Push Chat | - | +| `PUSH-DECRYPT-01` | `INFO` | Decrypting Profile | Please sign the transaction to decrypt profile | +| `PUSH-DECRYPT-02` | `SUCCESS` | Push Profile Unlocked | Unlocking push profile | +| `PUSH-AUTH-UPDATE-01` | `INFO` | Generating New Profile Signature | Trying to Update Push Chat Keys to `VERSION_NUMBER` version. Please sign the message to continue. | +| `PUSH-AUTH-UPDATE-02` | `INFO` | Generating New Encrypted Profile | Encrypting Push Chat Keys with `VERSION_NUMBER` version. Please sign the message to continue. | +| `PUSH-AUTH-UPDATE-03` | `INFO` | Syncing Updated Profile | Please sign the message to continue. Steady lads, chat is almost ready! | +| `PUSH-AUTH-UPDATE-04` | `SUCCESS` | Update Completed, Welcome to Push Chat | - | +| `PUSH-AUTH-UPDATE-05` | `INFO` | Generating New Profile Signature | Trying to Update Push Profile creds. Please sign the message to continue. | +| `PUSH-AUTH-UPDATE-06` | `INFO` | Generating New Profile Signature | Encrypting Push Chat Keys with new creds. Please sign the message to continue. | +| `PUSH-DECRYPT-AUTH-01` | `INFO` | Decrypting Profile Creds | Please sign the transaction to decrypt profile creds. | +| `PUSH-DECRYPT-AUTH-02` | `INFO` | Push Profile Creds Unlocked | Unlocking push profile creds | +| `PUSH-PROFILE-UPDATE-01` | `ERROR` | Syncing Updated Profile | Steady lads, your profile is getting a new look! | +| `PUSH-PROFILE-UPDATE-02` | `SUCCESS` | Profile Update Completed, Welcome to Push Chat | - | +| `PUSH-ERROR-00` | `ERROR` | Non Specific Error | Dynamic error in the following format: `[Push SDK] - API - Error - API [functionName()] -: [Dynamic Error Info]` | +| `PUSH-ERROR-01` | `WARN` | Upgrade Profile Failed | Dynamic warning in the following format: `[Push SDK] - API - Error - API decryptPgpKey() -: [Dynamic Error Info]` | +| `PUSH-ERROR-02` | `ERROR` | Transaction failed | Dynamic warning in the following format: `[Push SDK] - Contract - Error - [Name] -: [Dynamic Error Info]` | + +
+ +
+ +```typescript +{ + { + account: "0xC785989454C958eF0fD343e3E6DcCDf9893a5b02", + channel: Channel { + signer: JsonRpcSigner, + env: 'prod', + guestMode: true, + account: '0xC785989454C958eF0fD343e3E6DcCDf9893a5b02', + info: ƒ, + … + }, + chat: Chat { + account: '0xC785989454C958eF0fD343e3E6DcCDf9893a5b02', + decryptedPgpPvtKey: '-----BEGIN PGP PRIVATE KEY BLOCK-----\n\nxcLYBGQRtHI…nYedYb\n=o4+2\n-----END PGP PRIVATE KEY BLOCK-----\n', + env: 'prod', + signer: JsonRpcSigner, + progressHook: undefined, + … + }, + decryptedPgpPvtKey: "-----BEGIN PGP PRIVATE KEY BLOCK-----\n\nxcLYBGQRtHIBCADWGXf/Ir844r6xG4FIoprXLv8LaekzuEDT1pYckE4TQSub\n6y1pCCF/eMWvUePvWBAgX8cNdBQ96gxnOB0Kxu2wQTWqLQ0PrL9ggF0dNQcQ\nPbPghOOTWwO2h/TKNa9KrhkCh9m9zjQU9o8w4HxOOJ74t8T9OXqYMOXBMSOr\nVw2bnGQfSodZV7PTJUqmA7ap5JwbGcNP9t1/XH87f6HFSgPwgN5u9rgKAwhJ\nFwujZxSJv2IPRNzpDAq/r/C+fgofkV9/kwU3odsKNMJ+REfNOhDVo+nBLHAu\nTloMkc2WSLJDSu9j8sNZPVrpUaa1c7bbxX5fVTXzW+n2/L2xBkWSfy11ABEB\nAAEAB/4jRGu/U85zBOrLis/Xkq1179BkZWxcMChBnPH6P40U3+Ham7lNuWCn\nOlI6CH/G/9ccNhq4bRwefMzRPe2OxmkF5R/9adFieR7HOy3bb048DyXvwIQq\nVE4+xZN9sa0v3JDTGWS1Pt/Waiz5LKldSzdomgDxg4PdyQQ3uCv7f+oGbUW+\ntAFyUW/Fl3g2mN5DIqgImhRRVVcye7PRzbcIvBVXwsjEWxMZU+kMjb6ihGQx\nv8hbHiQ46wOoFSvvRKE4VZZ6p6bLSnsXAM/ANzWGgW4aJZyVevbvJdUxvqBy\nDJRf7NQPGNPFjvYdHLvnb00wb9EKIrFaFTTSTdYJmE3Klj2RBADZ4RU0AMHK\nMrvcDU/MeURpOCO0nNpcPfnMRX+lwMlZznP8ToyPmObg3caMRUt6NQ4S7D9g\n4+1xKAS1/y4LkMy0JttV2gl3stGzvCoZ2LE60TPvjOslOwQWXH1XvrBUIWEC\nTi8Hlq8HQcWDDEjeaR5f0H8nekdxI0SDSBWSrDeIaQQA+48W4rj45Ba8pcnM\nwhQNhrhGJubEg9IWlUiCspPraNFQfXWJ0RJKfkVjs3jVGOwm3eIR6gahr9hp\nOOkzdJG2mYgqUVSsJPB+/Hlx3duEipIb8VtVeZ2zkX2AypQYCBZufET4G6YI\n7AM0O49ixWNqrItPJnbuuOOXlxWRKNRsOy0EAIGRss+zAmq0vGoboWq7IJHG\nTib/FeEetRc2K4fYHSu6qGec2sdKyNUnZW5RCYs8x4cU1/+YaG0GcDD2CJ6F\nQPmiM65/72xcCAaeaPeUD2CRuAZkwXgwuogvGU2qNAMFUs1fWjkUmfl5UJ1g\nbNLr1xXs3l8djD0yDlCS/Cu+B8IZNFfNAMLAigQQAQgAPgWCZBG0cgQLCQcI\nCZApG4QIthENGgMVCAoEFgACAQIZAQKbAwIeARYhBGgybFDK2EulZ5avyikb\nhAi2EQ0aAAA/JQf7B6cVf1OHFncZA/XprZxLLyLbRG3l8nHi8Ujd8IVWavec\ngYbn0zKuRbHvfkNKKXRKYQ3eMpP8s1XRofybhl3J6D5eSPMnw4sxysfteNBo\nPrBZKFCnY4JFzEDGX7XFIFnJ4ZTUcmCp3p0OO86ES3rSG2esmcF/uGUOSf71\nPspNPKWPfFT4EkpMzYsN8khJv6zAqmwYKfz7lCpcef/Wr20kRSN641Z2ZzpV\nhPQYsVpjcIboVZvb2b1lPUw6v6um+c6r4ONgC8HQD8vaC8aozYay9OOf5aDR\nT0CE8hivurA59TE1akvHDLly4F1HIBdShArEO0P7iM2UDZ8enNAloMOM68fC\n1wRkEbRyAQgA3E9cwruXEXB7AwM1Mzs9I8f2BI4xV+CddArdexeC1w/8zI3p\nJUYjZU3QlyAmZs9CYqjWil4CYBXyke+D4WVg7htEU2DykCrW1pqW+YFIXdN5\np6MLOYfPKW7EU4lq1bRC3AnKHa0gz5XrmrU89Z8PmcLVtXeAwHM5M/cnCjHQ\nD3a9W4WiglBgYJCqhMoxNK587WRw6kqzCp6OVBGozGrrmr+Cjy8fbpmHyjzs\ns/8984RTS14TrCS33cTdTbd52R6pAFK3WEDyiJxBfjyZ5UTZlwcpNR84cAWh\neRUg9RNgnBuOwclsdZdMonfMXsUyYJaQKJ4vIbdme1kr31uxVdn/9QARAQAB\nAAf3dTr1qY55z1xp1haGb72Hal5kDzIgAxqjBaDbcCrRCYBR3l2hDuqmbjQH\niVTDKxdjMoB1We0WgB1fm9nz25mH/cGVSduWkLpxGKPfM3kJTrY6PS7uVqEk\n8Y61nqMA17azU8b4rgw0sTb1NW9asKGScEjPim5OP2LWfOhddsE6yMBTVYS5\nhzj3C0aZjqpop3msedl6VJI1bS2mVTORNj0GRez+oqdK9v2qhJ23jPtCsDDH\ncUIBHWEN1L87p7O+mNGnZUelYNT1K5b9AOWa/RR3AAQ0xwiJ7pmYzefPYaeg\nbCLlslpcNZnSBzykVJcwTPsny4fw34ZidKx4htlw3cufBADfj44fDeMpWUO0\n4kBEgwo7gtKJOIJUZ3yaSG/1qVBI+Zde59AyD4CWtUQiQPWTvxBr7TXBJ1ZB\nb8yaLkPKSKZyYzJLGqwY2LgcixAoL+wChzLrbhQbxV4vqhg9e6NpX9QgBZ5v\nxfn5pD4u+lJzjgDhHFCkvr3zX0OJqsn5wjoVkwQA/EcNyzT3iXHAkcRe6wQD\nJUP0m3m1wXicXflFf4NrMrE/NfcBxXCvRBi2QQqWUKi7CJAOhH9hSxQ1MeeR\n9zGKBdLDqjAzaAiQEPsucn0n0IxHEcXgDQSFgo7YCxBwuNpoK2793KL52UFX\n0lIY4RFKLuByXoTEGfj+odn99THLiVcD/31/XDOE4XEBOVxUdGQMtiizDMuA\nNkzsW7R8dhSL09wpUy6lB7hLC14U0uJyHcIKUDTErlPacO6WxoR2HMZKdSPZ\nTBWOugceckw/5Lu38+jLIG1t44u+AsKb5aNKdgJ+vZc+DeLdEYjvoP6upZey\nLFXCEKDc7EhM9G391cqBehSePCjCwHYEGAEIACoFgmQRtHIJkCkbhAi2EQ0a\nApsMFiEEaDJsUMrYS6Vnlq/KKRuECLYRDRoAAKhgB/9mMXoV8YN1RmeyEk9h\nVMiWHLvD5wiajPEcMZlZlqHZuN12cnxriN51JrqhJgF4E/m+e/DtKZ/n4K/A\nKshB3MGUzVXJFZF2U/17dCLFMKoOB/JRUpFq9hiAfyX0wUDDnsGrxj6xySAO\nRjsDThxi933dIJyXAYLhf0ayGcFiBuM9sCo5I8GGrWL6LVH7NgarL3Y8bFPz\neuCMmJciOGJXFkLNlXL5fwpTnydAshtaPbNHTGA7ugydpkU4xi0e2h6YIirn\nz4hC3sRMQ2ypgpHm75/p6nn6kXS+29kEOnYNVUy+hptRbkA/fU2wV0bBQlod\nJPYaDBOrwODHzX8INjnYedYb\n=o4+2\n-----END PGP PRIVATE KEY BLOCK-----\n", + encryption: Encryption { + account: '0xC785989454C958eF0fD343e3E6DcCDf9893a5b02', + decryptedPgpPvtKey: '-----BEGIN PGP PRIVATE KEY BLOCK-----\n\nxcLYBGQRtHI…nYedYb\n=o4+2\n-----END PGP PRIVATE KEY BLOCK-----\n', + pgpPublicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nxsBNBGQRtHIB…HnWGw==\n=h2rm\n-----END PGP PUBLIC KEY BLOCK-----\n', + env: 'prod', + signer: JsonRpcSigner, + … + }, + env: "prod", + notification: Notification { + signer: JsonRpcSigner, + env: 'prod', + guestMode: true, + account: '0xC785989454C958eF0fD343e3E6DcCDf9893a5b02', + list: ƒ, + … + }, + pgpPublicKey: "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nxsBNBGQRtHIBCADWGXf/Ir844r6xG4FIoprXLv8LaekzuEDT1pYckE4TQSub\n6y1pCCF/eMWvUePvWBAgX8cNdBQ96gxnOB0Kxu2wQTWqLQ0PrL9ggF0dNQcQ\nPbPghOOTWwO2h/TKNa9KrhkCh9m9zjQU9o8w4HxOOJ74t8T9OXqYMOXBMSOr\nVw2bnGQfSodZV7PTJUqmA7ap5JwbGcNP9t1/XH87f6HFSgPwgN5u9rgKAwhJ\nFwujZxSJv2IPRNzpDAq/r/C+fgofkV9/kwU3odsKNMJ+REfNOhDVo+nBLHAu\nTloMkc2WSLJDSu9j8sNZPVrpUaa1c7bbxX5fVTXzW+n2/L2xBkWSfy11ABEB\nAAHNAMLAigQQAQgAPgWCZBG0cgQLCQcICZApG4QIthENGgMVCAoEFgACAQIZ\nAQKbAwIeARYhBGgybFDK2EulZ5avyikbhAi2EQ0aAAA/JQf7B6cVf1OHFncZ\nA/XprZxLLyLbRG3l8nHi8Ujd8IVWavecgYbn0zKuRbHvfkNKKXRKYQ3eMpP8\ns1XRofybhl3J6D5eSPMnw4sxysfteNBoPrBZKFCnY4JFzEDGX7XFIFnJ4ZTU\ncmCp3p0OO86ES3rSG2esmcF/uGUOSf71PspNPKWPfFT4EkpMzYsN8khJv6zA\nqmwYKfz7lCpcef/Wr20kRSN641Z2ZzpVhPQYsVpjcIboVZvb2b1lPUw6v6um\n+c6r4ONgC8HQD8vaC8aozYay9OOf5aDRT0CE8hivurA59TE1akvHDLly4F1H\nIBdShArEO0P7iM2UDZ8enNAloMOM687ATQRkEbRyAQgA3E9cwruXEXB7AwM1\nMzs9I8f2BI4xV+CddArdexeC1w/8zI3pJUYjZU3QlyAmZs9CYqjWil4CYBXy\nke+D4WVg7htEU2DykCrW1pqW+YFIXdN5p6MLOYfPKW7EU4lq1bRC3AnKHa0g\nz5XrmrU89Z8PmcLVtXeAwHM5M/cnCjHQD3a9W4WiglBgYJCqhMoxNK587WRw\n6kqzCp6OVBGozGrrmr+Cjy8fbpmHyjzss/8984RTS14TrCS33cTdTbd52R6p\nAFK3WEDyiJxBfjyZ5UTZlwcpNR84cAWheRUg9RNgnBuOwclsdZdMonfMXsUy\nYJaQKJ4vIbdme1kr31uxVdn/9QARAQABwsB2BBgBCAAqBYJkEbRyCZApG4QI\nthENGgKbDBYhBGgybFDK2EulZ5avyikbhAi2EQ0aAACoYAf/ZjF6FfGDdUZn\nshJPYVTIlhy7w+cImozxHDGZWZah2bjddnJ8a4jedSa6oSYBeBP5vnvw7Smf\n5+CvwCrIQdzBlM1VyRWRdlP9e3QixTCqDgfyUVKRavYYgH8l9MFAw57Bq8Y+\nsckgDkY7A04cYvd93SCclwGC4X9GshnBYgbjPbAqOSPBhq1i+i1R+zYGqy92\nPGxT83rgjJiXIjhiVxZCzZVy+X8KU58nQLIbWj2zR0xgO7oMnaZFOMYtHtoe\nmCIq58+IQt7ETENsqYKR5u+f6ep5+pF0vtvZBDp2DVVMvoabUW5AP31NsFdG\nwUJaHST2GgwTq8Dgx81/CDY52HnWGw==\n=h2rm\n-----END PGP PUBLIC KEY BLOCK-----\n", + profile: Profile { + account: '0xC785989454C958eF0fD343e3E6DcCDf9893a5b02', + decryptedPgpPvtKey: '-----BEGIN PGP PRIVATE KEY BLOCK-----\n\nxcLYBGQRtHI…nYedYb\n=o4+2\n-----END PGP PRIVATE KEY BLOCK-----\n', + env: 'prod', + progressHook: undefined + }, + progressHook: undefined, + signer: JsonRpcSigner { + _isSigner: true, + provider: Web3Provider, + _index: 0, + _address: null + }, + user: User { + account: '0xC785989454C958eF0fD343e3E6DcCDf9893a5b02', + env: 'prod' + }, + } +} +``` + +
+ +--- + +### Initialize user interface + +```typescript +/** + * Initialization Parameters for PushAPI + */ + +/** + * Specifies the type of signer. + * Choose between Ethers or Viem Signer. + */ +type Signer = SignerType; + +interface PushAPIInitializeProps { + /** + * Sets the API environment. + * Options: 'prod', 'staging', 'dev' + * Default: 'staging' + */ + env?: ENV; + + /** + * A callback function to receive updates during the initialization process. + */ + progressHook?: (progress: ProgressHookType) => void; + + /** + * The account you want to link with the PushAPI. + * If left empty, it'll use the account associated with your signer. + */ + account?: string; + + /** + * Specifies the encryption version for the PushAPI. + * Default: 'ENC_TYPE_V3' + */ + version?: string; + + /** + * Provides additional data related to your chosen encryption version, + * like a necessary password. + */ + versionMeta?: { + NFTPGP_V1?: { + password: string; + }; + }; + + /** + * When set to true, the system will automatically upgrade encryption keys + * to the latest available encryption version. + * Default: true + */ + autoUpgrade?: boolean; + + /** + * Defines the origin or source when setting up a Push Profile. + */ + origin?: string; +} + +/** + * Initializes the PushAPI with given parameters. + * + * @param signer The type of signer (Ethers or Viem Signer). + * @param options Optional configurations for initializing the PushAPI. + */ +function initializePushAPI(signer: Signer, options?: PushAPIInitializeProps) { + // Initialization logic here +} +``` + +## Reinitialize user API + + + + +```typescript +// Reinitialize PushAPI for fresh start of NFT Account +// Reinitialize only succeeds if the signer account is the owner of the NFT +// PushAPI.reinitialize{options?}); +await userAlice.reinitialize({ + versionMeta: { NFTPGP_V1: { password: "NewPassword" } }, +}); +``` + + + + +The function resets the **Push NFT user profile** including all connections and communication. It's important to note that this method is not applicable to standard wallet addresses. + +This is particularly useful during instances of NFT transfers where the NFT user password is not shared as it completely resets all communications, acting as a fresh start. + +_`Important`_ - If the **NFT user password is shared**, then do not to use this method, instead you should look at [User encryption update API](/docs/chat/build/manage-user#user-encryption-update-api) for managing user migration. + +### Reinitialize user parameters + +| Param | Type | Sub-Type | Default | Remarks | +| ----------- | -------------------------- | ---------------------------------- | ------- | ---------------------------------------------------------------------------------------------------- | +| _`options`_ | `PushAPIReinitializeProps` | - | - | Optional configuration properties for reinitializing the PushAPI NFT account. | +| - | `options.versionMeta` | `{ NFTPGP_V1 : password: string }` | - | Metadata related to the nft encryption version, including a password need for encrypting NFT account | + +> Note: Parameters _`in this style`_ are mandatory. diff --git a/docs/spaces/01-build/03-Develop-Manage-User.mdx b/docs/spaces/01-build/03-Develop-Manage-User.mdx new file mode 100644 index 0000000000..f58dfbc3c1 --- /dev/null +++ b/docs/spaces/01-build/03-Develop-Manage-User.mdx @@ -0,0 +1,444 @@ +--- +id: docs-spaces-develop-manage-user +title: Manage User +hide_title: true +slug: ./manage-user +displayed_sidebar: pushSpacesSidebar +sidebar_position: 3 +image: "/assets/docs/previews/docs_spaces_develop--manage_user.png" +--- + +# Manage user overview + +These APIs are useful when you want to manage the **Push User** profile. This includes changing profile name, avatar, preferences or encrytion algorithms. + + + Manage User | Push Spaces | Push Documentation + + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; +import Details from "@theme/Details"; + +## User info API + +Returns info of the initialized user containing user's DID, public key, wallets, etc. + + + + +```typescript +// userAlice.info({options?}) +const response = await userAlice.info(); +``` + + + + +--- + +### User info parameters + +| Param | Type | Sub-Type | Default | Remarks | +| --------- | ------------------------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `options` | `InfoOptions` | - | - | Optional configuration properties | +| - | `options.overrideAccount` | - | - | The [account](/docs/spaces/supported-wallet-standards "Push Spaces support wallet standards") for which info is retrieved, can override to get info of other accounts not owned by the user. If not provided, it is derived from signer. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +```typescript +{ + did: 'eip155:0xeF05bec7A4D9572Ab0EE671A3e00F3864870406F', + wallets: 'eip155:0xeF05bec7A4D9572Ab0EE671A3e00F3864870406F', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGWdgogBCACvVX3FpEFuuQDsU7rEFPfw+Xl+sGWnwOYo2cLzByyoi+Yz\n' + + 'tpxdaKsal51pBc3sQzypwpCoBY52RehskKArm958wIJE0+Nc6wqlHFKI8Kxw\n' + + 'yywvyyIumLfZoYINzLyv6hJ4lK4O2d/BdyJwCSLru22NIzWvNwINP61nuYDD\n' + + 'hdps2cxdmtzMEgFWk1u4gTXHZtBL0JNkDSqn1epNnqj7s5T7iVvn1sMBgNnk\n' + + 'siz5T4Xomhg6zgPu1dUbRPEjVycLSQSOEL9EW6XgrwbqL37mHmKijjoE9czA\n' + + 'AlxGiyXyrmJOy3/k9PTGjXTqtnS5pP93NgW9yFtdLVLZSH77AKxNmXoLABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZZ2CiAQLCQcICZClwhL/VObkrwMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBO3PPiNbnO+m2kTm6KXCEv9U5uSvAAC1CAf/cjr7ATr61h17\n' + + 'gx1ZL/kDSq1DQiHaLjwfL3P17e780ezgg/Jdsa98wk8PXBOsi2JceyeH1NKO\n' + + 'i86VCxIyneM1UYlgy3SaMJBhpsFJl8jEMdGP1KOrczQ5I7RQutG2VmxbTpx1\n' + + 'vAB9qUa6MmQ+wgiM86xkU/BIOXhdnpTGPDzjldKBs8IU6AxnPUyV+ULZKvRt\n' + + 'x/23aQIJ+EhzSEV4XJaw+Mh/EaJbgPKFkdcLtsk58X4LjLvd52VNj/VaUqmt\n' + + '4ODZA2wap79VIaumI+V9J89tkDVHrNuhasVI7otEThOyCbqggMhl901urWCA\n' + + '8owjZKPCE5yD9ChtTusi4fqex2aM0M7ATQRlnYKIAQgAxft1NlueBXh+Rk3u\n' + + '6s4zYrF3863XBHGpKtY/C3wg5L2FCxuRvrydWffXQSRz31bvijHRPH4w56Y9\n' + + 'SVY1t41SShC7XUMU3/43RVIDBrnpY9f6uGJBejpnJNrNklJSSStxj8riP34c\n' + + 'PALEnwV+CRk458ubwdPT90IASUj2njTgaJZqAvW6La3xsjdwwQOzeB+wJnu7\n' + + 'GGNKRsKgJulTZkJUkgnxsa0AiMWwKciVDyNs26sN55skCPhIH/yqiooblhZj\n' + + 'PByGLS1b5bGhRUQKX1MQabkfT5CXIHzHTGT7PP57ySfOVB+HWFyLpxcTnu3d\n' + + 'zv+duwdbe2njzeMqA7mE04EMIwARAQABwsB2BBgBCAAqBYJlnYKICZClwhL/\n' + + 'VObkrwKbDBYhBO3PPiNbnO+m2kTm6KXCEv9U5uSvAABpeQf/UvUV6GafM9HP\n' + + 'NrWTjiYjuW+mvowhHC1Q4dNyVJGdY0luryeGR5nuwU/zli7gHWKfjaI/S3cX\n' + + 'aINsELuyrb1HbnPG1lIYpcfaoHaGjCgEOH2VmCrDFRFyOhGEAVXRRdWPJ8BZ\n' + + 'RW+JNreZZQlcliWaVWk++vPdeOcTp14uQpS4/rD4h0d7ufVP/OCUVVN6Hq3+\n' + + 'xyvuBw16OIgKgvgZhYpTW3+kVN9fTkKN16odYThdBimut9TW08PKgO5j+tAy\n' + + '7RAtHn38tBk5RAn6iOKFWBEbhya3BifNDMD18T5ABQ/B6Cpwm1lE38bNKAAs\n' + + 'VrjWMhg20VOJ+vVcV1OvSD10cFGkcg==\n' + + '=TzY6\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + encryptedPrivateKey: '{"ciphertext":"6fe7fdf953289b29d18ede401bf2b697c6da9b90ef645d6ed1b71ab70c8431002c591e93d2d4472957c0d46057b3f06347c35329cafaf28a4ceaf17d4cde08475a82958b18c0e84e5e939871cfea14ae4296a4672a55c16718b4bc9255afe90e1c56fe203896badc5f004c9bc0f2093d9cba2d577b9b7453cd7a24198139229efd469f103d13ec9a60a8d1b4613f9088a968ca8c5da4c62ea2682bb37aaf99d086f589dc2c0f721c8e79d6ae09a6681b2927e8cc98181a34dbf250cda77e9d9bf1a30f480eee570db7f0eb2108c0391db7d0b3dd860fdc61a347f2cba4ebe96b5dce9943c9682dc80291f0d190acfc27a3125cf17511563fad94d6f7b4efc24cc56f133acc14679a462ab62a795ba6afbe90af271be64644e7890b209397e447ccfaa5923f8bf00b19192eea7a2c139b9941ea9093578070acbce020367fee33042519a05806c3973d5db6ba36a85d02051dad301683dee00fe8cdfd2588c7ceeb01d84ad66a6f88ad67239d2996ddfc31f384774593eced92c7c602b12be9a12dbb717e8fb9998c0101f62057748aafeed196b1a4cf57d02e02daeee66d1698f1c6bb6201b98d500ca5df3f96f53209be65c66ed873ab58d1ff3ec2b98153dd67cc4159934c37ea04e12f35216bfdb377c1d71599568be115ff425cfab86d89f37e63ebbc4c2611e63a8b52a0db76125f4420f1616ec19e19b3f272e62c77dfc92b88250cfbea2d368fb7c375d7cb6fd85546e2e2ec6a7d623b4db4896bbd2c96e4529c14b6c5885e85d10e4b817bdca1eff1308767fd3656652d3761058418f59ba06a170575d95c5a75b5372471159612a0538aef6c0f622ff0c5869d9e246c4eb55fff5301cb22bed8aab17240ed49b0d6bf1cb522c3687ff8e6a522b96cd8d2ff4aba1ed389070e2fb1fb34e982f12fe25af60b6acccafbb021659ea1eda6772cdd8c15dfdeddf27d7e6f9eb77d250f9372d466d8dc03b339f73772f2dbece7840d161c93582cdc76e8ab31684f7149fed046143bf36a216f9d8c38f4bd0af952fca2874217c3739a5a76807b8df064c6470bec20ae5ad9e66929a2d0d696b4d1d9260b752995dfc30db27b1456a242b1b71df1e84cdc5fb87ea855f3d24a012236d5b7324bf69e9ea7abbf68e31a5894d52fd6feeec43c6de2d89064f4e7d944fb8c2c3c8a6531082cf4cb13f61f6bbe63cf5fab3530a26d9d296052402a571c48759e7e843eddfe0e1c7ea37e9e7b9b4c0e4bcfd8c67defe5864228ffe46d6a85d2cfbff2d1bccc405f20cfa0ccf44945c12e28fd7d3d80f5a8e523ae7395887bc0039560b2274772bc499e87e72271bcc161333b1459181cf016ec505e0502e5b76fd4b0a29d837c923d5d8301fd86cb349d1336c4b06eddbebc65361a11524adf0fd18f189aef4a30afc7fb7de079a675df4a5e51c434677d9d89cc0e8ff10f7b01775896b478900c5e70eb49648d5082d1eaeda33abdaf01ff9ce9a473f52f15773c0e22e3f78545ddce4577a1f82e87e1b4df016508b7ab586a4e7ff9396f7edd6181290a492b5b15e8d43c7445362a508a80f4d838bf0005d97b0974af54c218d959b5beb9194a914fdabcecfef986e67942a7188d35dc02cb7cdba5b91000e316c552bb6bfb12f86bd3d1ddd332dc1c427fb3dd6962b90e3bfbbba4104a2edd6c6319062920a256eac4a9721fdf03a889e1121fade0ecc8740e1cb08eca08f4d24bdddf8d40617283055f28af1d872a417dd9558ad503276bc8796a50b1691a84137a5d0d3458ec21d0d7cae27e3f53c944372720d588302f0955060bfecff9d00bfdb965d81a280211e6421f79bc09557da2c571367563f00aaa460ec52d52a56cd7b7249bd0c38c997af9f15716928dc9d72fcb1b58a6fd48d48ecaad7d5777b7b526ddbe21314c07fdb7eb21102ef96a416eef514fbc94d4b169bfce0e929446e1970acba7ab358717acdd08421e1335fa6790309817f84c90bec12932284e8b5f03707da0d6ea19f0a22875d0ec0a50c4da5af15ea352954bbdf7f79a7e2232cfe2b9ca8f5711100f5706fa49aea48eb0e19feb9db18df8b85d2d53384aa69773ea390815c8abfc12b1646f1f4a7821ee3fa2291d48dff63fd9ad189601c285cd00d25df3575d29ca5c6973ec1f9022bd9f69ddb2db17c863fe3b7bc2d541e8f20e85120d5a0e620b98f653cd7fcbd8479e22945ef683e657b76e36f5508881104f3c551b3a5354dd3fb0db0c3e1c467289ec5d5edbde6c2f02a7309897aae6619895ed5bb099350772da6db8d1375e9f213669ea51dc8cfefed12a8972f4afe1a1ad86ab694bd9b2aac78d3e664484a8e9770e886a4190388bd60d726689633ac8a3a635019f52ccb7d084b4b51488784ddcfadde436f44eb0f864f32f62af5ddecc7eabfb84b4aa951c9aba79c1d973abc19babc33b154b5d9ef2887635c228a94cc37d1b4026413c23a6c27a3e1355e744283558853d1ef469a5906a0e80443b43f809a48931bd796dfd956ae50e93899518955afb95dff6fee8e1114666717e3860de8a342835be98e1fc6f17b8aef2c0da756f20485bd865e2e1aa558b6cc74df652e04d522645b4337ac2f960c1430ee755355d0e8efbe29001dfb0896af1ebe0228c6f4cd383beded4ebb58a25f07341fa173fb03362de806ce31f683188b54bc45e2571c86bae39073743abc8a4450b982d552b5ee1feb68b3b97e8a8fb2835d3ec7eb8baa3d14b59edf6cf01e80484d0349edcddd1409603ce99f717d943ffad4ae7a18e109dc3b9a6000019c620b1df687c7e1d8029271c46e4c0aad97c18300de00c17c83846fe61ce44f1a7e6be6051f6b2410b907c774b2c8660fbdd2503807f3f260c5da4c22e497b3babd528c0d2e8f68662e2e1451fc32a0fb9de857990fbc373cf75feb2fe7e0bdb7131dc448af37c26a260ec527ea65630030c234d797524e6d08f7c6670cfbe4454b434876385126333f1d953ce967d62a98c803ca3b756e3e92ce888d78aa5eef555d8c95c5d4d354e14324b42a5e921ffc7eed6aeb137c23ae39eb00fac42c314d07566b11fd8285b65a4e616461f164107409bc3f934a467b48c99e40ef80c0558f3391454765338afbd5931ba487d3c1b3d2c38991df0ec766a27a9d40050e54054ac227ae315e3141c1b663c30393ec9ef7346adee1fe310decb2764b78d9dcc38dad814394fea4591211f3ace9c9319af802f4a824db27f90b63b865cc70d346e85d507cc14f10b6ab28da4303051c7d79f8c8a8ec64de45e3701cd4d885ca4f29f90f542d5dd6cc9817e003157f779b23140140886d7e48cee17c253645a980c1823d5a71a5e92b663c85c1e2cf33a54e55737e97c5bce23cc0ee298aa7885fac68754738bd20719d9eebb3c246cce0ea119d950610c1d1dca0ea34bc4e40c7ab4dd2ad3255d2c7d93702416630d0895ae56bfc54875ff0ff5b06289e69385d0ffbc32f8592892af801e978bb6aa1044519e3ec31369d3620abff98b5df7b013bae37f20bb90b0648f7c13c612b82d7a6827f2d62216a465f6c840583519df7f57d0b0ff98fbcd1af743a13820daee02c49f6e16d928eeffcacb3c0fceba3204ed1142fa18478f9663a1e3eee041d82f9960842dd751847b025615168749567309b381a3fd9b512c1153a993fe09f4eae9177eb8d87c708148b04a68401f5360da2a60e1737751295359df27b8e3d734550f752d9a209e8751c8ff7d74922374c236b261d3de14f303f68c99a15bf7e8ee32483be053b59c7e038a9c9b4a905eac9fdbdb6b28afb640c94cc842df125dadacd06d8e08801e6e2e072172b7a0fb1a1335a16b82360b7dde80a7bfd4a9a5eafb63ab663cee5927719227b366297636b534dc16fac05e0d9d5207048c65fdc7859d0f10c6c610fccc9f06c96c4ffc68f30e1d482debab6777db0dcb61ad6df9527edf428d9118a042171f4bf92bbfb4a57df8a7fb7f45a9be9531a7ccbf47d4f4f5d125c3a486283f5554287f16c08213dd1a47ae848d92212b2749308b8a9c907995528cf7f0742bd06e18b8bba25018dec6665fdecbfc572aae835793087f8e1b0acd0d9081f35f439cf139d21695585bd0b3eb370114d0f1f37bc6bbc9c846ac718cc4cd67ed3dfdf586add4f19272c7301f603a624190725055868bf9d0c81226d6a974ab72ff7a2d42fbd64850dfa3a2ba15787b4bf8c4e54db3c5a2922717b3356f7ae30a8baeb89ff57154d3f746a9dd8cf3625259d45499fb04c94b637bbefa6c372f6c2ff16ff1a17a1daec1d8ebee3778ea9e3e8ed15368bcd88d4f46147874c4776dd0db2ed25bf47904e6806b552e201f1d62d14f340519558b5d0d81e06332049e9207432eb75a19c8d0290dc6ab18925188c1315a5e65db7a32890c060466b4246fbf761769fdbb292d9603ebd9509bf9c0d2e8492d297ca6dcbb0e4dba6db598eafe994521ae87afa77097a5cb7ebf8806d0a6aaf28ac4aed5360cd22d797af093a058664cd53c2e646b91171c045140693363f48489caae1be7c5185ff475b8b7b2b6537721b7fec3b01a8b6a8a5d09bcdbf6f851535d5cf22df9742a071f63ddbe2be3e8be29d6fa46f48b9e880b9278f22d4cac0153fef91921f989cce971dfadf049adf41597e3e4352c558cba6c788f31f65385903ca505b95e2b611790a7857c4f2ed3578f659b89c3c744f926251ef6f7acce9ea223e19166079a7c219d905825644932281ed7092df4f1671eaf8d426ab4b080cf243db3b8a765c7cb1845ebb5b2fffd7fa6ecc9fc9c147b6433fb0bb39f64a6e57b3b1c937c6bc7f8b5ba86d0ed428ea5b41e2aa33200c239481f36f3bc6bfc17344245ac8530d4ed0f11d69520b5d6574cb553c6e4af81095ebc4fda7af6419d31cdd90f6f9f452c7fa07c59","salt":"e2474092db07f3cdd4f0f654cd40b5e26f499ceee4f66fd67bfe691bc74e2934","nonce":"d535b48d48fa263d04af4d73","version":"eip191-aes256-gcm-hkdf-sha256","preKey":"f40d7db537e9d5e8201249b1f9c2db7756ab197e58434cb6dfad3180796fc25a"}', + verificationProof: 'eip191v2:0x9d28b544ddef2c7d793a018e0e0e14107e4b57dcb22e06cea7222beb477641e13bfd9b3f10e78cbda7dd9de07b5da3ca6233a86da5f33562d7784de5c6d7cd321b', + msgSent: 0, + maxMsgPersisted: 1000, + profile: { + name: null, + desc: null, + picture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAuUlEQVR4AcXBsY0CMRRF0TtPkxKQbTYBfbgFJGJXgeQqXMa4AVpwAXRAQCVD+rXB34CV3jnL/bwfJGppfGPMTkaYCTNhtp62G7lGNGYnU0sjOm03MsJMmAmz5Xn9OUiM2flGLY2MMBNmwkyYCTNhJsyW+3k/MBJmwkyYrbU0ojE7US2NaMxOppZGNGYnqqURCTNhJsxWfqml8Z9qaWSEmTATZit/eLxfRLVcyDzeL6LrdiEjzISZMPsAJr4jjmZvcRoAAAAASUVORK5CYII=', + profileVerificationProof: null + }, + origin: null, + name: null, + about: null, + profilePicture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAuUlEQVR4AcXBsY0CMRRF0TtPkxKQbTYBfbgFJGJXgeQqXMa4AVpwAXRAQCVD+rXB34CV3jnL/bwfJGppfGPMTkaYCTNhtp62G7lGNGYnU0sjOm03MsJMmAmz5Xn9OUiM2flGLY2MMBNmwkyYCTNhJsyW+3k/MBJmwkyYrbU0ojE7US2NaMxOppZGNGYnqqURCTNhJsxWfqml8Z9qaWSEmTATZit/eLxfRLVcyDzeL6LrdiEjzISZMPsAJr4jjmZvcRoAAAAASUVORK5CYII=', + numMsg: 0, + allowedNumMsg: 1000, + encryptionType: 'eip191-aes256-gcm-hkdf-sha256', + signature: '0x9d28b544ddef2c7d793a018e0e0e14107e4b57dcb22e06cea7222beb477641e13bfd9b3f10e78cbda7dd9de07b5da3ca6233a86da5f33562d7784de5c6d7cd321b', + sigType: 'eip191v2', + encryptedPassword: null, + nftOwner: null, + linkedListHash: null, + nfts: null +} + +``` + +
+ +## User profile info API + +Returns profile info of the user like name, avatar, etc. + + + + +```typescript +// userAlice.profile.info({options?}) +const response = await userAlice.profile.info(); +``` + + + + +--- + +### User profile info parameters + +| Param | Type | Sub-Type | Default | Remarks | +| --------- | ------------------------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `options` | `InfoOptions` | - | - | Optional configuration properties | +| - | `options.overrideAccount` | - | - | The [account](/docs/spaces/supported-wallet-standards "Push Spaces support wallet standards") for which info is retrieved, can override to get info of other accounts not owned by the user. If not provided, it is derived from signer. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +```typescript +{ + name: null, + desc: null, + picture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAyklEQVR4AcXBsWlDMRSG0S8XCbKBQJu50QAuvIBV+i2gwk06F3mbCTSDiqS9cSF42OQ/5+P78+uHA3qKrOQxOcIQM8QMsdBTxMtjspLH5BU9RTxDzBAzxAJPztuOV1vBu10erNRW8G6XB15tBc8QM8QMscBBtRXeyRAzxAyxkMfkP+Ux8QwxQ8wQCzyprfBOtRX+mniGmCFmiIWeIl4ek5WeIit5TFZ6iniGmCFmiIU8Jt552/Hu1xNeHpMjztuOd7+e8AwxQ8wQ+wWFoy7RoNsnSwAAAABJRU5ErkJggg==', + blockedUsersList: ['0xabc..'], // omitted if array is empty + profileVerificationProof: null +} + +``` + +
+ +## User profile update API + +Used for updating profile of a user like name, avatar, description, etc. + + + + +```typescript +// userAlice.profile.update({options?}) +const response = await userAlice.profile.update({ + name: "Alice", + description: "Alice is a software developer", + picture: + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzUlEQVR4AcXBsWlDMRiF0c8XTeAJPIAgoFbgQew1PIbXyKsyhUGtCqM6ZAJX6Z32fykM4hnuObv71++TYJRKlHtji1EqUe6NSJgJM2G2W74/nkzIvfHKKJUZwkyYCbOUe+Odcm/MEGbCTJil2/VMdLx8Eo1S2SL3RnS7nomEmTATZmm//BANKlHujS1GqUT7hRVhJsyEWWLSKJVXcm/MEGbCTJgl/sm9EY1SmTFKJcq9EY1SiYSZMBNm6XE6sHJhJffGOz1OByJhJsyE2R/3lDA4e9QQhAAAAABJRU5ErkJggg==", // base64 encoded image +}); +``` + + + + +--- + +### User profile update parameters + +| Param | Type | Sub-Type | Default | Remarks | +| --------- | --------------------- | -------- | ------- | ---------------------------------------------------------------------- | +| `options` | `object` | - | - | Optional configuration properties | +| - | `options.name` | - | - | Name of the Push User | +| - | `options.description` | - | - | Description of the Push User | +| - | `options.picture` | - | - | Avatar of the Push User, should be base64 encoded image and not an url | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +```typescript +{ + name: 'Alice', + desc: null, + picture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA7ElEQVR4AcXBsW3DMBRF0esPlQYyBldgTXCBFIRG0BIutYSQCQRlBIE1e1fcQ73TPrlQYyD/nNvX7/OFSKGhppL5xLLtqNojynBmODOcDSk0/lMKDWU4M5wZzgbe1B452XZU7ZErKTRU7RGVQkMZzgxnhrNhKpmTbUfVHlHr486VcY6oFBpqKhllODOcGc5u38+fF6L2iEqh8YnaIyqFhjKcGc4MZwNv1seds8wnJs6WjRPDmeHMcDZMJaPG+eBKCo0rtUeurCWjDGeGM8PZsGw7ai0ZNc4HaiqZK3U+UOvjjlq2HWU4M5wZzv4A2KQ7gp8Kf0gAAAAASUVORK5CYII=', + blockedUsersList: [], + verificationProof: 'pgpv2:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJlnlrlCZAad/25xFamrBYhBINr+laRrMoGk+IA0Rp3/bnE\n' + + 'VqasAADpLgf/RuN4ny4S5rYUa0JJNhhDs8HbokFnyMytRrf0Ka7UjUmFZsYN\n' + + 'cBS3wku0SwWOIgUaoxZWtHcITPFsIOvk4etVLm30mRY1tTJAfOvY5WIy9kPF\n' + + 'l/3COBfyOt92d/uhtkvg4q+Jy8dBsseYuCljce7qxlpW6kbtdR2HFsp9xgYc\n' + + 'AEOUDW30Z8gBz/KDW1J+SxqcnfevCNgcXkBH+ZPkzSPWET5lrki1NUaZPjxE\n' + + 'ehoem6lZQU3uzOB920m9TLJM5ZFef5vGrJrMnnOWTJkboQPNEQnvxA6z9DkY\n' + + 'xAJBHKaKCKI4h+h0ZZXEerAPd7oQYho5WCtfP9XPhhNltYNbUyAgsw==\n' + + '=XxgM\n' + + '-----END PGP SIGNATURE-----\n' +} + +``` + +
+ +## User encryption info API + +Returns encryption info of the user like public key, private key, etc. + + + + +```typescript +// userAlice.encryption.info({options?}) +const response = await userAlice.encryption.info(); +``` + + + + +--- + +
+ +```typescript +{ + decryptedPgpPrivateKey: '-----BEGIN PGP PRIVATE KEY BLOCK-----\n' + + '\n' + + 'xcLYBGWeWGYBCAC7mmKWauQ8DZH0EHoKGUHwVqpcqkYDcyYqDF3W75hd+yDr\n' + + 'OkC/PCeRYwfuSJe/BydAbK35hqsoXrPGPas+ZmtTSDbH99jxXBw/mYP0F3Ck\n' + + 'z5BvyTlVmFVn5KLy9ylcKE376fFLER169w7S3sNGypkFOOE9380P6pCA5ltx\n' + + 'jZcVkku/p7PziA3Puzx/neUDYYLBgP11/ZHyJS8ZdRnaMfymQeRFVvfMqiFN\n' + + 'eCR9ny14/w8uHbMVfdaGT/95ylP0vsBmzxIbvojPQln64S0mQyQ4iWSca78P\n' + + '7TFgTadlPr5em/l444Pcfj59DwMuqfaRcag8+DngfLryDPtnZB2/sJoNABEB\n' + + 'AAEAB/4iqgCsdXzNod5FoCPEqO0XqRPagnXkXkr/ewB93hCj0OrAvCdJjqZr\n' + + 'BUbqXwx29i3pCAvPbvRCRdlm+G8jXQ5YuZ+xrFiwJEpt8AJDQG+GbHnuRdqr\n' + + 't7WUOFlploTUa/gY4527tqJhXbQl/5ZKhtXmcp+f7LH5zmg8ARSFc1mm2Ou0\n' + + '67LHhXXvqvUNZCmRo8c84ha7+1SnsnhL42XsF78SEeKHTv9dCNLItZwlwCJf\n' + + 'zRg+jPbhBbHrClNqrqLTPPaqLf6G69tD2mVtfHGUkqTCgBNFlMLwSKXi4Rbn\n' + + 'rZ0NrCn0XNvfploSaX4MLfx3jkLqFQ6e2opi7ubvWZ0PWOPhBADOBc/wc+7U\n' + + 'WgeWjgNdt8zbFiJ2SVvQ5T6QUxQpcDC3d7cwXkpNlVEBX3wwX8Q8fo5NV/C0\n' + + '0Oiu9Qv5Vvg+MyEUkK6GncirK7zmqS9URAuypzHiGNzoJdw3Le5XwDgMOC4y\n' + + 'Kjx5HM6WPGqaESgtwYaeSX50IsZWA/EdxF5RRfvQsQQA6RyyjWKGfrPYpl6p\n' + + 'nO/IF5rEYU9y4gSvZsxN8BjgAJh3hAakrpzcS1nzWjpTT/FEI6vj9xHi5lVs\n' + + 'Ll23fXwGrYOaI+fdp/K925YQyZaU+6S1v4LkLtjTEGIQzNUkMUWjWH/Gt0aO\n' + + 'rGleLtaJsBZqp1hIzpGvI1T42XTMTyqW1h0D+wWlhYYGAlTgJl/6+yM1cwMl\n' + + 'wM0OJHNg5WKdq6mrRT1bZtpTF/mn7+r76pWEZ0g2TvI4UKvXRkroXP04mQSh\n' + + 'f4G4xpLXYUyiQ2HeAvl8o63OHAuMHAebIGMB1vVGlAKGz2T/JtAcy0gwyQDq\n' + + 'S76eqIw7lPa22c5LSE+h6meY6ZPpS17NAMLAigQQAQgAPgWCZZ5YZgQLCQcI\n' + + 'CZDG8fVhTTCp0gMVCAoEFgACAQIZAQKbAwIeARYhBMrgYq7LxHgSb9Gq4Mbx\n' + + '9WFNMKnSAABxeQf7BA1LqD/JBMvQ6rY3UZZjRqLThjrauzC6M0zmGxkswtgS\n' + + 'MKhXwe5GY0CIVT4QirpMH3nuuS4tCBPGepyne0vxC3rtNaFQiTRCk2aF4E4d\n' + + 'mdqlRIJjpbynWRjWX7aZxH6r9gkEYojFcTqLiXWziUl9rNVMg3yuSnNg72M/\n' + + 'krQesiZDQOMAnIrPV3WTvnVMnsstcTuVbF3iC6tZ4A5gKN2RusH6fN8WZQpW\n' + + 'nC1Sfz5HngEhCXA735PlyUH2vh4mcWx1HyoKsefEu/QW9PrVMJIh+5or710f\n' + + 'KM8Xq77+HZwepNyuQeb1yJFtw+v7LB1loJ8lZJLwtKKt8UyJzyEpjTzWI8fC\n' + + '2ARlnlhmAQgAwx04LUrBPmRPjtX+rQ0H5f3X7TZommsNPbQf6VOaN79j60OT\n' + + 'QdEGcT3QW3uZObi9MiZBSLMcepqFjpPIGN4tLXmVUu1p3ekiKnonWIaZXJaJ\n' + + '0PFaLDqxMkTmsVkzxmRilAZHLmpALIgJo/K6OTcW4Z/xDcKWkmYlr7BGadnn\n' + + 'Q5UJ1tABZno3+cSm910dY1k0GKlf0j4IACn4Q+XMPG7dDT7/9IErXM1bhlJV\n' + + 'saDaWxSlIoZF0w2/RkGzJlvuZgRyJBAmzgv+Y77XhiQBJg2w99xGQBbz6+nh\n' + + 'i11IhBesI6B8K+LvvKggDPtL5m1ptwgWrYngxnwCedJRVKI05gc8pQARAQAB\n' + + 'AAf6A4k/SCTbcTnIrlZHBhRfIQYzeF9c0HWhuQ1Pab9j42BC25PvMolrBDji\n' + + 'UpIgIgls1mCWnM5wNPGhe4bGoNq/91vFfsoCOe0ceygZF/PiiijJSSHiqDwN\n' + + 'E5PnmW28MDuIBNZDSn5O+O+jOxcuVFShA8hOClmNOIyE4NUBRbBXDmS4Pa2+\n' + + 'hV4BLbnXx9Zts/UKfL3vWzttxcvqdtIhG7YEBvqoduuziWjj9RC0iiEeEaBr\n' + + 'Rlhw+ArU0ki0ECmrWPcrMewFYVCJe8dRiQ39PRFxPNpBOTqi8YTh24LeCO+2\n' + + 'hoRb9BGsGNOVI9OOfr1STUUWMrTld6BWR+0Pv9KM0T2EEQQA3OVV77FJdMiO\n' + + 'FcujZmf+WbGghwHdL5bTMGtNbYcc4ZbKEl2qjYosB5R1uZgcT5RmEuD6jpcW\n' + + 'yeZcHNL31e+DOsj/eShSDtHSAlEx06Iut+gaIOSI4wIWomWVFnd+3hUYflH0\n' + + 'wpUdKZZPdoxMbWhiy7TkaTgp235IbE+Oz4ZrNjUEAOIfAvGfhhqYZSy/RFkW\n' + + 'daUombfa7o7CGSLADt/0f62MZrcK0ER1zgahs75Z7a4EYYoQCMPmfqqPQUab\n' + + 'b9cE+AxkH/hPsUAOwwFrJbwh0W+mM9LPz8RB9kwoDPDWtsW1imw4TpeFQt++\n' + + 'kC0CqWjPBRq8ffykne6r7tWUjn1J+/qxA/9LoyKKuXzGj3s21/LW4cCDTPac\n' + + 'CQ63Z4Eg99KfBrKmbCtPkrTiRmvx555hjhimNT25+bNwHSLufVomk235OUZJ\n' + + 'fWvgyV82/tlbC6gpFJeDCiGI5+JUorrYue8GkBRn1zuEIDEHc99BJa8fYZBh\n' + + 'EgIGGA7XXKq5day9WPBsqYWEZDs2wsB2BBgBCAAqBYJlnlhmCZDG8fVhTTCp\n' + + '0gKbDBYhBMrgYq7LxHgSb9Gq4Mbx9WFNMKnSAADv9Qf+Ji7LazGnZN/SfYeT\n' + + 'Q/yK6JthGuRB2zz6ktDzk0O5b2iR9hfp8LYv3mL7TecJio9p8GKsE5ZvR2h9\n' + + 'kiBUyr+maY5A+Y2GoqZ0eWoDJqkoocKQzkW/SgqKyZgS1HfT4YaWtq44S0v8\n' + + 'E2jK54KGt5ycFdEhKB9m6hhX4iUJ3wwZaI5RqekSiJyF8vuWcVb/ifoXDRBx\n' + + 'DHBECNS0H2BcvPORL3oKTVDEAfUPJk5vq/Rh243/QFlJQU7WLqJxuChUTp7O\n' + + 'cg7pdP0RvHFmQHcjYwecCRqxHlW0OPI7YS6DqNVyXa/tnNUt8f/h1Nbe1zO4\n' + + '7ToGYHsbN96HlkJLALXAYSDZ2w==\n' + + '=7o+m\n' + + '-----END PGP PRIVATE KEY BLOCK-----\n', + pgpPublicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGWeWGYBCAC7mmKWauQ8DZH0EHoKGUHwVqpcqkYDcyYqDF3W75hd+yDr\n' + + 'OkC/PCeRYwfuSJe/BydAbK35hqsoXrPGPas+ZmtTSDbH99jxXBw/mYP0F3Ck\n' + + 'z5BvyTlVmFVn5KLy9ylcKE376fFLER169w7S3sNGypkFOOE9380P6pCA5ltx\n' + + 'jZcVkku/p7PziA3Puzx/neUDYYLBgP11/ZHyJS8ZdRnaMfymQeRFVvfMqiFN\n' + + 'eCR9ny14/w8uHbMVfdaGT/95ylP0vsBmzxIbvojPQln64S0mQyQ4iWSca78P\n' + + '7TFgTadlPr5em/l444Pcfj59DwMuqfaRcag8+DngfLryDPtnZB2/sJoNABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZZ5YZgQLCQcICZDG8fVhTTCp0gMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBMrgYq7LxHgSb9Gq4Mbx9WFNMKnSAABxeQf7BA1LqD/JBMvQ\n' + + '6rY3UZZjRqLThjrauzC6M0zmGxkswtgSMKhXwe5GY0CIVT4QirpMH3nuuS4t\n' + + 'CBPGepyne0vxC3rtNaFQiTRCk2aF4E4dmdqlRIJjpbynWRjWX7aZxH6r9gkE\n' + + 'YojFcTqLiXWziUl9rNVMg3yuSnNg72M/krQesiZDQOMAnIrPV3WTvnVMnsst\n' + + 'cTuVbF3iC6tZ4A5gKN2RusH6fN8WZQpWnC1Sfz5HngEhCXA735PlyUH2vh4m\n' + + 'cWx1HyoKsefEu/QW9PrVMJIh+5or710fKM8Xq77+HZwepNyuQeb1yJFtw+v7\n' + + 'LB1loJ8lZJLwtKKt8UyJzyEpjTzWI87ATQRlnlhmAQgAwx04LUrBPmRPjtX+\n' + + 'rQ0H5f3X7TZommsNPbQf6VOaN79j60OTQdEGcT3QW3uZObi9MiZBSLMcepqF\n' + + 'jpPIGN4tLXmVUu1p3ekiKnonWIaZXJaJ0PFaLDqxMkTmsVkzxmRilAZHLmpA\n' + + 'LIgJo/K6OTcW4Z/xDcKWkmYlr7BGadnnQ5UJ1tABZno3+cSm910dY1k0GKlf\n' + + '0j4IACn4Q+XMPG7dDT7/9IErXM1bhlJVsaDaWxSlIoZF0w2/RkGzJlvuZgRy\n' + + 'JBAmzgv+Y77XhiQBJg2w99xGQBbz6+nhi11IhBesI6B8K+LvvKggDPtL5m1p\n' + + 'twgWrYngxnwCedJRVKI05gc8pQARAQABwsB2BBgBCAAqBYJlnlhmCZDG8fVh\n' + + 'TTCp0gKbDBYhBMrgYq7LxHgSb9Gq4Mbx9WFNMKnSAADv9Qf+Ji7LazGnZN/S\n' + + 'fYeTQ/yK6JthGuRB2zz6ktDzk0O5b2iR9hfp8LYv3mL7TecJio9p8GKsE5Zv\n' + + 'R2h9kiBUyr+maY5A+Y2GoqZ0eWoDJqkoocKQzkW/SgqKyZgS1HfT4YaWtq44\n' + + 'S0v8E2jK54KGt5ycFdEhKB9m6hhX4iUJ3wwZaI5RqekSiJyF8vuWcVb/ifoX\n' + + 'DRBxDHBECNS0H2BcvPORL3oKTVDEAfUPJk5vq/Rh243/QFlJQU7WLqJxuChU\n' + + 'Tp7Ocg7pdP0RvHFmQHcjYwecCRqxHlW0OPI7YS6DqNVyXa/tnNUt8f/h1Nbe\n' + + '1zO47ToGYHsbN96HlkJLALXAYSDZ2w==\n' + + '=QtCp\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + decryptedPassword: 'password', // omitted if empty, only returned for NFT users +} + +``` + +
+ +## User encryption update API + +Used for updating encryption version, algo or NFT user password. In case of NFT transfer, it's recommended to update password after transfer. + + + + +```typescript +// userAlice.encryption.update(ENCRYPTION_TYPE, {options?}) +// Wallet User Update, +// Usually not required as it's handled internally by the SDK to automatically update to recommended encryption type +const walletAlice = await userAlice.encryption.update( + CONSTANTS.USER.ENCRYPTION_TYPE.PGP_V3, +); + +// NFT User Update +// Should be done when the NFT is transferred to a different user +// so messages and connections can be migrated to the new user +const nftAlice = await userAlice.encryption.update( + CONSTANTS.USER.ENCRYPTION_TYPE.NFTPGP_V1, + { + versionMeta: { + NFTPGP_V1: { + password: "new_password", + }, + }, + }, +); +``` + + + + +:::tip +Attaching progress hook functionality in [Initialize user API](/docs/spaces/build/initialize-user) will help you to track the progress of encryption update. +::: + +--- + +### User encryption update parameters + +| Param | Type | Sub-Type | Default | Remarks | +| --------- | --------------------- | ----------------------------------- | ------- | --------------------------------------------------------------------------- | +| `options` | `object` | - | - | Optional configuration properties | +| - | `options.versionMeta` | `{ NFTPGP_V1 ?: password: string }` | - | Metadata related to the encryption version, including a password if needed. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +```typescript +{ + did: 'nft:eip155:11155111:0x42af3147f17239341477113484752D5D3dda997B:2:1683058528', + wallets: 'nft:eip155:11155111:0x42af3147f17239341477113484752D5D3dda997B:2:1683058528', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGWe42IBCAClV0fsRSH1r9An6p1+QFvYdNM7Jy+keygumt8sRTAoVlkJ\n' + + 'DijCnntjjuygG9e5WBG0rqxtM+21GzRWawjsAldNRUU02Kn8De7Vi6UvZS6p\n' + + 'amHuMeOtrXRUIAuFBAMaHqFa5aEfN71K8Z5Plq7kuvpEL5XLLjYo+Q15B+Cb\n' + + 'OHoyRa7G1WXqdyyepwHXd2qLHDqbtC1uYcAbmYDGW0v9jZIJeYca8l0FR0+C\n' + + 'nKuoVyoxHrOvDl3yFtgzA03nHeJkXFc2ijNBJR37taykOdmaRXaWzuIB9twM\n' + + 'hzAQ0NaIfEEqGCo9STxeU1oPE5W6eGLD8WU99uPBog5g+mDi7cnqKAolABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZZ7jYgQLCQcICZAZ5G2Colq48QMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBKwKzbz9BxH66mp8bxnkbYKiWrjxAACdIwf9GzQxT3NmKGVZ\n' + + 'TPDD6zPuZMQXWjppHXyRT/ou74bLtFJdM2ivRLWPiGaud8zw1rL2bUb7Mn25\n' + + '3r+NB+BogqLzF+q91NIDiRR3pv2RImFGJDK3r2Sfugo4dIU7RNe1SKctdgAk\n' + + 'DBSyOVX7ugd429giQewr5aVE/jT1vJ/lDDDiRw+TvdKt5CGMu4ud5gbuatto\n' + + 'cJFCQSP4i6BuxYdghKH8EuzeO4gvMGMNHpS+4abbpzwWiJ6uL7kje4FOtLxV\n' + + '7Xm9IgvFnAVPpdey1ker+8Te0Yw2DDkesaZ3QjwQ7oy8TBVuBdtp2X7GxXhu\n' + + 'cbt5Pt56cy6Q0I5c1+WDgNxrkR7j2M7ATQRlnuNiAQgAtci6M2dNHj5j1htI\n' + + 'jl5+I/+B7R2uRj/OPBAV/lmpC3xtsw7miFDAvxDS1+g/K1F/dEUtxVe43cRx\n' + + '/dD4j006GE/rxAwJ67P4xt5c3p7XFy0ycRcRyPsYNv3Fqepe8NwEhBEN10dz\n' + + 'AcTXtFm/r6gAdOpssL7as1knyxJOgNkdi0R8y74EHIpMIany6/3Z7rU9+KMn\n' + + 'tTaZzFnXFuIvHbOL8ge8LCD3S/qtcza1GAJlO1I2gsyuOXmahILyw/UT2YhV\n' + + '91tippy6gvAEMJLAP6vm7Y9z5kv9T+qFeLSIb5/L5A3fD+DcxO26NzT2wOGA\n' + + 'dyS+zXwPzdkwpO1fChmwU3B6fwARAQABwsB2BBgBCAAqBYJlnuNiCZAZ5G2C\n' + + 'olq48QKbDBYhBKwKzbz9BxH66mp8bxnkbYKiWrjxAABnLQf8DhOlVRi/OQXV\n' + + 'mT6ed2NiNrYfesfV59nUjP1a9A5GuxMNeVprZ9VJBMLibqQuTX2gdUujVl5m\n' + + '8kWPPiW8++sv2OFpSYuD+Fjguo2r8JpO5/6BrSnFE5+b9PiDtNp1ImcL3FFv\n' + + 'Il2gHTW+qzfsPGz1X57HHr+PidqFXPT+fczoDTTEahXmsdT6I/47beTey4GR\n' + + 'KFZNwNnBETdShpFQxxdIw9BcEm5o+xrLCH+Fz7qdXDqDHEC/VN1bCOWitYWk\n' + + 'ItMMF4+2JTJehksITeRT8Svg+90ZuXUJeQz4uLatahmj8rsHP9udxHAhnRYc\n' + + 'R3O8gfxAOS60jTsP4FpIPpsbbDx73g==\n' + + '=qiH0\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + encryptedPrivateKey: '{"ciphertext":"8e053a21399740d65aa1ba5b7b28b0a1e045a2d0a2abc83adbd41424e76bf460db5081e42e35464dd48444bd92376caaefa63692e28ffac7cef7a49be7e94c2c7a85a32770211ad7c176077a8a7a65f2a7daeacbe3ed31c96d537f10b8390645657ac3f3f447a37023a243f06ae7d7a4445135925409ab8f73db8f40e37132253175b6872012f921fcbc171c1c8ea3cba5c53130117ea81bbc9a9de461e3419461bc8fcd686b19811b8b11788df97d4e4811c3d3743a04804ff5ada44bb177b692fdc95ed6688d84384d1f3ca74de7f11e0d2bc58a0d9f1655eeddf305be801c031a8166482c2f6400595e6582f3d70289889cf1d92fd3c373cc1322edb5f75f7e6333fe34e42d33a67b2e4295afdba3ac59ec87383cfef40011e7aa7c9d5c1f19177b8b0fd532877e7f3d886f6af412fc364d2cdb560976128447d7049e3a84a925c6fd6251a23c644b18767b7b9f44c159a4a1a12c8bba26aed0a48545e2881b136047461c2d87fd866c90e89abeb0ff6cb1f86acd4140b9c43d566fb5a552209c3f4fb319a141e8004e50536a9d9f7bc6fe4b7173310db16b9e9d9d26fa30cfc7fd95eceb5b649f62ad0fe02919751f357e521195cee27302b5eb655328ec32052c3f01358ae9efcec2319d98322506cd1448db58186e00a4ecb02d814f2618e88ebc67b38c564be7a2f14bee0627ef7d40206d7c11d9e48b55f5beddd72c239b97b4f695fe021ee73049f4360048a43f49943366d2ee969e3f100a223f00a7454b81862ddd83a984f3a9a2a857472e983cafaf942552150529a7e2c5b7485096d009ff5713506a4791277db33be29e7d060321013725c658fbb3fefa1a884bdd92c29e52039213ed86c2be2d44d7db06db6dac99799b98690fcc00c2aa3e7e70389816a43ca64abffc2647fd44d9da191f6465d9f245f3029161c90317cb52a19611b6451b06db43093ee05309808a05bdf47f6e1904d6e623cd8d7e32d04e6c61daa1a669de18a4f3da37b5f9af0da68cac3fc36b50462410c0e6fe6ed1f22e64a5200fc5aa5fcbbdeaa2e8b7f3380400829219faa15c851cb11aa073f79fe1c875a568bef6b95897131aa084765b8a20ba47ce0d4920b9f8ad846e1e22024917ece69088b96e061fe9f1ca110d170bd1b72f4f3e16c7fa21054029863efc3e5c9fe1f8e4cdd41c2c8985b523891444bf561d108e684711b88c056cfd0186e6be8acf4665c5c3370a931bd0b46c6aa8c2680f61b6a35689510878d790bed674296388fe2d01710c8e4cc68364112bc5d789469eaf22f1585cc4c245f951ac65bd307d8b5cfd3b663baf944aafe4cfcdec579fd06b20c688b4a62fa6e7ebddc22a2676889e980c0d8d06cf2ab71da3b547c22f2939eb854505767e5cf5f6411b0fdd13123f2e041cc3134c9ce60480ca9e6f3767a332f7d8fc37858b4e3cb14e6df74bbbc4a8be4f7bac0a778bedb576ca270977a5498648d0ca80c84938ea20641fcb49424d4a30b8aa5f3bb50c27635eeb065612dd937f5ea8f0284cbcc73125408cab2731ad9cad129387b0ce20bdb55c37bf1f0e715f7750f2ae46d631626bee4e7d95c62d1ea3b99923d7db9fbea952d2ed81a88092491dc3c887c02cbe4d16894ce6821c7d69d70fcfed898fd281e5e77b5f046dbcc9f99fe77da7d7f0ca0061e7f7194ae6443b70a99ac7acb239ec5f505e79dbd91fea61779cbed693dac922e0f0bffc8838fbe125ba3863d49a5a7bd5d4a9a93b32702bcd1c59f0a0b9f5c93827b9e6fc917d3cbdc6ba50d64c49ace3db61a5d313cf8a2813c4e3f98c2b96fb6320b60ab8861703c05655569843dcf3f778a2141fa3d3065e7915e71ef25a58ef0d7c3de00a523b809e7078b2d446ccdd521fe47d4029b197383377e3538cf66daf4c54afd7512e0aed9ce2c9767e8605dbe675601cddc98904f7dedc865d1f335c7e933f6488cd49e6138b245c5c705be35bf575b7908de133fcc67c3273f9ceffa65e93be7f88698366ed4ea1d2e36607e360c0dd1df05adec0fcbd066ab0d60f76fa96c660bd06af649a03e83cdbd05b1c849b1939cff96c772525afcc2b416ea36c71067d00ad7980abb0ce628b5b2c7f6374b9debf4674b025c8099ecb78ad22ffe20ae2f37b57c7498c8f4c53830b12cddcc229c40ab8fd01c44eb758fc7251811e1a63119805b8905da81f87435ae9a9041f1797a080145c4b4407841b20f52c45faa250695a80e9ca0c04380deaeede524eb60fc55211eb26caa8fc1d0885074791807425365e81b2a08cfa804b094ef2fd4e9de80bf9160d4c26bb3b54e8598e4fcb79416ce52c3bd2097e80f5197a3c3ec8f5a50215c67662a505bbf57473c65a6c419e4a9a37aaabb4a4ec8006ae1ad2823f46c430f977b4fd974f5468a912ef8f6569de0616d98c411b06b304a0df74a1f5bc3d9f7136c6bfab0a2cb451ff934a9bb0f577f3db7572396770b4c8be3267e3258e79de9032b28725b25c7c2773caada7334cf277d218aab55622f257e1c03b4352006f7f4bbb62c76222f02c4c25aedc0f45c1b8b7911625d5e70b2111f9a5bba5651418ddf2317c079e1d6db56f1871be67c1b9fa6530a1cda97e76fdc5ff0de583b7c7e7537f628fb1545c3f87eb93e298d4d64a6670073c47d08d53f83ccc0bd07f704cec11d7e460451b1733b0bee83f81c212df84256e0a986a32f28489abc5b69ed74082f3b1251bf9ea5a48477079e582924db050b7961e2cbb59c32a60b5c2129930c2a1768ea4ce74d512267bd650ebc035ac59a475a8a02cdfa3e42b38168132986eb21a0a780caa2e13075eb4e0530a069d8773892fdfa5781ce1e70723936088d2830a1935d3c78677e2476929f1e819fe7714018b46706d2c6759092191b7db52dbdd52301a5dc32b70ac363b5b3d9b68560295707783f04c67e22040e6dcf0a5d86c0c7fa81b15f063d0a4e3afd785b2711a1cccfd9a8ac7e37380c5c6b288b5ad63f91ad8683f2503bca9c5dacda23eff22766229e3f9141fa83f087166d86da90a2d0b245e2022ed01b075652957157a561df6ef9fe8cad4258fcfd4d61f0e2f3f00480208c511d44eaf8aa9eedc8dbeb024af736b5b5831697b3aabdd847da8c6dad21582b398889ae26f42daa801ae6979fecfdabce29bfa25630c465787edaca23afcba105013ce13df4a64e75c13fce9af57b95d10eab2985ff45b0dcbc9a09a83d6847fbac882b4e1350469b8fabba9f59a4279e53b7802d7d1ad9646c5a7cc0c35bdfb400347924ddbba0ca5e922ddb05c3bfd839010a202c9932b201df47874134231f0c2090d20b28255a71e134ddbabfd333fb0f4413ec03038145b28c238c7bc5e388766311b771a820104a00fce13d37236d484405668b3c87f6e5bc733e5d926f2406ae86e2215000f6543eddf298741267981e4470c0432e534f3623086b0c9911ca5d23819f9a5a5e93695027fb19d64d51c0a3d2849dae7dca34e2c31bf0d5a28a5aed6cdb8c63df51ede95c15e9ad321a661e4085d75f3d8d27f308e24f39e626caced82741bc020d25854a04b176578ead49fb9a5d41188c95655b7d22f528ec896d553caa68db5fd6600e290e057c42643b2cbdc7fc43281d245f45787655e2276c89188e0f165754912f85ccb8603aef761c14d021646ac2d389b46ca2d5e719ce34faaa5f1d1d7f32ce97066bc71fa423bdcde8c2442e21b4d5e7ee13b778a1174f59c3c7b157fcd35172f113fc3589a75f1c00891a2416df4c77bb43da3086ad7c2ea18b9ba1e3904c5c5a8bfc31fc29ba646455dea29ab97bc1a1b320a0bb67b7ccc689eabae8e4ccad5dfe5e2945df2a2ddd77537f80a9da266d4f13f561be38f78b0b2b652a1ed58406ae5b26866d48490c47dc464fab5d5c2e163ccff04c35bed174c0a1e95402f3f1f4049a89ea638d8b42b488161df894bf14b097c1b0d0fd2f7a3467bde251746c1964d783a3e6406b3889d83f3b6111bee7387e724a9966087626c2e593207bb644ba12e2ac5c34d2b0d965fedf6282bea11987bd9f9ee9c519c10f36328c550e7ba1eb21a05d5b13e41fde27b5344d176e66048c09199c3eece738d91ce015ea927c5b91ea53d8ebdb43f2cb25760a2dc764a60592e9ebc1211d911e4464f80241f2314fd8f9420d9e01ae360096211594896cbfe2738f840be8fd643f3057614d27cf2e6849a4f7e4766d30ee5f5447c9bd9fd439decd85357e03e18e269e1049883a0edfe53d8ff543a4e7ba3e71a9608e0e5423bcb7d6bbc1a3973c2f93cd22b1425c31cd4eee752442c040fbcc94beabb20f8cf3301170ad65498a3adf3af2b0f86c2ebd92c0bb5ea332da9efcfc745f5796c2bad607a8338d0f688b2d47a6036db75bd3d9b67e1d03726d966e0fc4f0f2e30acd7e0430c59868bd3915aecf6f8829ba7e8e31e53f9a1ff7144b107752bee7de2562db070b33f226b4274a564511f9a6c57a51f811ca7a1c01250859efb5389880b8ab16b1009c33057a55794803b9d8d056766709d072cb41691ea73e84da34a2c41d00f0b23b820a6c08131af99a5e2d31ee0f06bebf57ae853154dc9df5c5f3b40c384d701a62a95cdf24b1b2914a3512a7fbfc451cc091fc3641d4757335338e3a1a6764ecb00dc7357eb00b0edecad0d166c7b4a5f0315f9a569bfc8283d4e91228afd0fab3e6ad2ac0d28af70921ef023204704d360064fabb936e019291c12c9dff9e339ba98ba3aa0c6c670d062e262b51648c92d2a885543d9a25818255bdb83eae32c02958d0f964a14d7f0af177ce93f08ec3ac006cff2d948575d766f201fd4638bc8d6d415ae5479aa7c3378f0d7dc853c4698eeb97b75a380cb3d8c262ecec330fcb04d9c691f609f9f7adc308c3c7ac2a6b8330cd31cc1dc7578ccb51effa4dc","salt":"0287a217f9384a5be8f42c11f9e95b3c35e0afab193d0bc8619eb521e69f5959","nonce":"7c0f3ef16a4e74072cbb7acb","version":"eip191-aes256-gcm-hkdf-sha256","preKey":"e43ad43ccb43b0680050eb97d2e957e7ab297511832996d5295374deec57c203"}', + verificationProof: 'eip191v2:0x663648ad6fbc6c067855aa9d99792a4f43e2bfaf068e908c241bd238fe54f1ec3623a40efe63be2c333ab02351a6cc321c939db3be7c627234d6103182d38a9f1c', + msgSent: 0, + maxMsgPersisted: 1000, + profile: { + picture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA30lEQVR4AcXBobHCQBiF0S//REXgkKmB3UaQqNcGJmZnTQydIJHPvBJ2e6AHbJ69mMwgmHvO8Pv3syFe65NvmpYZFZgFZoHZcDoeNkRNmW8qvaECs8AsMBtryqjSG6qmjCq9saemjCq9oWrKqMAsMAvMxtIbe6ZlRtWVXdMy8+bSUKU3VGAWmAVmw+l42PhATZk9pTc+EZgFZoHZeLufUdfLA1VTRpXe2FNTRpXeULf7GRWYBWaB2XA6HjaMArPALDAba8qoaZlR18sDVVNmT+kNdbufUa/1iQrMArPA7B/2PTX9dpiaVQAAAABJRU5ErkJggg==', + name: null, + desc: null, + profileVerificationProof: null + }, + origin: null, + name: null, + about: null, + profilePicture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA30lEQVR4AcXBobHCQBiF0S//REXgkKmB3UaQqNcGJmZnTQydIJHPvBJ2e6AHbJ69mMwgmHvO8Pv3syFe65NvmpYZFZgFZoHZcDoeNkRNmW8qvaECs8AsMBtryqjSG6qmjCq9saemjCq9oWrKqMAsMAvMxtIbe6ZlRtWVXdMy8+bSUKU3VGAWmAVmw+l42PhATZk9pTc+EZgFZoHZeLufUdfLA1VTRpXe2FNTRpXeULf7GRWYBWaB2XA6HjaMArPALDAba8qoaZlR18sDVVNmT+kNdbufUa/1iQrMArPA7B/2PTX9dpiaVQAAAABJRU5ErkJggg==', + numMsg: 0, + allowedNumMsg: 1000, + encryptionType: 'eip191-aes256-gcm-hkdf-sha256', + signature: '0x663648ad6fbc6c067855aa9d99792a4f43e2bfaf068e908c241bd238fe54f1ec3623a40efe63be2c333ab02351a6cc321c939db3be7c627234d6103182d38a9f1c', + sigType: 'eip191v2', + encryptedPassword: null, + nftOwner: null, + linkedListHash: null, + nfts: null +} +``` + +
diff --git a/docs/spaces/01-build/04-Develop-Create-Space.mdx b/docs/spaces/01-build/04-Develop-Create-Space.mdx new file mode 100644 index 0000000000..7e4b638295 --- /dev/null +++ b/docs/spaces/01-build/04-Develop-Create-Space.mdx @@ -0,0 +1,100 @@ +--- +id: docs-spaces-develop-create-a-space +title: Create a Space +hide_title: true +slug: ./creating-a-space +displayed_sidebar: pushSpacesSidebar +sidebar_position: 4 +image: "/assets/docs/previews/docs_spaces_develop--create_a_space.png" +--- + +# Create Space API Overview + +This guide will help you understand how to create a space using the Push API. + + + Create a Space API | Push Spaces | Push Documentation + + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; +import Details from "@theme/Details"; + +## Create Space API + + + + +```typescript +// await userAlice.space.create(name, {options}); +const AliceSpace = await userAlice.space.create(name, { + description, // description of the space + participants: { + listeners: listeners, // wallet addresses of the listeners, can be empty. You can also add listeners later after creating the space + speakers: speakers, // wallet addresses of the speakers, can be empty. You can also add speakers later after creating the space + }, + image: image, // space icon in base64 format + schedule: { + start: startDate, // start date and time of the space + }, +}); +``` + + + + +--- + +### Create Space API parameters + +| Property | Type | Sub Type | Description | +| ----------- | ---------------------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| _`name`_ | `string` | - | Name of your Space. | +| _`options`_ | _`options.description`_ | `string` | Description of your Space. | +| - | _`options.image`_ | `string` | Image for your Space(Space Icon) in base64 format. | +| - | _`options.participants.listeners`_ | `string[]` | Wallet addresses of listeners you want to invite to your Space. You can add the addresses here, or you can also invite listeners later after creating the space. | +| - | _`options.participants.speakers`_ | `string[]` | Wallet addresses of speakers you want to invite to your Space. You can add the addresses here, or you can also invite speakers later after creating the space. | +| - | _`options.private`_ | `boolean` | Whether the Space is private or not. | +| - | _`options.schedule.start`_ | `Date` | Start date and time of the Space. | +| - | `options.schedule.end` | `Date` | End date and time of the Space. | +| - | `options.rules` | `any[]` | Define conditions such as token gating, nft gating, custom endpoint for joining a space. See [conditional group gating](docs/spaces/build/conditional-rules-for-spaces) to understand rules engine and how to fine tune conditional rules of your group. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +```typescript +{ + spaceName: 'My Cool Space', + spaceImage: 'data:image/png;base64,iVBORw0K..', + spaceDescription: 'This is a space description', + isPublic: true, + spaceCreator: 'eip155:0xb44a29524433dBC639C35124459c741bC241d4f4', + spaceId: 'spaces:5ea3688ef9ddce985d8e0a348b2a8ebb2c10ea24241337f67192318d69aabf15', + scheduleAt: '2024-02-20T00:00:00.000Z', + scheduleEnd: null, + status: 'PENDING', + rules: {}, + meta: null, + sessionKey: null, + encryptedSecret: null +} + + +| Parameter | Type | Remarks | +| -------------------------- | --------------------- | ----------------------------------------------------------------- | +| `spaceName` | `string` | Name of the space created. | +| `spaceImage` | `string` | Space's image. | +| `spaceDescription` | `string` | Description of the Space. | +| `isPublic` | `boolean` | Indicates whether the space is public or private. | +| `spaceCreator` | `string` | Push Profile DID of the space creator. | +| `spaceId` | `string` | Unique Space ID for the created Space. | +| `scheduleAt` | `timestamp` or `null` | Scheduled start time (if available). | +| `scheduleEnd` | `timestamp` or `null` | Scheduled end time (if available). | +| `status` | `string` or `null` | Status information of the space( 'ACTIVE' or 'PENDING' or 'ENDED')| +| `rules` | `Object` | Space-specific moderation rules +| `meta` | `object` or `null` | Additional metadata (if available). | + +``` + +
diff --git a/docs/spaces/01-build/05-Develop-Fetch-Spaces.mdx b/docs/spaces/01-build/05-Develop-Fetch-Spaces.mdx new file mode 100644 index 0000000000..36c4827143 --- /dev/null +++ b/docs/spaces/01-build/05-Develop-Fetch-Spaces.mdx @@ -0,0 +1,320 @@ +--- +id: docs-spaces-develop-fetch-spaces +title: Fetch Spaces +hide_title: true +slug: ./fetch-spaces +displayed_sidebar: pushSpacesSidebar +sidebar_position: 5 +image: "/assets/docs/previews/docs_spaces_develop--fetch_spaces.png" +--- + +# Fetch Spaces API Overview + +These APIs are useful for fetching list of all spaces (or space requests) that a user might have, along with providing calls to search spaces created in the network, trending spaces. + + + Fetch Spaces | Push Spaces | Push Documentation + + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; +import Details from "@theme/Details"; + +## Space list API + +List all spaces associated with the user. **Space requests** refer to invitations to spaces that you have received but haven't yet accepted. For more information, see the section on space requests. + + + + +```typescript +// await userAlice.space.list(type, {options?}); +const ListAliceSpaces = await userAlice.space.list("SPACES"); +``` + + + + +--- + +### Space list API parameters + +| Property | Type | Sub Type | Description | +| --------- | ------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------ | +| _`type`_ | `string` | - | To retrieve all the Spaces Invites a user has received, pass `REQUESTS`. To get all the spaces the user is associated with, pass `SPACES`. | +| `options` | `object` | - | Additional options for the list. | +| - | `options.page` | `number` | The Page number. Default is 1. | +| - | `options.limit` | `number` | The number of spaces to be returned per page. Default is 10. | +| - | `options.overrideAccount` | `string` | If you want the results for a wallet other than UserAlice, pass the wallet address for which you want to fetch results. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +```typescript +[ + { + spaceId: + "spaces:85795d951d01a2e8b5eb8a00f27ad026bc1016deb827221b0bae53752d7e08a6", + about: null, + did: null, + intentSentBy: "eip155:0xb44a29524433dBC639C35124459c741bC241d4f4", + intentTimestamp: "2024-02-19T10:12:48.000Z", + publicKey: null, + profilePicture: null, + threadhash: null, + wallets: null, + name: null, + spaceInformation: { + members: [Array], + pendingMembers: [Array], + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: + "pgpv2:-----BEGIN PGP SIGNATURE-----\n" + + "\n" + + "wsBzBAEBCAAnBYJl0ymgCZCAwIuuc6EJTBYhBAoZA3x82Ra7dxN7EYDAi65z\n" + + "oQlMAADrVgf9G992LcsjatGbpatszKTnknB6hbCRpjS3TZBh18mXgswmonDj\n" + + "iqARA+dNABEW1BscBn6K1NZNm+ixq11xgsnHtXqzkku5I7mSoyJPDNbDyCLb\n" + + "ui1RUTDl0Pg/9vLW0E8VmrCklb5Pmv2vWwHhXHERFrr0CifN2420tqfE18fx\n" + + "Cmt7mepI90AroHuRPSNkwWG8aw6h71/8MpMl8DIo/NvGqFK0EmAwv3I2n6jP\n" + + "sEKSH6jHEtUaRKgR6gzXq8iJ10okF1N4nQy36tkVCCYkxw91Ivkfam1d1tBx\n" + + "V44bZNuRVz0MZOJx75fZb01bZtKA+Q9X5I0lEclrVjRNF1aLyri8Jw==\n" + + "=m5E8\n" + + "-----END PGP SIGNATURE-----\n" + + ":eip155:0xb44a29524433dBC639C35124459c741bC241d4f4", + spaceImage: "data:image/png;base64,iVBORw0K..", + spaceName: "My Cool Space", + isPublic: true, + spaceDescription: "This is a space description", + spaceCreator: "eip155:0xb44a29524433dBC639C35124459c741bC241d4f4", + spaceId: + "spaces:85795d951d01a2e8b5eb8a00f27ad026bc1016deb827221b0bae53752d7e08a6", + meta: null, + scheduleAt: "2024-02-20T00:00:00.000Z", + scheduleEnd: null, + status: "PENDING", + rules: {}, + }, + msg: { + encType: "PlainText", + encryptedSecret: "", + fromCAIP10: "", + fromDID: "", + link: "", + messageContent: "", + messageType: "", + sigType: "", + signature: "", + toCAIP10: "", + toDID: "", + }, + }, +]; +``` + +
+ +## Fetch Trendng Spaces API + +This API is used to get the list of trending spaces. You can use this API to get the list of trending spaces, which are the most popular spaces. + + + + +```typescript +// await userAlice.space.trending({options?}); +const ListTrendingSpaces = await userAlice.space.trending(); +``` + + + + +--- + +### Fetch Trendng Spaces API parameters + +| Property | Type | Sub Type | Description | +| --------- | --------------- | -------- | ------------------------------------------------------------ | +| `options` | `object` | - | Additional options for the list. | +| - | `options.page` | `number` | The Page number. Default is 1. | +| - | `options.limit` | `number` | The number of spaces to be returned per page. Default is 20. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +```typescript +[ + { + spaceId: + "spaces:62dada77ab5ef7ea8a0f28232bcda400a18d870596fbc08f751888da2ca1861a", + about: null, + did: null, + intent: "eip155:0xfFA1aF9E558B68bBC09ad74058331c100C135280", + intentSentBy: "eip155:0xfFA1aF9E558B68bBC09ad74058331c100C135280", + intentTimestamp: "2023-08-23T13:55:58.000Z", + publicKey: null, + profilePicture: null, + threadhash: null, + wallets: null, + combinedDID: + "eip155:0x9960D6B63B113303B9910A03ca5341B83CC52723_eip155:0xfFA1aF9E558B68bBC09ad74058331c100C135280_eip155:0xffa1af9e558b68bbc09ad74058331c100c135280", + name: null, + spaceInformation: { + members: [Array], + pendingMembers: [Array], + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: + "pgp:-----BEGIN PGP SIGNATURE-----\n" + + "\n" + + "wsBzBAABCAAnBQJk5g/sCZA7/jxKMDdVgxYhBJco5U6B/S5LNkspyzv+PEowN1WD\n" + + "AADY+QgAnHYU16QjYWugTbU2zfFYP+DVvSDhW3FgWLxE/CzpR/RQ9ohmBx/I73C0\n" + + "frFFPJMmaLi+KEYiAFHgO3cq9nZzHpuUy7qccADxk9pnWA234V05i7oYVkXdLZTj\n" + + "NiuUYdHQ0RnHiWhuiPfaPzEm4M1YWd16d0eqZdl4cLCrL4UcCO1WzjckitEpHH2O\n" + + "9pQD7oOrXVcy7z9dJaZ5MI7r9GWbejbVbBhX9ioShaDoYNIrAE4SmNNo3mFUqgFh\n" + + "OVyIenboBO6V0nibvys6OhI2M9rmf4N423d/64iuV6+Qz/93z/cozR+ixK4ranwg\n" + + "sH3Jqt6tLoCiCxC22f7BrpsE2PtVJw==\n" + + "=0PcM\n" + + "-----END PGP SIGNATURE-----", + spaceImage: "asdads", + spaceName: "Testing dart - 123567810123", + isPublic: true, + spaceDescription: "Testing dart", + spaceCreator: "eip155:0xfFA1aF9E558B68bBC09ad74058331c100C135280", + spaceId: + "spaces:62dada77ab5ef7ea8a0f28232bcda400a18d870596fbc08f751888da2ca1861a", + meta: null, + scheduleAt: "2024-03-30T18:30:00.000Z", + scheduleEnd: null, + status: "PENDING", + rules: {}, + }, + msg: { + encType: "PlainText", + encryptedSecret: "", + fromCAIP10: "", + fromDID: "", + link: "", + messageContent: "", + messageType: "", + sigType: "", + signature: "", + toCAIP10: "", + toDID: "", + }, + }, +]; +``` + +
+ +## Search Spaces API + +This API is used to search for a Push Space created in Push Network. You can use this API to search for spaces based on the space name. + + + + +```typescript +// await userAlice.space.search(searchTerm, {options?}); +const SearchCoolSpace = await userAlice.space.search("My cool space"); +``` + + + + +--- + +### Search Spaces API parameters + +| Property | Type | Sub Type | Description | +| -------------- | --------------- | -------- | ------------------------------------------------------------ | +| _`searchTerm`_ | `string` | - | The search term to search for spaces. | +| `options` | `object` | - | Additional options for the list. | +| - | `options.page` | `number` | The Page number. Default is 1. | +| - | `options.limit` | `number` | The number of spaces to be returned per page. Default is 20. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +```typescript +[ + { + spaceName: "making it even cooler", + spaceImage: "data:image/png;base64,iVBORw0K..", + spaceDescription: "new description", + isPublic: true, + spaceCreator: "eip155:0xb44a29524433dBC639C35124459c741bC241d4f4", + spaceId: + "spaces:5ea3688ef9ddce985d8e0a348b2a8ebb2c10ea24241337f67192318d69aabf15", + scheduleAt: "2024-02-20T00:00:00.000Z", + scheduleEnd: null, + status: "PENDING", + rules: {}, + meta: null, + sessionKey: null, + encryptedSecret: null, + inviteeDetails: undefined, + }, + { + spaceName: "My Cool Space", + spaceImage: "data:image/png;base64,iVBORw0K..", + spaceDescription: "This is a space description", + isPublic: true, + spaceCreator: "eip155:0xb44a29524433dBC639C35124459c741bC241d4f4", + spaceId: + "spaces:ed3851e69dedce41469237dd3fb2d05964c8418767c22eb496d59f584e459928", + scheduleAt: "2024-02-20T00:00:00.000Z", + scheduleEnd: null, + status: "PENDING", + rules: {}, + meta: null, + sessionKey: null, + encryptedSecret: null, + inviteeDetails: undefined, + }, + { + spaceName: "My Cool Space", + spaceImage: "data:image/png;base64,iVBORw0K..", + spaceDescription: "This is a space description", + isPublic: true, + spaceCreator: "eip155:0xb44a29524433dBC639C35124459c741bC241d4f4", + spaceId: + "spaces:85795d951d01a2e8b5eb8a00f27ad026bc1016deb827221b0bae53752d7e08a6", + scheduleAt: "2024-02-20T00:00:00.000Z", + scheduleEnd: null, + status: "PENDING", + rules: {}, + meta: null, + sessionKey: null, + encryptedSecret: null, + inviteeDetails: undefined, + }, + { + spaceName: "My Cool Space", + spaceImage: "data:image/png;base64,iVBORw0K..", + spaceDescription: "This is a space description", + isPublic: true, + spaceCreator: "eip155:0xb44a29524433dBC639C35124459c741bC241d4f4", + spaceId: + "spaces:a551aeeb73922d7b86e0bd4874cd36c5e92c6687a6ac3ca75327c137fdb1cb80", + scheduleAt: "2024-02-20T00:00:00.000Z", + scheduleEnd: null, + status: "PENDING", + rules: {}, + meta: null, + sessionKey: null, + encryptedSecret: null, + inviteeDetails: undefined, + }, +]; +``` + +
diff --git a/docs/spaces/01-build/06-Develop-Space-Requests.mdx b/docs/spaces/01-build/06-Develop-Space-Requests.mdx new file mode 100644 index 0000000000..70b13e28c2 --- /dev/null +++ b/docs/spaces/01-build/06-Develop-Space-Requests.mdx @@ -0,0 +1,84 @@ +--- +id: docs-spaces-develop-space-requests +title: Space Requests +hide_title: true +slug: ./space-requests +displayed_sidebar: pushSpacesSidebar +sidebar_position: 6 +image: "/assets/docs/previews/docs_spaces_develop--space_requests.png" +--- + +# Space Requests Overview + +Space Requests are the requests that are sent to the user to join a space by the space creator. The user can accept or reject the request. Until the user accepts the request, the space invite will remain in the Requests category. + +You can use the Space Requests API to accept or reject the space requests. + + + Space Requests | Push Spaces | Push Documentation + + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; +import Details from "@theme/Details"; + +## Accept Space Invite API + +This API is used to accept the invite received for a given Push Space. You can use this API to accept the invite of a space, and become a participant of the space. + + + + +```typescript +// await userAlice.space.accept(spaceId); +const AcceptSpacesInvite = await userAlice.space.accept(spaceId); +``` + + + + +--- + +### Accept Space Invite API parameters + +| Property | Type | Sub Type | Description | +| ----------- | -------- | -------- | ----------------------------------------------------------------- | +| _`spaceId`_ | `string` | - | Space ID of the given Push Space whose invite you want to accept. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +200 OK + +
+## Reject Space Invite API + +This API is used to reject the invite received for a given Push Space. + + + + +```typescript +// await userAlice.space.reject(spaceId); +const AcceptSpacesInvite = await userAlice.space.reject(spaceId); +``` + + + + +--- + +### Accept Space Invite API parameters + +| Property | Type | Sub Type | Description | +| ----------- | -------- | -------- | ------------------------------------------------------------------ | +| _`spaceId`_ | `string` | - | Space ID ofs the given Push Space whose invite you want to reject. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +200 OK + +
diff --git a/docs/spaces/01-build/07-Develop-Manage-Space.mdx b/docs/spaces/01-build/07-Develop-Manage-Space.mdx new file mode 100644 index 0000000000..25c216317b --- /dev/null +++ b/docs/spaces/01-build/07-Develop-Manage-Space.mdx @@ -0,0 +1,461 @@ +--- +id: docs-spaces-develop-manage-space +title: Manage Space +hide_title: true +slug: ./manage-space/ +displayed_sidebar: pushSpacesSidebar +sidebar_position: 7 +image: "/assets/docs/previews/docs_spaces_develop--manage-space.png" +--- + +# Manage Space Overview + +This section covers all APIs related to managing a space including adding / removing members or admins, updating group info or fetching space info and participants. + + + Manage Space Overview | Push Spaces | Push Documentation + + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; +import Details from "@theme/Details"; + +## Get Space Info API + + + +```typescript +// await userAlice.space.info(spaceId); +const UpdateAliceSpace = await userAlice.space.info(spaceId); +``` + + + + +--- + +### Get Space Info API parameters + +| Property | Type | Sub Type | Description | +| ----------- | -------- | -------- | ---------------------------------------------- | +| _`spaceId`_ | `string` | - | Space ID of the Space that you want to update. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +```typescript +{ + spaceName: 'making it even cooler', + spaceImage: 'data:image/png;base64,iVBORw0K..', + spaceDescription: 'new description', + isPublic: true, + spaceCreator: 'eip155:0xb44a29524433dBC639C35124459c741bC241d4f4', + spaceId: 'spaces:5ea3688ef9ddce985d8e0a348b2a8ebb2c10ea24241337f67192318d69aabf15', + scheduleAt: '2024-02-20T00:00:00.000Z', + scheduleEnd: null, + status: 'PENDING', + rules: {}, + meta: null, + sessionKey: null, + encryptedSecret: null +} + + +| Parameter | Type | Remarks | +| -------------------------- | --------------------- | ----------------------------------------------------------------- | +| `spaceName` | `string` | Name of the space created. | +| `spaceImage` | `string` | Space's image. | +| `spaceDescription` | `string` | Description of the Space. | +| `isPublic` | `boolean` | Indicates whether the space is public or private. | +| `spaceCreator` | `string` | Push Profile DID of the space creator. | +| `spaceId` | `string` | Unique Space ID for the created Space. | +| `scheduleAt` | `timestamp` or `null` | Scheduled start time (if available). | +| `scheduleEnd` | `timestamp` or `null` | Scheduled end time (if available). | +| `status` | `string` or `null` | Status information of the space( 'ACTIVE' or 'PENDING' or 'ENDED')| +| `rules` | `Object` | Space-specific moderation rules +| `meta` | `object` or `null` | Additional metadata (if available). | + +``` + +
+ +## Update Space Info API + + + +```typescript +// await userAlice.space.create(spaceId, {options?}); +const UpdateAliceSpace = await userAlice.space.update(spaceId); +``` + + + + +--- + +### Update Space Info API parameters + +| Property | Type | Sub Type | Description | +| ----------- | --------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| _`spaceId`_ | `string` | - | Space ID of the Space that you want to update. | +| `options` | `object` | - | options to update our space details. | +| - | `options.name` | `string` | New Name of your Space. | +| - | `options.description` | `string` | New description of your Space. | +| - | `options.image` | `string` | New Space Icon Image in base64 format. | +| - | `options.private` | `boolean` | Whether the Space is private or not. | +| - | `options.scheduleAt` | `Date` | Start date and time of the Space. | +| - | `options.scheduleEnd` | `Date` | End date and time of the Space. | +| - | `options.rules` | `any[]` | Define conditions such as token gating, nft gating, custom endpoint for joining a space. See [conditional group gating](docs/spaces/build/conditional-rules-for-spaces) to understand rules engine and how to fine tune conditional rules of your group. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +```typescript +{ + spaceName: 'making it even cooler', + spaceImage: 'data:image/png;base64,iVBORw0K..', + spaceDescription: 'new description', + isPublic: true, + spaceCreator: 'eip155:0xb44a29524433dBC639C35124459c741bC241d4f4', + spaceId: 'spaces:5ea3688ef9ddce985d8e0a348b2a8ebb2c10ea24241337f67192318d69aabf15', + scheduleAt: '2024-02-20T00:00:00.000Z', + scheduleEnd: null, + status: 'PENDING', + rules: {}, + meta: null, + sessionKey: null, + encryptedSecret: null +} + + +| Parameter | Type | Remarks | +| -------------------------- | --------------------- | ----------------------------------------------------------------- | +| `spaceName` | `string` | Name of the space created. | +| `spaceImage` | `string` | Space's image. | +| `spaceDescription` | `string` | Description of the Space. | +| `isPublic` | `boolean` | Indicates whether the space is public or private. | +| `spaceCreator` | `string` | Push Profile DID of the space creator. | +| `spaceId` | `string` | Unique Space ID for the created Space. | +| `scheduleAt` | `timestamp` or `null` | Scheduled start time (if available). | +| `scheduleEnd` | `timestamp` or `null` | Scheduled end time (if available). | +| `status` | `string` or `null` | Status information of the space( 'ACTIVE' or 'PENDING' or 'ENDED')| +| `rules` | `Object` | Space-specific moderation rules | +| `meta` | `object` or `null` | Additional metadata (if available). | + +``` + +
+ +## Add participant to a space API + +This API is used to add participants to a space. You can add participants as `SPEAKER` or `LISTENER` based on your requirements. The Participant will then receive a request to join the space which can be accepted or rejected by the recipient. + + + +```typescript +// await userAlice.space.add(spaceId, {options?}); + const response = await userAlice.space.add( + spaceId, // spaceId that you want to add these participants to + { + role: 'LISTENER', // or "SPEAKER" + accounts: ['0xB2aA4Fd98fdd12E0143E4A1F89ea35b966eaCebD'], // array of wallet addresses + } + ); +``` + + + + +--- + +### Add participant to a space API parameters + +| Property | Type | Sub Type | Description | +| ----------- | -------------------- | ---------- | ----------------------------------------------------------------------- | +| _`spaceId`_ | `string` | - | Space ID of the Space that you want to update. | +| _`options`_ | `object` | - | Configurations to add participants. | +| - | _`options.role`_ | `string` | Role to be given for these participants. Either `SPEAKER` or `LISTENER` | +| - | _`options.accounts`_ | `string[]` | Wallet Addresses of the participants tht you want to invite. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +```typescript +{ + spaceName: 'My Cool Space', + spaceImage: 'data:image/png;base64,iVBORw0K..', + spaceDescription: 'This is a space description', + isPublic: true, + spaceCreator: 'eip155:0xb44a29524433dBC639C35124459c741bC241d4f4', + spaceId: 'spaces:2df6f15d4a97dc62bd79a99965d5e85f4a2be9e34b7dede4adb447eb411ec942', + scheduleAt: '2024-02-24T00:00:00.000Z', + scheduleEnd: null, + status: 'PENDING', + rules: {}, + meta: null, + sessionKey: null, + encryptedSecret: null +} + + +| Parameter | Type | Remarks | +| -------------------------- | --------------------- | ----------------------------------------------------------------- | +| `spaceName` | `string` | Name of the space created. | +| `spaceImage` | `string` | Space's image. | +| `spaceDescription` | `string` | Description of the Space. | +| `isPublic` | `boolean` | Indicates whether the space is public or private. | +| `spaceCreator` | `string` | Push Profile DID of the space creator. | +| `spaceId` | `string` | Unique Space ID for the created Space. | +| `scheduleAt` | `timestamp` or `null` | Scheduled start time (if available). | +| `scheduleEnd` | `timestamp` or `null` | Scheduled end time (if available). | +| `status` | `string` or `null` | Status information of the space( 'ACTIVE' or 'PENDING' or 'ENDED')| +| `rules` | `Object` | Space-specific moderation rules | +| `meta` | `object` or `null` | Additional metadata (if available). | + +``` + +
+ +## Remove participant from a space API + +This API is used to remove participants from a space. + + + +```typescript +// await userAlice.space.remove(spaceId, {options?}); + const response = await userAlice.space.remove( + spaceId, // spaceId that you want to remove these participants from + { + accounts: ['0xB2aA4Fd98fdd12E0143E4A1F89ea35b966eaCebD'], // array of wallet addresses + } + ); +``` + + + + +--- + +### Remove participant from a space API parameters + +| Property | Type | Sub Type | Description | +| ----------- | -------------------- | ---------- | ------------------------------------------------------------ | +| _`spaceId`_ | `string` | - | Space ID of the Space that you want to update. | +| _`options`_ | `object` | - | Configurations to add participants. | +| - | _`options.accounts`_ | `string[]` | Wallet Addresses of the participants tht you want to remove. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +```typescript +{ + spaceName: 'My Cool Space', + spaceImage: 'data:image/png;base64,iVBORw0K..', + spaceDescription: 'This is a space description', + isPublic: true, + spaceCreator: 'eip155:0xb44a29524433dBC639C35124459c741bC241d4f4', + spaceId: 'spaces:2df6f15d4a97dc62bd79a99965d5e85f4a2be9e34b7dede4adb447eb411ec942', + scheduleAt: '2024-02-24T00:00:00.000Z', + scheduleEnd: null, + status: 'PENDING', + rules: {}, + meta: null, + sessionKey: null, + encryptedSecret: null +} + + +| Parameter | Type | Remarks | +| -------------------------- | --------------------- | ----------------------------------------------------------------- | +| `spaceName` | `string` | Name of the space created. | +| `spaceImage` | `string` | Space's image. | +| `spaceDescription` | `string` | Description of the Space. | +| `isPublic` | `boolean` | Indicates whether the space is public or private. | +| `spaceCreator` | `string` | Push Profile DID of the space creator. | +| `spaceId` | `string` | Unique Space ID for the created Space. | +| `scheduleAt` | `timestamp` or `null` | Scheduled start time (if available). | +| `scheduleEnd` | `timestamp` or `null` | Scheduled end time (if available). | +| `status` | `string` or `null` | Status information of the space( 'ACTIVE' or 'PENDING' or 'ENDED')| +| `rules` | `Object` | Space-specific moderation rules | +| `meta` | `object` or `null` | Additional metadata (if available). | + +``` + +
+ +## Fetch Participants of a space + +This API is used to get the participants of a Push Space. You can use this API to get the details of the participants of a space, such as their wallet address and their role in the given space, etc. + + + + +```typescript +// await userAlice.space.participants.list(spaceId); +const ListAliceSpaceParticipants = + await userAlice.space.participants.list(spaceId); +``` + + + + +--- + +### Fetch Participants of a space API parameters + +| Property | Type | Sub Type | Description | +| ----------- | -------- | -------- | ---------------------------------------------------------- | +| _`spaceId`_ | `string` | - | Space ID of the Space that you want to fetch participants. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +```typescript + { + "members": [ + { + "address": "eip155:0xb44a29524433dBC639C35124459c741bC241d4f4", + "intent": true, + "role": "SPEAKER", + "userInfo": { + "did": "eip155:0xb44a29524433dBC639C35124459c741bC241d4f4", + "wallets": "eip155:0xb44a29524433dBC639C35124459c741bC241d4f4", + "publicKey": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nxsBNBGNwp6ABCAC7OVMgDVmEETjhSnJU5zSzC5/0pU/rDO2zY9kIKxvaeT0o\nMspIeQTg2t/eLXoyEzfE32xqODcLqjUWOmtyTIY+Ws9Ydd6iONWARXIXk1Rn\npUAE3SL6mj9MEMOt4sBS8vLg42YCDq1nSgVi9YtKW1hsvzjCHvbc437xaLVu\nyBBJOqTkU0XbmpPyFEw+laaEAGyIYSKp1XNgDxBY1tbWev17NTm8C9h1AV1E\nZjcb74NOxWL39gdrzoRNOoXg6SCMpCCPXCzbptR4YP13Dp3j1LbzFpWgIa/h\nuI3NiprgtpH4eB2a6eVlCmoWQMJJjYdbCcIxnAH5hOjY8lm/evUn7v+TABEB\nAAHNAMLAigQQAQgAPgUCY3CnoAQLCQcICRCAwIuuc6EJTAMVCAoEFgACAQIZ\nAQIbAwIeARYhBAoZA3x82Ra7dxN7EYDAi65zoQlMAADk1gf/bho+iCbLAV9m\nWevLuqCZEMwUiHV6Pbmpf6lXxm1pamL+SQ12WHWWbcyOc8ZLvhle9nDprXfm\nH1Hj1pOEiuqZ+g7fakKC4kSorpQ4vJE2b4m50Q/OTCZPEnOVIbnToTlbHnXh\n69hmjQWrvsZOiPz6AiJ0WIpSiUv8qL3H8kCR2eCBxLAUWj8o6ztj7/3tQKzu\nhr6oxMHrbFhzFyMUAcVP9Lz0EOMX2X9m3fagr7czsxGvcA2bd84W4lIXNk7N\ndaqaytRpIu/QhFjeAAKj7NoA1VvJBrJJkuOo+Xy3NeBNu6RCSXuuLbOWsq3h\nUjdM9Fa2OAUqtHU734Ax/u1PF1r3S87ATQRjcKegAQgAm7dyYoaKupPrD+gQ\nGpJaQb59yUBxCxssUnuaw5O9JrCSHF2cUv7JSWUg3HoEtFlpsnZswpac7+DO\nZNg1npjCj8/8SJVdOTlyh4iYizQmSqBFXfVZy1EvylL1KvR1fPu/zsz9cvcG\nBivIf21EbjpBcOB5tPR5yx+AbvlQ2LTeRB7pTwwEWZEuygNE2x6AKejwMUhg\ntHKItiesZx2UJ2rFFHzD93iCvcgK+HkLf4/uqul0QO/pEBNaWqG5+ZVAlfru\nkQdBw4QcNLRM4hHTM1wDdtv9D26AVC9HvLNbJR1uhyUz1IPz00+Cm2x3v+6C\nfN1UrjxClMuLtwBQ+qvD8c/gIQARAQABwsB2BBgBCAAqBQJjcKegCRCAwIuu\nc6EJTAIbDBYhBAoZA3x82Ra7dxN7EYDAi65zoQlMAAArPwf5AXV7mMWONhxc\nnNjqCghgUloEvx9KZO6miZnCDXw0RbMJkqQULPQVzoCcJy/6a4INhhQxlDbk\nTSfjbkuHeKjK7gSmRUl61aTuXbIW+xsiVVgf6/p+BnI5sZ8USVNt8LEDM2fj\nFAJc4o+R0BQSD38BZiicaVFKBws5cKzflbADVKzpzfBQkeXixkf9YQ8TTHC4\nS0t4ZAa3XHWltABmueXZRTBnkknILP409M1Rv6lXUtsmzWIq7yMRRNUWIilp\naGq4sMTwfzTCkNaSM9ad6UWTfxvAOXKfhHj653oo9s7cNclbuDqxqbd7VSg8\nlKUfE7o/BXhF/A+5lNE4JdZ0Oj8hbQ==\n=gYvk\n-----END PGP PUBLIC KEY BLOCK-----\n", + "encryptedPrivateKey": "{\"ciphertext\":\"0b12fc2a592a3ed8976b1ae28d3e5590c8022424256e13a59e3a3e9fa520b1d985946c3db8ad3bd21870b62bb0bc4760157f295eb5d51cd0cd979ee215b84e9e18d6088685ca1295e73441f6fe36011155851d920177e9d4841dffdc0b14418da26facbf349aefac446f421e77f98ffadf0987313082dcc5a3611f82b4e92661c5bd4ac71a8e4b039b90fcc28d821fbb62c0f8c7a2361e62dc68390f76a6d29fc56fe4773a5cef7ade5dd5ad91577a2aaed58d2e630fe6477bd87920f8914d9eaa851a3f83e6d062f9add7dfb2b8ed3ce6c10bd51e16197afb964d82b038a58840088c7c3fa35d462ad7b3e31525dced24ff217e6ab78cb525a073a8e731f421a340dfcca7256580bb45ae0ec08d82616c69e120298dea2eb009dafe2136258b1c10d2847045210749c6863aef1733ea5082f1839232d6e07f49886b5996397f4e6cca6525bd8c73e44fa245dac458f54fe075778697db07896563fefacee9852cecb5597fd8925329a023b366169d5aeadbeaa9d193820e26a2c0a8185f32beb3481521d9f34eaa64bdba39272dbcc27cb2bdd77d8cd35b512115107460311f0f363c25cd4693265541300d54924cf8127c473096ec5286eb578d26de52975b89ab1095059df0ec7b51a79a5aa560de583f26e0b65ac1384ee0744e2aa3fe99c9b6a74629f3e0b0ec7148ea0b8ef7e39ccbc1fb23f69cb47de4ee4e820eb7f59b6751f750794dea5093b2b10dea5d4f1c07c4877dd3afd7b65d74188b04af4c9083a755562ad076df2a63745cd480d8e2b1ac957a36750c5125ce8ca4f48265b47729f03456fe97171b2c931ecb1d9c05b75c90603bd0928121712c8828cf092c712f91b1202effb6b89c4b8bcd098e1f509174f7a3389360ed084b9a57accfa3970694c21ab6c777af7f71652e8150e07b3f22ce37535317ff35e1532efacea5e142b28378e2b0ce64979620751d3c59dab45f68321bfffb0f74ee16f7ebaea4bdb17f409e546e117542e0acbfb5bbf495b40fa5f8ab67f51c58c97f1c8627c46a2a612b1164dfb4092a1835785902683f4d13ffeec971f67eeb7511856b3f150504c347b3d899d23dadf9669b16d2998497648f7df4debec705c230138b73cb44212be8f8ffff8c2e180f46ae2623daf717d42ccc58cc3f1b0bba150276977156d611cafeb2a2d9224faae40148fea8ad9ace6fecabc9162e6007dfe04fb533f98b9ae20b9a60994aa60742a507bdc4c5e16ac5a4d5903f6804e421749e27e770643a057ff9a50c3bf97ff2aa8e2c0fbcf1c0b4f0a228e3a9e5d29673d66dcd7f74a8e0644a9f19b7eb0bca1597e40463120e2613e4a669ee166349e0cfb487e38c669c6fbe46f0703c64ee4296d4713ebe74a4657994eb670b04d632545923cdaf5a815c5ffcd8e960bd87992ea733053b684955519939263a7e27e8369c52a2c04704aa89f6bfde4384dc0e7eaf676adcef097f6c44648778d472b3ecc2c60258feaa121a37392bd796f1ebbc7f9209d07d729436646636928d273ee36f48dd629ee4a32db23c8912e7b5942fcc61db21e3e1772292c6a13fed33696f5a9265da99770ac695ce0f13292bff17acd5e73ddd9db86e624eac1b7513da5a13c15fab174de6996fb1eb08be9395953d77189d4488fb4f527e5e0716663c5fc4e13798b03665b3387ed4b2fad97f3f9606deae70e5c0543f69e06b245735c2afe1d5d49f8d15f538b8b823ea1149bd54710bdf3056b055812c48792125e06429b7506276d0b177d00091fa957c1a15427e012b2bd90257b447df670ede24d0c5790574f46dbfb710067c38e2aa7e8cceff7d35fbfeaa7ec262ae572a7b7a217ca413d3b2016c4a9be7332d2c7551c4b003cd45fbebe42468e407b5f7576783ac450f8a80f22ac1b092ce2c544746d6a6a2e209b013fdb682f3a4ffcd8f7c0c4d30f7ffcaeedb51a6588f4dd7b47025dbf62dc913a17c6db026f601d07739bf7f8f1932caa1dbefa875abc5d4d4e61cee7a8664be629efc447cbf42459005e463c30eeee89c6026ce49295507229e971f604e49c04458758646d561c1369006f9faadafc40c57b5d3f10791773e25abee328df1a9846fe70e1731d36172eab5709c76d45dd15c652c736039f87f53859137d7ea8431a4059bdd98cf351afc875000b860fe1f965e6eb04579a9fb38c4d50773df72d601dc2f0504d47d83e9afbe05e99a8cd4782c443026b55c7f07164e9cc0f5f85897e0629e12e4cedb23ebcc19555cd68b5928fadcbddfd9389dc5429d0f5a946f1d698453cec49b9bd587e8e4cc83413c33309c3952fc2b43bea28acccc4a653c4b7d3b910cdfc6e9ba09d38b936bbca8a260b0c43c47035b966e9c7014e8ce1c9f981dbc67e8ef9261532769464fe4979b3f38d9d253991ee023251e741019191740b3a289a25e999d9727e9ac26d9730863535bfba2635d29e60392f3f16fa7cd8899d5a2a29ef87dc09e9149b37c0a124cccdb829035200b58e3d78e96b4cf8de63b1c7a5807726ef21e3a43338c390e16e904f5c81660d247472e439a260a7032f972389a53906dca4a04c0eb2e9a671091a1d57bd669d4ce63ab79f87d989f7fc31e37e775935f8aae1a77b77268ce4db80d340a516f56509fb24718dd814fd799a112276bb6c1c3d14354bf27d98c0f4e2a86970d7062e51f87393139742b79849b4f50b58907e85712e0fbe959d7935420e9c460765a37bee651183ecb9de586ff9d44e086a4b49c379232790d2ac196d72590c06293f413fba0256256bc95b0861dfa9eaa7aa24647eecde7925c1df7ada695bccecc25b545c7f4b4296f12735794fa8bb74f356f88ceb8b676682cd532e3de66f3bc4408fa7c9472fab69305fbdd2e6bc50a0904a188669a26f00e108ec2407709e0eecc7684f8288e0e32b5c09a7c6e041bca3a652514c048234a6b617186fc3ec54d502975932f1f55aa644f852c3bd87c86fd447cc68ad84e43091890c563dce64933695b7790a4b8ae73396dd00a1f43daba6930f4b91ede4215b84b53821ba10c3cd88b75a6960934f2eb83bf2a9e5e854f5d9e806fa6d333913f6409143b2dd5b1491a7132c06939e97e43fdfb713ead8f917ba21e7847e27a2e9405fd3a44a76006683f716c58a08fd93748d5ec0de6b440a55d2403fbf658c64cee9482e557cd942d44d9f5f46fcf58c67200e85bc9404dfd882bc08575b0080c371da72714f5b7862d9139dea1092df186ca52348dcc39b70d5019fe64747c011a4e22e196ba8551b5ab2db35aeb39b297bd0f0180c1c3603734f82f591c20086d5ce198f40dcc8c9d9dd862198ca9e6526cc8ca4ad2ac86d1877acbb3e35476932108b24a9ecd372d3cc784ee638d5cfe2ba4299182ea1638ae2a999329cf8a0a99c16a0818f2061315d2be5eb7dc8df085acd158d3e2ea4f99f3bea247ce5e41f852335f2007b816efea04fe4a64f02360ccaac2970f953e108f16f4ba7baed85d6dff4b1724b5c406994860c84f720a25d1609dc52948ffd9b43f78f2c9719a9ea1b01149014615aff9e051ad6459b297901a424e7cf403cb56dc03b45a9941ee5c128897e6645967ac325cba31db9b304d9efdc72c45d8cd853c815153f8e1a655c1a84c409d6446b082cef744b4f0bb1c7a58159ed52fff2f97d36faa2a3cf9e5069330550d2a0b21fec1feb91609ea6e2fc4f31f210528099f6f7138d672df7e28ad6ac71454d52f5dfa46dd138a2083492c26c35536a8cefbe8cbd9a9c62b86aca626b81a3bf88d73d1a56bdcb0192c195ea5a2286d09709fa075d822d94b123c0dbce1e12de25ebc3d7ae97397776cd848a5b18851fa2f761e1eda4ce7c04b28a67d5e53711a0002de51f94ed9e4d1bfe7acb86d143fc7cc11727edf31c6161516f9c480fa1ce8cab5e6ba7174a6879f5ad27f9d3188e23327021698a2f26548143a56d95878762b921b16245ef0696515d0de2b733db9bda111ee9699a4297e65e5fb66f92ca6cc19906b8f2d15e29358cc9b9a74156ce87cfdd6d7e6ec70f3fd8bf9651c4258ddfd2c5713cc0f8f29b49494bbccf21829793e2fa06f3ab3e14666824e7c81c978f9496dfa1892b3c1ee837684fa1b9a435653ba41d86c4c097bcc3ea9c0c1ff9859e58fd42da2047d197240c602260ae031afc4a6b9decdb490fe4927f9b2eaf486c4df7b7c7213b92067ed846b271d7cc6809707197f0d65b94f804787137e42f67094a6b6e154c10d512fd7dd891b0a5856fca3ffcb19c0ecd5e527ce2e2363798b837b7b99dce8140d64369295e43e4071123873306410b2b2a7fad7116082cdfc91fbde2486965b823c1847863e40d0fe9878769c305e8184adecd99b7e02637fffb74f2b1556daebb975a2f9ecdb437f95566c7f4ad5c46ada9b51d80edbac34610f7ef6a9e1e9e16d0b75f23b95443f2783cfd2bd152269134f925c3eb45d6e4939ea00e4001ca9e95fec971c9f5a58c24bbf88690402fbaee6734113d19131057fe28a119fc9bea96753853606b1df348ab6406f2e4decc00e6d77e47dda343ac9a848a7a12a4f3d26aacf6a2a93dc198cdce20c8aca2113fb4e847717fa66e6be1a1e54bc2312b6f4e2391d6bf6220f1a9efba3f3bc42ee6f787411393bc6d914aaeef1698cfb76e2de814df970c6700aef8f6b13242185ecd757abd98a66eb9ff1bc79afbdeb8d766da21d3872c04a191e5c310f99b05ed60084c69ee805695a89f824d537e5f31cff4815619fb83a3042b818a986cf0e37e648c47eba667662a31496cb1edf6c23573c93e4038a6494f68c6c2c8808644b88d0763db1931066cbc206421a6450f21480b598a61d0b957b6d16393d84437735f988e9c2efa490f3bfa5cae5a2155075af710e50f0845f0cd91596d288ac764e0d701fd7578a\",\"salt\":\"4046572de6965a463141c70dfdafcb3b4a42ce423af38d1f4c40b1916c842a5c\",\"nonce\":\"7e802dd659e60bc0cf1a5ea0\",\"version\":\"eip191-aes256-gcm-hkdf-sha256\",\"preKey\":\"a71f77f19a6072aa60740fdd37b06ecebe7ff483f7aedfd22eb04b9f09f4e864\"}", + "verificationProof": "eip191v2:0x10470b1b2a461e40c8aa90a56550e8b5c40f9d5d37fd7f4a7147916df12dd89b04133737fac02f1af96a469543043871396bda2c8dd53f3becdc9bc5670d36021b", + "msgSent": 32, + "maxMsgPersisted": 100, + "profile": { + "name": "orange-interior-sailfish", + "desc": null, + "picture": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAy0lEQVR4AcXBoW0DQRCG0c+TJabu4soxWnrS8qAtY1sY6eigK8ctBJkaJnR8YKVTEv3vXT6/Pr5Jwgf/qbZOZogZYoZYCR9ktXWy8MFv1NbJwgeZIWaIGWKFg21fyNbWycIHM7V1sm1fyK68M8QMMUOscLDeH2Thg+x1c2bCB9naOlk4bwwxQ8wQK5y03h/MhHOKIWaIGWKFg/DBXwofzBhihpghVmrrnBE+mKmtc4YhZogZYmXbF7LrszFTW2cmfDDzujmZIWaIGWI/VjkwD8EMoAoAAAAASUVORK5CYII=", + "blockedUsersList": [], + "profileVerificationProof": null + }, + "origin": null + } + }, + + ] +} + + + +| Parameter | Type | Remarks | +| -------------------------- | --------------------- | -------------------------------------------------------------- | +| `members` | `Array` | An array containing member objects. | +| `members.address` | `string` | The wallet address of the member. | +| `members.intent` | `boolean` | `true` if the invite/intent was accepte, otherwise `false` when the recipient hasn't accepted the space invite. | +| `members.role` | `string` | The role of the member. 'SPEAKER' or 'LISTENER' | +| `members.userInfo.did` | `string` | The address of the member in CAIP10. | +| `members.publicKey` | `string` | The member's public PGP key (if available). | +| `members.encryptedPrivateKey`| `string` | The member's encrypted private key (if available). | +| `members.verificationProof` | `string` | The member's verification proof (if available). | +| `members.msgSent` | `number` | The number of messages sent by the member. | +| `members.maxMsgPersisted` | `number` | The maximum number of messages persisted by the member. | +| `members.profile` | `object` | The member's profile information. | +| `members.profile.name` | `string` | The member's name. | +| `members.profile.desc` | `string` | The member's description. | +| `members.profile.picture` | `string` | The member's picture. | +| `members.profile.blockedUsersList` | `Array` | An array containing the wallet addresses of the users blocked by the member. | +| `members.profile.profileVerificationProof` | `string` | The member's profile verification proof (if available). | + + + +``` + + + +## Fetch Participants Count of a space + +This API is used to get the count of the participants of a given Push Space. You can use this API to get the count of the participants of a space. + + + + +```typescript +// await userAlice.space.participants.count(spaceId); +const CountAliceSpaceParticipants = + await userAlice.space.participants.count(spaceId); +``` + + + + +--- + +### Fetch Participants Count of a space API parameters + +| Property | Type | Sub Type | Description | +| ----------- | -------- | -------- | -------------------------------------------------------------------- | +| _`spaceId`_ | `string` | - | Space ID of the Space that you want to fetch the participants count. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +```typescript +{ participants: 1, pending: 1 } + + +| Parameter | Type | Remarks | +| -------------------------- | --------------------- | -------------------------------------------------------------- | +| `participants` | `number` | The number of participants in the space. | +| `pending` | `number` | The number of pending participants in the space. Includes the users who has not yet accepted the space invite | + + + +``` + +
+ +## Fetch Participants Status in a space + +This API is used to get the status of a participant in a given Push Space. You can use this API to see if the user has accpeted the space invite or not. + + + + +```typescript +// await userAlice.space.participants.status(spaceId, target); +const StatusofBobInAliceSpace = await userAlice.space.participants.status( + spaceId, + target, +); +``` + + + + +--- + +### Fetch Participants Status in a space API parameters + +| Property | Type | Sub Type | Description | +| ----------- | -------- | -------- | --------------------------------------------------------------------------------- | +| _`spaceId`_ | `string` | - | Unique Space ID for the given space where you want to check the account's status. | +| _`target`_ | `string` | - | The wallet address of the participant that you want to check for. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +```typescript +{ pending: false, role: 'LISTENER', participant: false } + + +| Parameter | Type | Remarks | +| -------------------------- | --------------------- | ------------------------------------------------------------------------------------ | +| `pending` | `boolean` | says if the request is pending or accepted | +| `role` | `string` | The role of the participant. 'SPEAKER' or 'LISTENER' | +| `participant` | `boolean` | `true` if the participant has not yet accepted the space invite, otherwise `false`.| + +``` + +
diff --git a/docs/spaces/01-build/08-Develop-Optin-Optout-Upcoming-Space copy.mdx b/docs/spaces/01-build/08-Develop-Optin-Optout-Upcoming-Space copy.mdx new file mode 100644 index 0000000000..8fe20ffa8c --- /dev/null +++ b/docs/spaces/01-build/08-Develop-Optin-Optout-Upcoming-Space copy.mdx @@ -0,0 +1,118 @@ +--- +id: docs-spaces-develop-optin-optout-upcoming-space +title: Optin/Optout Upcoming Space +hide_title: true +slug: ./optin-optout-upcoming-space +displayed_sidebar: pushSpacesSidebar +sidebar_position: 8 +image: "/assets/docs/previews/docs_spaces_develop--optin_optout_upcoming_space.png" +--- + +# Spaces Optin/Optout Overview + +Users can browse all upcoming spaces created within the network and choose whether to opt in if they intend to join a particular space. The Opt-in/Opt-out APIs allow users to either optin or optout any of the upcoming spaces as desired. + + + Optin/Optout Upcoming Space | Push Spaces | Push Documentation + + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; +import Details from "@theme/Details"; + +## Optin Upcoming Space API + +This API is used to opt in to any upcoming Push Space. + + + + +```typescript +// await userAlice.space.join(spaceId); +const OptinAliceSpace = await userAlice.space.join(spaceId); +``` + + + + +--- + +### Optin Upcoming Space API parameters + +| Property | Type | Sub Type | Description | +| ----------- | -------- | -------- | --------------------------------------------------------- | +| _`spaceId`_ | `string` | - | Space ID of the given Push Space that you want to opt in. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +```typescript + { + spaceName: "My Cool Space", + spaceImage: "data:image/png;base64,iVBORw0K..", + spaceDescription: "This is a space description", + isPublic: true, + spaceCreator: "eip155:0xb44a29524433dBC639C35124459c741bC241d4f4", + spaceId: + "spaces:a551aeeb73922d7b86e0bd4874cd36c5e92c6687a6ac3ca75327c137fdb1cb80", + scheduleAt: "2024-02-20T00:00:00.000Z", + scheduleEnd: null, + status: "PENDING", + rules: {}, + meta: null, + sessionKey: null, + encryptedSecret: null, + + }, +``` + +
+ +## Optout Upcoming Space API + +This API is used to opt out from an upcoming space that you had previously opted in. + + + +```typescript +// await userAlice.space.leave(spaceId); +const OptfromAliceSpace = await userAlice.space.leave(spaceId); +``` + + + + +--- + +### Optout Upcoming Space API parameters + +| Property | Type | Sub Type | Description | +| ----------- | -------- | -------- | ---------------------------------------------------------- | +| _`spaceId`_ | `string` | - | Space ID of the given Push Space that you want to opt out. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +```typescript + { + spaceName: "My Cool Space", + spaceImage: "data:image/png;base64,iVBORw0K..", + spaceDescription: "This is a space description", + isPublic: true, + spaceCreator: "eip155:0xb44a29524433dBC639C35124459c741bC241d4f4", + spaceId: + "spaces:a551aeeb73922d7b86e0bd4874cd36c5e92c6687a6ac3ca75327c137fdb1cb80", + scheduleAt: "2024-02-20T00:00:00.000Z", + scheduleEnd: null, + status: "PENDING", + rules: {}, + meta: null, + sessionKey: null, + encryptedSecret: null, + + }, +``` + +
diff --git a/docs/spaces/01-build/09-Develop-Join-Space.mdx b/docs/spaces/01-build/09-Develop-Join-Space.mdx new file mode 100644 index 0000000000..bcbe4afac5 --- /dev/null +++ b/docs/spaces/01-build/09-Develop-Join-Space.mdx @@ -0,0 +1,377 @@ +--- +id: docs-spaces-develop-join-space +title:Join Space +hide_title: true +slug: ./join-space +displayed_sidebar: pushSpacesSidebar +sidebar_position: 9 +image: "/assets/docs/previews/docs_spaces_develop--join_space.png" +--- + +# Join Space Overview + +This section covers all the available methods for managing spaces, including joining, leaving, starting, stopping, requesting microphone access, toggling user audio in spaces, and other actions. + + + Join Space Overview | Push Spaces | Push Documentation + + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; +import Details from "@theme/Details"; + +## Prerequisites + +- You need to [initialize user](/docs/spaces/build/initialize-user/ "Initialize User for Push Spaces") before initializing video. +- You also need to declare `data`, `setData` which are essentially a state/variable to hold space-related data with a callback function to react to changes in space state. + +## Initialize Space API + +Push Space API abstracts away connection and encryption methods to enable seamless audio spaces between the connected users. + + + + +```typescript + // await userAlice.space.initialize({ onChange: setData, spaceId: spaceId }); + const userAliceSpace = await userAlice.space.initialize({ + onChange: setData, + spaceId: spaceId, // Space ID that you want to join/start + }); + + + +``` + +--- + +### Initialize Space API parameters + +| Property | Type | Sub Type | Description | +| ------------ | ---------- | -------- | ------------------------------------------------------------- | +| _`onChange`_ | `function` | - | Callback function to react to changes in space state. | +| _`spaceId`_ | `string` | - | Space ID of the given Push Space that you want to join/start. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+200 OK + +
+ +## Start a Space + +This API is used to start a space. It can be utilized by the space creator to start their space. Once the space is started, listeners will be able to join. + + + + +```typescript +// await userAliceSpace.start(); +await userAliceSpace.start(); +``` + + + + +
+ +200 OK + +
+ +## Stop/End a Space + +This API is used to stop/end a space. It can be utilized by the space creator to end their space. Once the space is ended, no listeners will be able to join there after. + + + + +```typescript +// await userAliceSpace.stop(); +await userAliceSpace.stop(); +``` + + + + +
+ +200 OK + +
+ +## Join a Space + +This API is used to join a space. It can be utilized by the listeners to join the space. Once joined, listeners will be able to listen to the space. + + + + +```typescript +// await userAliceSpace.join(); +await userAliceSpace.join(); +``` + + + + +
+ +200 OK + +
+ +## Leave a Space + +This API is used to leave a space. It can be utilized by the listeners to leave the space. + + + + +```typescript +// await userAliceSpace.leave(); +await userAliceSpace.leave(); +``` + + + + +
+ +200 OK + +
+ +## Activate User Audio + +This API is used to activate user audio. User will need to call this method before being able to enable their microphone and start speaking in the space. + + + + +```typescript +// await userAliceSpace.activateUserAudio(); +await userAliceSpace.activateUserAudio(); +``` + + + + +
+ +200 OK + +
+ +## Request For Mic + +This API is used to request for microphone access. Listeners can request to speak by calling this method which can be accepted by the space create or admin. + + + + +```typescript +// await userAliceSpace.requestForMic(); +await userAliceSpace.requestForMic(); +``` + + + + +
+ +200 OK + +
+## Accept Mic Request + +This API is used to accept a mic request from a listener in the given space. Space creator or admin can accept the listener's request to speak by calling this method. + + + + +```typescript +// await userAliceSpace.acceptMicRequest({address, signal}); +await userAliceSpace.acceptMicRequest({ + address: address, + signal: signal, +}); +``` + + + +--- + +### Accept Mic Request API parameters + +| Property | Type | Sub Type | Description | +| ----------- | -------- | -------- | ------------------------------------------------------------ | +| _`address`_ | `string` | - | Address of the listener that you want to accept the request. | +| _`signal`_ | `string` | - | Signal data received in the stream. | + +
+ +200 OK + +
+ +## Reject Mic Request + +This API is used to reject a mic request from a listener in the given space. Space creator or admin can reject the listener's request to speak by calling this method. + + + + +```typescript +// await userAliceSpace.rejectMicRequest({address}); +await userAliceSpace.rejectMicRequest({ + address: address, +}); +``` + + + + +--- + +### Reject Mic Request API parameters + +| Property | Type | Sub Type | Description | +| ----------- | -------- | -------- | ------------------------------------------------------------ | +| _`address`_ | `string` | - | Address of the listener that you want to reject the request. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +200 OK + +
+## Invite as Speaker + +This API is used to invite a listener as a speaker in the given space. Only space creator or admin can invite the listener as a speaker by calling this method. + + + + +```typescript +// await userAliceSpace.inviteToPromote({address}); +await userAliceSpace.inviteToPromote({ + address: address, +}); +``` + + + + +--- + +### Invite as Speaker API parameters + +| Property | Type | Sub Type | Description | +| ----------- | -------- | -------- | ------------------------------------------------------------- | +| _`address`_ | `string` | - | Address of the listener that you want to invite as a speaker. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +200 OK + +
+## Accept Speaker Invite + +This API is used to accept a speaker invite from the space creator or admin in a space. Listener can accept the invite by using this method. + + + + +```typescript +// await userAliceSpace.acceptPromotionInvite({address}); +await userAliceSpace.acceptPromotionInvite({ + address: address, +}); +``` + + + + +--- + +### Accept Speaker Invite API parameters + +| Property | Type | Sub Type | Description | +| ----------- | -------- | -------- | ----------------------------------------------------------- | +| _`address`_ | `string` | - | Address of the listener that you want to accept the invite. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +200 OK + +
+## Reject Speaker Invite + +This API is used to reject a speaker invite from the space creator or admin in a space. Listener can reject the invite by using this method. + + + + +```typescript +// await userAliceSpace.inviteToPromote({address}); +await userAliceSpace.rejectPromotionInvite({ + address: address, +}); +``` + + + +--- + +### Reject Speaker Invite API parameters + +| Property | Type | Sub Type | Description | +| ----------- | -------- | -------- | --------------------------------------------------------------- | +| _`address`_ | `string` | - | Address of the listener that you want to reject the invitation. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +200 OK + +
+ +## Toggle Audio + +This API is used to toggle local audio in the given space. Space creator or admin can toggle their by calling this method. + + + + +```typescript +// await userAliceSpace.config({audio: boolean}) +await userAliceSpace.config({ + audio: boolean, +}); +``` + + + +--- + +### Toggle Audio parameters + +| Property | Type | Sub Type | Description | +| --------- | --------- | -------- | ------------------------------------------------------------------------------------------ | +| _`audio`_ | `boolean` | - | Boolean value to toggle the audio. `TRUE` to enable audio and `FALSE` to mute their audio. | + +> Note: Parameters _`in this style`_ are mandatory. + +
+ +200 OK + +
diff --git a/docs/spaces/01-build/10-Develop-Conditional-Rule-For-Groups.mdx b/docs/spaces/01-build/10-Develop-Conditional-Rule-For-Groups.mdx new file mode 100644 index 0000000000..c8d7b25a4d --- /dev/null +++ b/docs/spaces/01-build/10-Develop-Conditional-Rule-For-Groups.mdx @@ -0,0 +1,372 @@ +--- +id: docs-chat-develop-conditional-rules-for-spaces +title: Conditional Rules for Spaces +hide_title: true +slug: ./conditional-rules-for-spaace +displayed_sidebar: pushChatSidebar +sidebar_position: 10 +image: "/assets/docs/previews/docs_spaces_develop--conditional_rules_for_space.png" +--- + +# Conditional gating overview + +Conditional gating allows you to gate spaces with certain rules. It is driven by Push Chat rules engine which is inspired by json rules engine and allows you to create powerful dynamics guiding communication for your community. Some examples of what you can achieve with it — + +- **Creating token gated spaces** - ie: user needs to hold XX token to join the space +- **Creating nft gated spaces** - ie: user needs to hold XX NFT to join the space +- **Defining multi-chain conditions** - ie: user can join the space if they have 5 tokens on Ethereum or 10 tokens on Polygon +- **Defining non-web3 conditions using Guild** - ie: user needs to follow `@pushprotocol` on twitter to be able to join the space +- **Creating game theories by combining one or multiple conditions** - ie: you need to hold 1000 tokens or 1 NFT or 20 POAPs, etc to join the space. + + + + {"Conditional Gating of Spaces | Push Spaces | Push Documentation"} + + + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; +import { + ModalContainer, + ModalSmall, + ModalWrapper, + AImp, +} from "@site/src/css/SharedStyling"; + +## Understanding the rules object + +The **rules** object is an optional parameter that you pass in [create group API call](/docs/space/build/create-space) to conditional gate **joining** in a space. + +### Overview + +`rules`
+├ `permission` - `entry` or `chat`
+ └ `conditions`
+  └ `decider` - `any` or `all`
+   └`condition a` - `any` or `all`
+    └`criteria 1`
+    └`criteria 2`
+   └`condition b` - `any` or `all`
+    └`criteria 3`
+ +_`rules`_ object is made up of individual **permissions** that define privilages of the space. + +_`permission`_ object contains **conditions** that needs to be satisfied. + +_`conditions`_ object is an array of one or more **condition**. + +_`decider`_ the namespace (`any` or `all`) decides if all of the conditions or anyone of the condition needs to be fulfilled. + +_`condition`_ contains array of **criteria**, the namespace (`any` or `all`) decides if all criterias or anyone of the criteria needs to be fulfilled. + +_`criteria`_ is the atomic condition that has **type**, **category**, **subcategory** and **data**, based on which a particular condition is deemed as completed or failed. + +To summarize, a list of **criteria** is created by you that is then defined inside **decider** to define their logical operation which is then passed in **conditions** of a particular **permission**. The list of individual **permission** is then attached to **rules** of the space to enable Push Chat rule engine to create dynamic communities with creative game theories. + +### Rules object Parameters + +| Param | Type | Subtype | Default | Remarks | +| ---------------------------------------------------------------- | -------- | ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `rules` | `object` | - | - | Rules object | +| `rules.[permission]` | `object` | - | - | Permissions object for specific privilege of the group. Multiple permission object can reside within `rules` object | +| - | `entry` | `object` | - | Permissions object for specific privilege of the group. `entry` permission conditionalizes joining a group | +| `rules.[permission].conditions` | - | `array of objects` | - | Contains array of all `condition` objects | +| `rules.[permission].conditions.[decider]` | - | `object` | - | Contains namespace `any` or `all` by which it's decided whether one condition or all condition needs to be fulfilled | +| `rules.[permission].conditions.[decider].[condition]` | - | `array of objects` | - | Contains lists of criteria objects defined by `decider` key, Valid `decider` keys are `any` or `all`. `any` will mean only one criteria needs to be fulfilled, `all` means all criteria should pass | +| - | `any` | `object` | - | `any` will mean only one criteria needs to be fulfilled from `rules.[permission].conditions.[condition]` array | +| - | `all` | `object` | - | `all` will mean only one criteria needs to be fulfilled from `rules.[permission].conditions.[condition]` array | +| `rules.[permission].conditions.[decider].[condition].[criteria]` | - | `object` | - | Individual criteria inside the `rules.[permission].conditions.[condition]` array | + +### Criteria object Parameters + +Criteria object supports multiple access control protocols which can have different conditions and rules, currently Push Spaces supports `PUSH` and `GUILD` type in criteria, owing to the way each individual protocol handles their respective **type**, **category**, **subcategory** and **data**, we are segregating the options and what they do for clarity. + +#### When using type - `PUSH` + +| Param | Type | Subtype | Default | Remarks | | +| ------------- | ------------------------------------------------------- | ------------------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- | +| `[criteria]` | `object` | - | - | - | Criteria object | +| `type` | `string` | - | - | Define the `type` of the criteria, needs to be `PUSH` for below category, subcategory to be applicable | | +| `category` | `string` - can be `ERC20`, `ERC721` or `CustomEndpoint` | - | - | Defines the category of the criteria, `ERC20` means ERC-20 or normal token, `ERC721` means ERC-721 or NFT tokens, `CustomEndpoint` means a URL will be provided that results in 200 OK | | +| `subcategory` | `string` | - | - | Further narrows down the condition that you want to run. For `ERC20` or `ERC721` - supported conditions are `holder` or `owner` which means that the criteria will check if a wallet is owner or holder. For `CustomEndpoint`, the subcategory is `GET` or `POST` depending upon what HTTP request you want to use | | +| `data` | `object` | - | - | define the data to be passed for checking conditions of criteria | | +| - | `contract` | `string` | - | Only used for `ERC20` or `ERC721` category. Remember to define the contract in chain agnostic fashion. **`{chain_standard}:{chain_id}:{contract_address}`**, for example: `eip155:1:0xf418588522d5dd018b425E472991E52EBBeEEEEE` points to $PUSH token on Ethereum mainnet while `eip155:137:0x58001cC1A9E17A20935079aB40B1B8f4Fc19EFd1` points to $PUSH token on Polygon mainnet | | +| - | `comparison` | `string` - supports `<=`, `>=`, `==` | - | Only used for `ERC20` or `ERC721` category. Define what comparison to use while comparing the data | | +| - | `amount` | `number` | - | Only used for `ERC20` or `ERC721` category. Define the number to be passed in the amount | | +| - | `url` | `string` | - | Only used for `CustomEndpoint` category. Pass in the URL that when polled will return 200 OK for success. API url are automatically appended with `{{user_address}}/checkAccess` while checking access | | + +## Use Case Example - Token gated space + +### Problem Statement + +We want to create a space where only our community members who hold $PUSH can join. Furthermore, we can enable anyone to join the space if they hold a minimum of atleast 1 $PUSH token either on Ethereum or Polygon. + +### Solution + +Let's break down the problem statement into individual requirements + +**Group Join Permission:** We have two criteria over here: + +- **Criteria 1**: User should have 1 $PUSH on Ethereum +- **Criteria 2**: User should have 1 $PUSH on Polygon + +```typescript +// Push token on Ethereum Criteria +{ + "type": "PUSH", // define type that rules engine should go for + "category": "ERC20", // define it's ERC20 token that you want to check, supports ERC721 as well + "subcategory": "holder", // define if you are checking 'holder' or 'owner' + "data": { + "contract": "eip155:1:0xf418588522d5dd018b425E472991E52EBBeEEEEE", // $PUSH address on ETH + "comparison": ">=", // what comparison needs to pass + "amount": 1, // amount that needs to passed + "decimals": 18, // the decimals for the token + } +} +``` + +```typescript +// Push token on Polygon Criteria +{ + "type": "PUSH", // define type that rules engine should go for + "category": "ERC20", // define it's ERC20 token that you want to check, supports ERC721 as well + "subcategory": "holder", // define if you are checking 'holder' or 'owner' + 'data': { + "contract": "eip155:137:0x58001cC1A9E17A20935079aB40B1B8f4Fc19EFd1", // $PUSH address on ETH + "comparison": ">=", // what comparison needs to pass + "amount": 1, // amount that needs to passed + "decimals": 18, // the decimals for the token + } +} +``` + +- Either of criteria should be able to allow user to join the space, this means that the condition's **namespace** to use to combine these criterias would be `any` + +```typescript +// decider object - 'any' since either condition should allow access +"any": [ + { + "type": "PUSH", // define type that rules engine should go for + "category": "ERC20", // define it's ERC20 token that you want to check, supports ERC721 as well + "subcategory": "holder", // define if you are checking 'holder' or 'owner' + "data": { + "contract": "eip155:137:0x58001cC1A9E17A20935079aB40B1B8f4Fc19EFd1", // $PUSH address on ETH + "comparison": ">=", // what comparison needs to pass + "amount": 1, // amount that needs to passed + "decimals": 18, // the decimals for the token + } + }, + { + "type": "PUSH", // define type that rules engine should go for + "category": "ERC20", // define it's ERC20 token that you want to check, supports ERC721 as well + "subcategory": "holder", // define if you are checking 'holder' or 'owner' + "data": { + "contract": "eip155:137:0x58001cC1A9E17A20935079aB40B1B8f4Fc19EFd1", // $PUSH address on ETH + "comparison": ">=", // what comparison needs to pass + "amount": 1, // amount that needs to passed + "decimals": 18, // the decimals for the token + } + } +] +``` + +- Since there are no other conditions that are required, create the entire rules object, conditions only has one condition in entry so namespace for `conditions` doesn't matter but to keep things clear, we will mark it as `all` + +```typescript + "rules": { + "entry": { // permission object + "conditions": { // conditions object + "any": [ // conditions namespace decider - Either group owner / admin invites the user or the user has $PUSH on Ethereum or Polygon + { // decider 1 - If admin or owner invites someone + "any": [ + { // criteria 1 + "type": "PUSH", + "category": "INVITE", + "subcategory": "DEFAULT", + "data": { + "inviterRoles": [ + "ADMIN", + "OWNER" + ] + } + } + ] + }, + { + "any": [ // decider 2 - If user has $PUSH on Ethereum or on Polygon + { // criteria object + "type": "PUSH", // define type that rules engine should go for + "category": "ERC20", // define it's ERC20 token that you want to check, supports ERC721 as well + "subcategory": "holder", // define if you are checking 'holder' or 'owner' + "data": { + "contract": "eip155:137:0x58001cC1A9E17A20935079aB40B1B8f4Fc19EFd1", // $PUSH address on ETH + "comparison": ">=", // what comparison needs to pass + "amount": 1, // amount that needs to passed + "decimals": 18, // the decimals for the token + } + }, + { // criteria object + "type": "PUSH", // define type that rules engine should go for + "category": "ERC20", // define it's ERC20 token that you want to check, supports ERC721 as well + "subcategory": "holder", // define if you are checking 'holder' or 'owner' + "data": { + "contract": "eip155:137:0x58001cC1A9E17A20935079aB40B1B8f4Fc19EFd1", // $PUSH address on ETH + "comparison": ">=", // what comparison needs to pass + "amount": 1, // amount that needs to passed + "decimals": 18, // the decimals for the token + } + } + ] + } + ] + } + } + // since we are not defining chat permissions, it means that any user who is part of the group can chat + } +``` + +- Finally pass this rules object into the space that we are creating using the [create group API call](/docs/space/build/create-space). + +```typescript +// Creating your token gated space +const createTokenGatedSpace = await userAlice.space.create("Push Community", { + description: "Token gated web3 native chat example", // provide short description of group + image: "data:image/png;base64,iVBORw0K...", // provide base64 encoded image + members: [], // not needed, rules define this, can omit + admins: [], // not needed as per problem statement, can omit + rules: { + entry: { + // permission object + conditions: { + // conditions object + any: [ + // conditions namespace decider - Either group owner / admin invites the user or the user has $PUSH on Ethereum or Polygon + { + // decider 1 - If admin or owner invites someone + any: [ + { + // criteria 1 + type: "PUSH", + category: "INVITE", + subcategory: "DEFAULT", + data: { + inviterRoles: ["ADMIN", "OWNER"], + }, + }, + ], + }, + { + any: [ + // decider 2 - If user has $PUSH on Ethereum or on Polygon + { + // criteria object + type: "PUSH", // define type that rules engine should go for + category: "ERC20", // define it's ERC20 token that you want to check, supports ERC721 as well + subcategory: "holder", // define if you are checking 'holder' or 'owner' + data: { + contract: + "eip155:137:0x58001cC1A9E17A20935079aB40B1B8f4Fc19EFd1", // $PUSH address on ETH + comparison: ">=", // what comparison needs to pass + amount: 1, // amount that needs to passed + decimals: 18, // the decimals for the token + }, + }, + { + // criteria object + type: "PUSH", // define type that rules engine should go for + category: "ERC20", // define it's ERC20 token that you want to check, supports ERC721 as well + subcategory: "holder", // define if you are checking 'holder' or 'owner' + data: { + contract: + "eip155:137:0x58001cC1A9E17A20935079aB40B1B8f4Fc19EFd1", // $PUSH address on ETH + comparison: ">=", // what comparison needs to pass + amount: 1, // amount that needs to passed + decimals: 18, // the decimals for the token + }, + }, + ], + }, + ], + }, + }, + }, +}); +``` + +## NFT gated space example + +Below is an example of how to NFT gate `entry` to the space. + +```js +import { PushAPI, CONSTANTS } from "@pushprotocol/restapi"; +import { ethers } from "ethers"; + +// Creating a random signer from a wallet, ideally this is the wallet you will connect +const signer = ethers.Wallet.createRandom(); + +console.log( + `Signer address: ${signer.address} | Signer private key: ${signer.privateKey}`, +); + +// Initialize wallet user +// 'CONSTANTS.ENV.PROD' -> mainnet apps | 'CONSTANTS.ENV.STAGING' -> testnet apps +const userAlice = await PushAPI.initialize(signer, { + env: CONSTANTS.ENV.STAGING, +}); + +// Creating your token gated community +const createTokenGatedGroup = await userAlice.space.create("Push Community", { + description: "Token gated web3 native chat example", // provide short description of group + image: "data:image/png;base64,iVBORw0K...", // provide base64 encoded image + members: [], // not needed, rules define this, can omit + admins: [], // not needed as per problem statement, can omit + rules: { + entry: { + // entry is based on conditions + conditions: { + any: [ + // any of the decider should allow entry + { + // decider 1 - If admin or owner invites someone + any: [ + { + // criteria 1 + type: "PUSH", + category: "INVITE", + subcategory: "DEFAULT", + data: { + inviterRoles: ["ADMIN", "OWNER"], + }, + }, + ], + }, + { + // decicder 2 - If wallet holds 1 NFT on polygon testnet + any: [ + { + // criteria 1 + type: "PUSH", // define type that rules engine should go for + category: "ERC721", // define it's ERC20 token that you want to check, supports ERC721 as well + subcategory: "holder", // define if you are checking 'holder' + data: { + contract: + "eip155:80001:0x9105D95577575116948F5afcF479254f49F27939", + comparison: ">=", // what comparison needs to pass + amount: 1, // amount that needs to passed + decimals: 18, + }, + }, + ], + }, + ], + }, + }, + }, +}); + +console.log("Chat created successfully!", createTokenGatedGroup); +``` + +## NFT gated group github example repo + +[Follow this token gated example github](https://github.com/ethereum-push-notification-service/push-sdk/tree/main/packages/examples/token-gated-chat "Token gated example using Push Chat") repo to see and play with the API. diff --git a/docs/spaces/01-build/12-Develop-Stream-Spaces.mdx b/docs/spaces/01-build/12-Develop-Stream-Spaces.mdx new file mode 100644 index 0000000000..4eb03698a7 --- /dev/null +++ b/docs/spaces/01-build/12-Develop-Stream-Spaces.mdx @@ -0,0 +1,342 @@ +--- +id: docs-spaces-develop-setup-spaces-stream +title: Setup Spaces Stream +hide_title: true +slug: ./setup-spaces-stream +displayed_sidebar: pushSpacesSidebar +sidebar_position: 9 +image: "/assets/docs/previews/docs_spaces_develop--setup_spaces_stream.png" +--- + +# Setup Spaces stream overview + +Spaces stream is a real-time communication protocol, setting up a Spaces stream is the first step to manage Spaces. This section covers everything you need to do to set up a Spaces stream. + + + Setup Spaces Stream | Push Spaces | Push Documentation + + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; +import Details from "@theme/Details"; + +## Spaces stream API + + + + +```js +// Initialize stream to listen for events: +const stream = await userAlice.initStream([ + CONSTANTS.STREAM.SPACE, // Listen for space events + CONSTANTS.STREAM.SPACE_OPS, // Listen for Space creation and updates + CONSTANTS.STREAM.CONNECT, // Listen for connection events + CONSTANTS.STREAM.DISCONNECT, // Listen for disconnection events +]); + +// Stream connection established: +stream.on(CONSTANTS.STREAM.CONNECT, async () => { + console.log("Stream Connected"); +}); + +// Space event received: +stream.on(CONSTANTS.STREAM.SPACE, (data) => { + console.log("Space event received."); + console.log(data); // Log the space event data +}); + +// +stream.on(CONSTANTS.STREAM.SPACE_OPS, (data) => { + console.log("Space Operation Received."); + console.log(data); // Log the space operation data +}); + +// Connect the stream: +await stream.connect(); // Establish the connection after setting up listeners + +// Stream disconnection: +stream.on(CONSTANTS.STREAM.DISCONNECT, () => { + console.log("Stream Disconnected"); +}); + +// Stream also supports other products like CONSTANTS.STREAM.NOTIF. +// For more information, please refer to push.org/docs/notifications. +``` + + + + +--- + +### Spaces stream parameters + +| Param | Type | Sub-Type | Default | Remarks | +| ---------- | ---------------------------- | ------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| _`listen`_ | `constant` | - | - | can be `CONSTANTS.STREAM.VIDEO`, `CONSTANTS.STREAM.CHAT`, `CONSTANTS.STREAM.CHAT_OPS`, `CONSTANTS.STREAM.NOTIF`, `CONSTANTS.STREAM.CONNECT`, `CONSTANTS.STREAM.DISCONNECT` | +| `options` | `PushStreamInitializeProps` | - | - | Optional configuration properties for initializing the stream. | +| - | `options.filter` | `object` | - | Option to configure to enable listening to only certain chats or notifications. | +| - | `options.filter.channels` | `array of strings` | `['*']` | pass list of **channels** over here to only listen to notifications coming from them. | +| - | `options.filter.chats` | `array of strings` | `['*']` | pass list of **chatids** over here to only listen to chats coming from them. | +| - | `options.connection` | `object` | - | Option to configure the connection settings of the stream | +| - | `options.connection.retries` | `number` | `3` | Number of automatic retries incase of error | +| - | `options.raw` | `boolean` | `false` | If enabled, will also respond with meta data useful in verifying the integrity of incoming chats or notifications among other things. | + +> Note: Parameters _`in this style`_ are mandatory. + +### Stream Spaces listen events + +| Listen events | When is it triggered? | +| ----------------------------- | ------------------------------------------------------------------------ | +| `CONSTANTS.STREAM.SPACE` | Whenever a space related action occurs. | +| `CONSTANTS.STREAM.SPACE_OPS` | Whenever a space operation like space creation and updation is received. | +| `CONSTANTS.STREAM.VIDEO` | Whenever a video call operation is received. | +| `CONSTANTS.STREAM.CHAT` | Whenever a chat is received. | +| `CONSTANTS.STREAM.CHAT_OPS` | Whenever a chat operation is received. | +| `CONSTANTS.STREAM.CONNECT` | Whenever the stream establishes connection. | +| `CONSTANTS.STREAM.DISCONNECT` | Whenever the stream gets disconnected. | + +
+ +```typescript +{ + "event": "space.create", + "origin": "self", + "timestamp": 1696576020848, + "spaceId": "3781b4193166ec8f0a1fabe162ef3f2458cac28516d4d20f8dd7faf446815900", + "from": "eip155:0x136E326b22ED48dbB665733eC024407d4fAA4F12", + "meta": { + "name": "test", + "description": "test", + "image": "test", + "owner": "eip155:0x136E326b22ED48dbB665733eC024407d4fAA4F12", + "listeners": [], + "private": false, + "rules": {} + }, + "raw": { + "verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7IUCRAxpSc3atCeoBYhBGHp9Ifk8vvLrMzkYTGlJzdq\n0J6gAADrLAgAgDSQ7CJ3ZVOPye++rkpyR4Q9XSGnV3Z0bqO+HCqFDW/hTmJ+\n12kjrAQV43Q1fQviIMqh+RTA9WJHPA14vu/ZYHjmCM/HfPSxbY4zV/7FJF9C\nCaEgq+wGs+2vhixHX4Zoo4qrxdXQ6q8Wl4XXW3SVaw1sGxfIh+uMje54Tsil\nnaLNK+lIPdSAJDw1hOHIM3iMWaSzZasLaXkJ6KY9KefW52mhg112BZI94FxJ\n/wFQtlIaXGZHhCbaqiigjRPKo17KyW7PX6I0rTAQJlwHyIKS/vIH8Uahi2x3\ndzjonpXjjtsgcP+VhzEP1jxQkpo4mG47Fxkxzp/Q7ztdSGHnJGlXkQ==\n=HydQ\n-----END PGP SIGNATURE-----\n" + } +} +``` + +
+ +
+ +```typescript +{ + "event": "space.update", + "origin": "self", + "timestamp": 1696576020848, + "spaceId": "3781b4193166ec8f0a1fabe162ef3f2458cac28516d4d20f8dd7faf446815900", + "from": "eip155:0x136E326b22ED48dbB665733eC024407d4fAA4F12", + "meta": { + "name": "test", + "description": "test", + "image": "test", + "owner": "eip155:0x136E326b22ED48dbB665733eC024407d4fAA4F12", + "private": false, + "rules": {} + }, + "raw": { + "verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7IUCRAxpSc3atCeoBYhBGHp9Ifk8vvLrMzkYTGlJzdq\n0J6gAADrLAgAgDSQ7CJ3ZVOPye++rkpyR4Q9XSGnV3Z0bqO+HCqFDW/hTmJ+\n12kjrAQV43Q1fQviIMqh+RTA9WJHPA14vu/ZYHjmCM/HfPSxbY4zV/7FJF9C\nCaEgq+wGs+2vhixHX4Zoo4qrxdXQ6q8Wl4XXW3SVaw1sGxfIh+uMje54Tsil\nnaLNK+lIPdSAJDw1hOHIM3iMWaSzZasLaXkJ6KY9KefW52mhg112BZI94FxJ\n/wFQtlIaXGZHhCbaqiigjRPKo17KyW7PX6I0rTAQJlwHyIKS/vIH8Uahi2x3\ndzjonpXjjtsgcP+VhzEP1jxQkpo4mG47Fxkxzp/Q7ztdSGHnJGlXkQ==\n=HydQ\n-----END PGP SIGNATURE-----\n" + } +} +``` + +
+
+ +```typescript +{ + "event": "space.message", + "origin": "other", + "timestamp": "1696576962232", + "spaceId": "b6f53ac38d0698ea64e6c4b0f024437ac2271ca869413d5f779d7cda75de1aaa", + "from": "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05", + "to": [ + "eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899" + ], + "message": { + "type": "Text", + "content": "Hey There!!!" + }, + "meta": { + + }, + "reference": "bafyreich6wtnzojmgqft6eudx43y4xir2emfnhxqlvyy7rq6a73w7szywe", + "raw": { + "fromCAIP10": "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05", + "toCAIP10": "eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899", + "fromDID": "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05", + "toDID": "eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899", + "encType": "pgp", + "encryptedSecret": "-----BEGIN PGP MESSAGE-----\n\nwcBMAyaG8qwtJd4vAQf9Fg4udBKFN/Pqd9+bi5dqGnLr/PJbRHaIljRlzt5R\nm+6sPUeGyVkXcFdGbSnUKG0M7rtwKVOg0LiCX/oFx//k6ULJWJNVpuZsy4QT\nGYZevcU6dEPMMw4KSG/KJb+sdTAqlRPegibfrfg7YK/Mr9xd0DbN8K9CFsqC\nW/CYz0AkgZS/wN2099cy9WEgesv9yHMd1tU+59A/gAjmI5qk1ge3PvReKGP/\ncSWCX4wz0lioviib7g9zdw79ecpJThmWXKWaW/dPikcNYUTCbK31gY9TuRsy\nS+z+7AdddGj0hqgQvZIfj4XHgHbpQrRisddbgc1AE1xV7eiiT2jtNPswtsat\n48HATAOhR72eaWLr8wEIAJ06+SdpAuQT6mdlIAo/Kttiyd71UkxgMlappQKQ\nM5e2aei/H/C93EFYIitVHobeH/Q8Y89k4E+Plopo23OS6TGGbWIUl0PSJkyg\nxAIyC8J4RfqylCp+k/d9ZxZP/l0WrrXo9SqGOfXnAVm/IITLl8hlG7dvSztI\ng8ndUrk8Af3Jwq4vbrbUOMr2ophzV027HVWQl53Dez/e+DfpuyvT2uDAevTw\nf82H0+2DIz3jzj3rNfkvyA6C3InhW37K4JNh+T3XlL7qWV77XTWFN0yLzZwP\nrW0hLWV5YGAj0kqpup5oY4H1ANPknRiNxP6hUrQH5ZkHPahEUo78gpP70qgc\nZafSQAHfRbVWZC7J+0OF15W+dR3iM8Ngrz/PjYEchVo73a8uBtNk4mSai8o7\nv1A2hx74RVX6yN05D8Bxpf6u7wQMXB8=\n=T81R\n-----END PGP MESSAGE-----\n", + "signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7XCCRCfItQMnVG/eBYhBKTq6JYHJG7fZv5Yop8i1Ayd\nUb94AAB/NQf/bwUkzVHV6/ODTtnjeA0y0kqEv3OAzbYoG60QdgNf3zAEmFbk\nf4ULNghzvl3Nt3S7TYsF06xu4gzzsjaOt8glPxJCiZUa3lXdJH53X5+VCbZV\nSWJuip9tdljAv4zg27+ZAGrwyC4NrTHE8t1b8mDHLTgJeqae6dJHjScmCXKZ\ngBZb2mNeVYWklg1mpCuXxB8YJpeFKDgSYeZ3C+YNSGAmoCyICRpYvxYo038P\nDehkFMS3HHvSGjFslcDN0D9l8gWY/4H520Rfer4GHJoFMSZeKlyWkQRCNPNz\nFY3fjmPLuimbEnnzd9Nxw1kbx4P9SBEEa4xhEjJnxx/sAnQxJX72RQ==\n=1zuZ\n-----END PGP SIGNATURE-----\n", + "sigType": "pgpv2", + "verificationProof": "pgpv2:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7XCCRCfItQMnVG/eBYhBKTq6JYHJG7fZv5Yop8i1Ayd\nUb94AACE2wf9GQq+/lkGQ7HVVmLF3SnSRI0IM9s4OvLckwjyd1i3D1lLnwu5\nVaPj+VxKZSBe+GHHukd/gQ+qYr9fhfHNMQ019AfHfz81kCCai6KhExH3YVbE\nsrL+j2bwttfcRjRWy/MoHo1T6M9F8PR4jm4aaktTSliApRE0k92Igm8Gw5it\nUaP1/qDIOQRjlofa7wAyDz7Kf83/WkbS78+MJZP0JWL9znhdFH5em8RvVYpS\nMa7/Skl8BnCr46BIfcd4Urd9q/RECKA4WJaxpOosH42MJQ4DLJ2iRnzZKkyr\nyZBfXXyiMA5goy+uzJzVhA5tlsHZp3jUFEZSvofaMX6a5UopweHMGw==\n=Wp+E\n-----END PGP SIGNATURE-----\n", + "previousReference": "bafyreid7b7m5ub3ouybgp2nzu733vle73bem5jcz5lg5u2epknncfhfeuy" + } +} +``` + +
+
+ +```typescript +{ + "event": "space.request", + "origin": "self", + "timestamp": 1696576021653, + "spaceId": "3781b4193166ec8f0a1fabe162ef3f2458cac28516d4d20f8dd7faf446815900", + "from": "eip155:0x136E326b22ED48dbB665733eC024407d4fAA4F12", + "to": [ + "eip155:0x3AD7cf4Ef82dd7f4f040c5eD7352f12C662F21db", + "eip155:0x1b77273e527Ec5948995f395e3ADa41E708d617e", + "eip155:0x7711FED1Bc6B1E461aE7869959bdBf529335db5A" + ], + "meta": { + + }, + "raw": { + "verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7IVCRAxpSc3atCeoBYhBGHp9Ifk8vvLrMzkYTGlJzdq\n0J6gAAD//wf/bTrC0LnwzcUIE10d3XQ2Y56jK6kRVGWKR/7i6CC+hGs5PGKu\nzefIGdtLVjAqTeKn6PbNnb1t2niLhmMeTbN+knGCzSqx/FN8OodLLmunLNAx\nWJ5thFyjZWNyIF7IoH2zUdc8zbsjXHzfd70yoxMZSwd5C7EPj/e17kyYHdj2\nzPQecbTsnCIjJKzi0PBa2YMNoF5fExP3hwTnP0k693r8oC5ivxj7Ht3Hwmu0\njsv+sGXk+XZPC/JQQfEEviEh3j9dEiNIeHutk/7cFdEnDfEy5dFMxubjf6oH\nY6vt0q2V2CZJHHw99JYeTHN/d3YDXc4RggoUINo1cysR904owgEsVw==\n=QTX8\n-----END PGP SIGNATURE-----\n:0x136E326b22ED48dbB665733eC024407d4fAA4F12" + } +} +``` + +
+
+ +```typescript +{ + "event": "space.accept", + "origin": "other", + "timestamp": "1696576021843", + "spaceId": "3781b4193166ec8f0a1fabe162ef3f2458cac28516d4d20f8dd7faf446815900", + "from": "eip155:0x3AD7cf4Ef82dd7f4f040c5eD7352f12C662F21db", + "to": null, + "message": { + "type": null, + "content": null + }, + "meta": { + }, + "reference": null, + "raw": { + "verificationProof": "pgp-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7IVCRA1c2iyC1q/7RYhBH5kgFyUQlfGEgbg0jVzaLIL\nWr/tAABinQf9E+7UUlPnAVu9VifNHS6GJuf/o1RJdE8gL4mi27+rdfr+Y2+Y\nzZaZbBEJK3BTJgT4op1yJKtg2GZDZUIMWSbkcouE+2YyyYsANS89z/blq/05\nYf6RFuUeHr3pGIyzkeb7Aj7VEHbUhrK5nHheTkO7K6Gpa9blNEYVrhsYrHbs\n7UhYKlq6tsoo1E8XXFWBhd+2rVPKF4zhIt9jPdqNPYTQSn7K7hjVvZueWd0Z\nD7Vr4RO4Af3a/5EiVAvOtxVGLpwhw+FKDOGJhRdNCNLqEc8gZ0q+l1cvglKp\nfAiqSZpnnTzIUloszJvNFAeQSR/nZQ9wjEihosDztVOOz5uyQ3XhZw==\n=kX/p\n-----END PGP SIGNATURE-----\n", + } +} +``` + +
+
+ +```typescript +{ + "event": "space.reject", + "origin": "other", + "timestamp": "1696576601599", + "spaceId": "7a200d55cc76428e9938e935b604e993c5f6cb2f3e9a1dd7108a07dd32de0791", + "from": "eip155:0x15d8a67c0B1eb61dA5901109DB4CA382E989aA13", + "to": null, + "message": { + "type": null, + "content": null + }, + "meta": { + }, + "reference": null, + "raw": { + "verificationProof": "pgp-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7RZCRA8vrXKPfPlwRYhBECQe8HJcpH3IRX27jy+tco9\n8+XBAADl0Af7BumEnrIcSj/1H3LvxaqG4wK/G6iTP3iTvXUca0n7UBplXS8P\nbKV7XFhjollN6jJVZ53mmUHgNDAbfaQTvutm3SRJlFVJxV4zV9uL7UMZW+k4\nYAJM5XNbqqyn7+KjcLIwBpJ3YLMmmLfdrO4+WJAYswAAJGiS+KPDsU+oOsfm\nHMWc5aRqis0Epf3FLWELO0uDyydm75575bBe60FxfPjnd5GhUgmMWydNCZH1\ngeGMLZbhuQ+bvnLjTuWSmnW64cl+jlRCzs2Mpgwvrh0ZQIcPWjVDjNevNohu\n3l9VXhHuYPUCyGGIyhcPG3tubRcudY+U/uavhQ6XXgWPVdKZ/qwfAw==\n=0jOy\n-----END PGP SIGNATURE-----\n", + } +} +``` + +
+
+ +```typescript +{ + "event": "space.participant.remove", + "origin": "other", + "timestamp": 1696576219688, + "space": "a64abd4256a607e7bd2ab4068d9024ddb0d355687267c0e39eb31a3a7d245ab0", + "from": "eip155:0x50bbFA4833e89389FE00a62D14E6eDDf1c155855", + "to": [ + "eip155:0x50bbFA4833e89389FE00a62D14E6eDDf1c155855" + ], + "raw": { + "verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7LbCRByYd40HdgiDBYhBLSq7nZZRBYzsnezMXJh3jQd\n2CIMAADNoAf/UxniQM/ZtzDuSmhIuvWiuGzl8vkeFbN2dOLW1a2yJO2Z8jDa\nDDuxyTcSt9d9YyCO/NojhbxmScE73gBysVt9OLdUn9hXlAKclYjXu4r7KvLk\nmrQyMlN3akDjpzH1gGiiCSi18vll07KRGSgWt3P13cA9vGpT+YV3A6uiCGUS\nE3CV16wdYTd0FUPJHckTJVVu3se1K3NfzzELMwIeN9bPJLxaZD3u3t074dN/\nc+jwUS1OC0sUQ5ptHCgfNIMgtueutKSPPZO6MKVBE/qQauKh81PHgzrhW0OE\n6gMkSDPjVbncjBSumofTWga7udk65RhwysCxx9qa3O/u6skBH0N+bg==\n=oqeR\n-----END PGP SIGNATURE-----\n:0x50bbFA4833e89389FE00a62D14E6eDDf1c155855" + } +} +``` + +
+
+ +```typescript +{ + "event": "space.participant.join", + "origin": "other", + "timestamp": 1696576531987, + "spaceId": "1032596dea9f24a7a0ee419668f7d39da32a2fb32003a27c6b293cc6668d2a82", + "from": "eip155:0x8c1EAB3227250526f133681630c2B191969f8581", + "to": null, + "raw": { + "verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7QTCRCI26TZ8c3OJBYhBNDtmDIWimjDn9MUIIjbpNnx\nzc4kAAAfFwgAgQkKBS/W7e53maVOne1lob2Qk14gWfUQm/LaRlP0iO5YwPlg\njckyQaX0Ient3PmLSqUoykuKWH2wR53YJ6Wgb//EkOxdywkrDbAZCGnQgxaO\nakTU30mDaV06HLQjDQmRTHdeozwV+6PF+i71vZPNmsCSI8x/VSex/gMrs2nk\nhSAHnuhUcuEWHshc+FXEO70acz8nkhH7Pw0icDwb50yFZNuekrK4rjUPmXb2\nwBzwFDjpfS6n8JMQz4//jYXyFuDfzYlr97ymWdltR5h8QKs1iZsN++X/5FsA\nO2EltMRqhxcpPApcHB9QQe6CAZFG+1fB8FKOXx6MZMwHqjyEtrL27Q==\n=bDP5\n-----END PGP SIGNATURE-----\n:0x8c1EAB3227250526f133681630c2B191969f8581" + } +} +``` + +
+
+ +```typescript +{ + "event": "space.participant.leave", + "origin": "other", + "timestamp": 1696576531987, + "spaceId": "1032596dea9f24a7a0ee419668f7d39da32a2fb32003a27c6b293cc6668d2a82", + "from": "eip155:0x8c1EAB3227250526f133681630c2B191969f8581", + "to": null, + "raw": { + "verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7QTCRCI26TZ8c3OJBYhBNDtmDIWimjDn9MUIIjbpNnx\nzc4kAAAfFwgAgQkKBS/W7e53maVOne1lob2Qk14gWfUQm/LaRlP0iO5YwPlg\njckyQaX0Ient3PmLSqUoykuKWH2wR53YJ6Wgb//EkOxdywkrDbAZCGnQgxaO\nakTU30mDaV06HLQjDQmRTHdeozwV+6PF+i71vZPNmsCSI8x/VSex/gMrs2nk\nhSAHnuhUcuEWHshc+FXEO70acz8nkhH7Pw0icDwb50yFZNuekrK4rjUPmXb2\nwBzwFDjpfS6n8JMQz4//jYXyFuDfzYlr97ymWdltR5h8QKs1iZsN++X/5FsA\nO2EltMRqhxcpPApcHB9QQe6CAZFG+1fB8FKOXx6MZMwHqjyEtrL27Q==\n=bDP5\n-----END PGP SIGNATURE-----\n:0x8c1EAB3227250526f133681630c2B191969f8581" + } +} +``` + +
+
+ +```typescript +{ + "event": "space.start", + "origin": "other", + "timestamp": 1696576531987, + "spaceId": "1032596dea9f24a7a0ee419668f7d39da32a2fb32003a27c6b293cc6668d2a82", + "from": "eip155:0x8c1EAB3227250526f133681630c2B191969f8581", + "to": null, + "raw": { + "verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7QTCRCI26TZ8c3OJBYhBNDtmDIWimjDn9MUIIjbpNnx\nzc4kAAAfFwgAgQkKBS/W7e53maVOne1lob2Qk14gWfUQm/LaRlP0iO5YwPlg\njckyQaX0Ient3PmLSqUoykuKWH2wR53YJ6Wgb//EkOxdywkrDbAZCGnQgxaO\nakTU30mDaV06HLQjDQmRTHdeozwV+6PF+i71vZPNmsCSI8x/VSex/gMrs2nk\nhSAHnuhUcuEWHshc+FXEO70acz8nkhH7Pw0icDwb50yFZNuekrK4rjUPmXb2\nwBzwFDjpfS6n8JMQz4//jYXyFuDfzYlr97ymWdltR5h8QKs1iZsN++X/5FsA\nO2EltMRqhxcpPApcHB9QQe6CAZFG+1fB8FKOXx6MZMwHqjyEtrL27Q==\n=bDP5\n-----END PGP SIGNATURE-----\n:0x8c1EAB3227250526f133681630c2B191969f8581" + } +} +``` + +
+
+ +```typescript +{ + "event": "space.stop", + "origin": "other", + "timestamp": 1696576531987, + "spaceId": "1032596dea9f24a7a0ee419668f7d39da32a2fb32003a27c6b293cc6668d2a82", + "from": "eip155:0x8c1EAB3227250526f133681630c2B191969f8581", + "to": null, + "raw": { + "verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7QTCRCI26TZ8c3OJBYhBNDtmDIWimjDn9MUIIjbpNnx\nzc4kAAAfFwgAgQkKBS/W7e53maVOne1lob2Qk14gWfUQm/LaRlP0iO5YwPlg\njckyQaX0Ient3PmLSqUoykuKWH2wR53YJ6Wgb//EkOxdywkrDbAZCGnQgxaO\nakTU30mDaV06HLQjDQmRTHdeozwV+6PF+i71vZPNmsCSI8x/VSex/gMrs2nk\nhSAHnuhUcuEWHshc+FXEO70acz8nkhH7Pw0icDwb50yFZNuekrK4rjUPmXb2\nwBzwFDjpfS6n8JMQz4//jYXyFuDfzYlr97ymWdltR5h8QKs1iZsN++X/5FsA\nO2EltMRqhxcpPApcHB9QQe6CAZFG+1fB8FKOXx6MZMwHqjyEtrL27Q==\n=bDP5\n-----END PGP SIGNATURE-----\n:0x8c1EAB3227250526f133681630c2B191969f8581" + } +} +``` + +
diff --git a/docs/spaces/02-Supported-Wallets.mdx b/docs/spaces/02-Supported-Wallets.mdx new file mode 100644 index 0000000000..623db0265b --- /dev/null +++ b/docs/spaces/02-Supported-Wallets.mdx @@ -0,0 +1,63 @@ +--- +id: docs-spaces-supported-wallet-standards +title: Supported Wallet Standards +hide_title: true +slug: ./supported-wallet-standards +displayed_sidebar: pushSpacesSidebar +sidebar_position: 2 +image: "/assets/docs/previews/docs_spaces--supported_wallet_standards.png" +--- + +# Supported Wallet Standards + +Before you begin sending your web3 native notifications from your protocol to wallets. It's important to learn few core concepts to help understand it better. + + + + {"Supported Wallet Standards | Push Spaces | Push Documentation"} + + + +## Types of supported wallet address (Account) + +Push is chain agnostic and even supports messaging wallet addresses, NFT addresses, all evms (and even non-EVM in the future). Below is the list of evergrowing standards that Push is compatible with, either of which you can use as per your requirements — + +import { + ModalContainer, + ModalSmall, + ModalWrapper, + AImp, +} from "@site/src/css/SharedStyling"; + +### Standard Wallet Address + +- **Standard Wallet Address** - Standard wallet is supported and used by default +- _`usage`_ - `0x99A08ac6254dcf7ccc37CeC662aeba8eFA666666` + +```typescript +// Using standard wallet address - defaults to EVM format +const wallet = "0x99A08ac6254dcf7ccc37CeC662aeba8eFA666666"; +``` + +### Chain Specific Wallet Address + +- **Chain Agnostic Wallet Address** - Pass ** \{chain_standard}:\{chainId}:\{account_id} ** format to use this instead of standard wallet address. SDK converts all normal wallet address to chain agnostic ones by default. +- _`usage`_ - `eip155:1:0x99A08ac6254dcf7ccc37CeC662aeba8eFA666666` +- _`usage`_ - `eip155:11155111:0x99A08ac6254dcf7ccc37CeC662aeba8eFA666666` +- _`usage`_ - `eip155:137:0x99A08ac6254dcf7ccc37CeC662aeba8eFA666666` + +```typescript +// Using chain agnostic wallet address, support eip155 currently +const wallet = "eip155:1:0x99A08ac6254dcf7ccc37CeC662aeba8eFA666666"; +``` + +### Lens profile / Cyberconnect profile / Any NFT profile + +- **NFT profile** - Pass **nft:\{chain_standard}:\{nftChainId}:\{nftContractAddress}:\{nftTokenId}** +- _`usage`_ - `nft:eip155:11155111:0x42af3147f17239341477113484752D5D3dda997B:2:1683058528` + +```typescript +// Using nft format, any nfts supported including .lens, .crypto, .polygon or your crypto punks +const wallet = + "nft:eip155:11155111:0x42af3147f17239341477113484752D5D3dda997B:2:1683058528"; +``` diff --git a/docs/spaces/02-playground/01-Playground-Push-SDK-APIs-Playground.mdx b/docs/spaces/02-playground/01-Playground-Push-SDK-APIs-Playground.mdx new file mode 100644 index 0000000000..c3add5709d --- /dev/null +++ b/docs/spaces/02-playground/01-Playground-Push-SDK-APIs-Playground.mdx @@ -0,0 +1,152 @@ +--- +id: docs-spaces-playground-push-sdk-playground +title: Push SDK Playground +hide_title: true +slug: ./push-sdk-playground +displayed_sidebar: pushSpacesSidebar +sidebar_position: 1 +image: "/assets/docs/previews/docs_spaces_playground--push_sdk_playground.png" +--- + +# Push SDK playground + +This tutorial is designed to get you up and going by providing playground containing all API calls coverage for Push SDK. Checkout [Push SDK example](https://github.com/ethereum-push-notification-service/push-sdk/tree/main/packages/examples/sdk-backend-node) that utlizes [@pushprotocol/restapi](https://www.npmjs.com/package/@pushprotocol/restapi) for more info! + + + + {`Push SDK APIs playground tutorial | Push Spaces | Push Documentation`} + + +import Tabs from "@theme/Tabs"; import TabItem from "@theme/TabItem"; + +## Step 1: Clone the Push SDK Repository + +Download the Push SDK repository to your local machine. + + + + +```zsh +git clone https://github.com/ethereum-push-notification-service/push-sdk.git +``` + + + + +## Step 2: Install Dependencies + +Navigate to the SDK directory and install required dependencies. + + + + +```zsh +cd push-sdk +yarn install +``` + + + + +## Step 3: Setup Push SDK Playground + +Navigate to the directory and install required dependencies. + + + + +```zsh +cd packages/examples/sdk-backend-node +yarn install +``` + + + + +## Step 4: Setup Environment Variables + +Create a `.env` file and add values to it according to the given `.env.sample`. + +**Note** - It is possible to run a bare minimum examples without `.env`. All other examples will be skipped. + +```zsh +# WALLET PRIVATE KEY +WALLET_PRIVATE_KEY=your_channel_private_key + +# ENVIRONMENT OF PUSH NETWORK - prod, staging OR dev +PUSH_NODE_NETWORK=staging + +# TO ENABLE API RESPONSES TO BE SHOWN OR HIDDEN - true OR false +SHOW_API_RESPONSE=false + +# NFT CONTRACT ADDRESS +NFT_CONTRACT_ADDRESS_1=your_nft_contract_address + +# NFT CHAIN ID +NFT_CHAIN_ID_1=your_nft_chain_id + +# NFT TOKEN ID +NFT_TOKEN_ID_1=your_nft_token_id + +# NFT HOLDER WALLET PRIVATE KEY +NFT_HOLDER_WALLET_PRIVATE_KEY_1=your_nft_holder_wallet_private_key + +# NFT PROFILE WALLET PASSWORD +NFT_PROFILE_PASSWORD_1=your_nft_profile_password + +# NFT CONTRACT ADDRESS +NFT_CONTRACT_ADDRESS_2=your_nft_contract_address + +# NFT CHAIN ID +NFT_CHAIN_ID_2=your_nft_chain_id + +# NFT TOKEN ID +NFT_TOKEN_ID_2=your_nft_token_id + +# NFT HOLDER WALLET PRIVATE KEY +NFT_HOLDER_WALLET_PRIVATE_KEY_2=your_nft_holder_wallet_private_key + +# NFT PROFILE WALLET PASSWORD +NFT_PROFILE_PASSWORD_2=your_nft_profile_password + +# VIDEO CHAIN ID +VIDEO_CHAIN_ID=your_video_chain_id + +# VIDEO SENDER ADDRESS +VIDEO_SENDER_ADDRESS=your_video_sender_address + +# VIDEO RECIPEINT ADDRESS +VIDEO_RECIPEINT_ADDRESS=your_video_recipient_address + +# VIDEO CHAT ID +VIDEO_CHAT_ID=your_video_chat_id +``` + + + + +```zsh +# Create .env file +touch .env + +# Add different key values according to .env.sample +``` + + + + +## Step 5: Run Playground Examples + + + + +```zsh +yarn start +``` + + + + +### Expected Output + +!["Push SDK API Playground"](/assets/docs/shared/playground/sdk-playground.png "Example of how the playground will look like if setup properly") diff --git a/docs/spaces/02-playground/02-Playground-Push-React-Component-Playground-Tutorial.mdx b/docs/spaces/02-playground/02-Playground-Push-React-Component-Playground-Tutorial.mdx new file mode 100644 index 0000000000..560adf833f --- /dev/null +++ b/docs/spaces/02-playground/02-Playground-Push-React-Component-Playground-Tutorial.mdx @@ -0,0 +1,101 @@ +--- +id: docs-video-playground-push-react-component-playground-example +title: Push SDK React Playground +hide_title: true +slug: ./push-react-component-playground-example +displayed_sidebar: pushSpacesSidebar +sidebar_position: 2 +image: "/assets/docs/previews/docs_video_playground_push_react_component_playground_example--push_sdk_react_playground.png" +--- + +# Push SDK React playground + +This tutorial is designed to get you up and going by providing playground containing a React implementation of Push Space. Checkout [Push SDK React frontend example](https://github.com/ethereum-push-notification-service/push-sdk/tree/main/packages/examples/sdk-frontend-react) that utlizes [@pushprotocol/uiweb](https://www.npmjs.com/package/@pushprotocol/uiweb) [@pushprotocol/restapi](https://www.npmjs.com/package/@pushprotocol/restapi) for more info! + +:::info +The Push SDK React Playground is hosted live. To experiment with the React implementation of Push Space, visit the [Push SDK React Playground Space UI Section](https://react-playground.push.org/#/spaceUI). +::: + + + + {`Push SDK React playground tutorial | Push Video | Push Documentation`} + + + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +## Step 1: Clone the Push SDK Repository + +Download the Push SDK repository to your local machine. + + + + +```zsh +git clone https://github.com/ethereum-push-notification-service/push-sdk.git +``` + + + + +## Step 2: Install Dependencies + +Navigate to the SDK directory and install required dependencies. + + + + +```zsh +cd push-sdk +yarn install +``` + + + + +## Step 3: Install playground dependencies + +React-playground depends on restapi and uiweb packages whose dependencies also need to be installed. + + + + +```zsh +# Navigate to restapi package and install package dependencies +cd packages/restapi && yarn install + +# Nagivate back to root directory +cd ../.. + +# Navigate to uiweb package and install package dependencies +cd packages/uiweb && yarn install + +# Nagivate back to root directory +cd ../.. +``` + + + + +## Step 4: Run Push SDK React playground + + + + +```zsh +yarn nx run examples-sdk-frontend-react:serve:development +``` + + + + +### Expected Output + +The following React app should be running on `http://localhost:4200/` + +!["Push React Component Playground"](/assets/docs/shared/playground/sdk-react-playground.png "Example of how the playground will look like if setup properly") + +## Step 5: Experiment with Video implementation + +Click on the `Space` and `SpaceUI tab to experiment with the React implementation of Push Spaces. Feel free to try creating a space and have your friends join in! diff --git a/docs/spaces/03-Quickstart-Push-Spaces.mdx b/docs/spaces/03-Quickstart-Push-Spaces.mdx new file mode 100644 index 0000000000..033945fae1 --- /dev/null +++ b/docs/spaces/03-Quickstart-Push-Spaces.mdx @@ -0,0 +1,464 @@ +--- +id: docs-spaces-quickstart +title: Quickstart +hide_title: false +slug: ./quickstart +displayed_sidebar: pushSpacesSidebar +sidebar_position: 3 +image: "/assets/docs/previews/docs_spaces-quickstart.png" +--- + +# Quickstart + +Everything you will need to get up and running in 5 mins or less! + + + Quickstart | Push Spaces | Push Documentation + + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +### Installation + + + + +```js +// Install Libraries +npm install @pushprotocol/restapi@latest ethers +``` + + + + +```js +// Install Libraries +npm install @pushprotocol/restapi@latest ethers@^5.7 +``` + + + + +```js +// Install Libraries +npm install @pushprotocol/restapi@latest ethers@^5.7 +``` + + + + +### Import libraries + + + + +```js +// Import restapi for function calls +import { PushAPI, CONSTANTS } from "@pushprotocol/restapi"; + +// Ethers or Viem, both are supported +import { ethers } from "ethers"; +``` + + + + + +```js +// Import restapi for function calls +import { PushAPI, CONSTANTS } from "@pushprotocol/restapi"; + +// Ethers or Viem, both are supported +import { ethers } from "ethers"; +``` + + + + + +```js +// Import restapi for function calls +import { PushAPI, CONSTANTS } from "@pushprotocol/restapi"; + +// Ethers or Viem, both are supported +import { ethers } from "ethers"; +``` + + + + +### Initialize User + + + + +```js +// Creating a random signer from a wallet, ideally this is the wallet you will connect +const signer = ethers.Wallet.createRandom(); + +// Initialize wallet user, use 'PROD' instead of 'STAGING' for mainnet apps +const userAlice = await PushAPI.initialize(signer, { + env: CONSTANTS.ENV.STAGING, +}); +``` + + + + + +```js +// Creating a random signer from a wallet, ideally this is the wallet you will connect +const signer = ethers.Wallet.createRandom(); + +// Initialize wallet user, use 'PROD' instead of 'STAGING' for mainnet apps +const userAlice = await PushAPI.initialize(signer, { + env: CONSTANTS.ENV.STAGING, +}); +``` + + + + + +```js +// Creating a random signer from a wallet, ideally this is the wallet you will connect +const signer = ethers.Wallet.createRandom(); + +// Initialize wallet user, use 'PROD' instead of 'STAGING' for mainnet apps +const userAlice = await PushAPI.initialize(signer, { + env: CONSTANTS.ENV.STAGING, +}); +``` + + + + +### Creating a Space + + + + +```js +// await userAlice.space.create(name, {options}); +const AliceSpace = await userAlice.space.create("My Cool Space", { + description: "This is a space description", // description of the space + participants: { + listeners: [], // wallet addresses of the listeners, can be empty. You can also add listeners later after creating the space + speakers: [], // wallet addresses of the speakers, can be empty. You can also add speakers later after creating the space + }, + image: "data:image/png;base64,iVBORw0K..", // space icon in base64 format + schedule: { + start: new Date("2024-04-24"), + }, +}); +``` + + + + + +```js +// await userAlice.space.create(name, {options}); +const AliceSpace = await userAlice.space.create("My Cool Space", { + description: "This is a space description", // description of the space + participants: { + listeners: [], // wallet addresses of the listeners, can be empty. You can also add listeners later after creating the space + speakers: [], // wallet addresses of the speakers, can be empty. You can also add speakers later after creating the space + }, + image: "data:image/png;base64,iVBORw0K..", // space icon in base64 format + schedule: { + start: new Date("2024-04-24"), + }, +}); +``` + + + + + +```js +// await userAlice.space.create(name, {options}); +const AliceSpace = await userAlice.space.create("My Cool Space", { + description: "This is a space description", // description of the space + participants: { + listeners: [], // wallet addresses of the listeners, can be empty. You can also add listeners later after creating the space + speakers: [], // wallet addresses of the speakers, can be empty. You can also add speakers later after creating the space + }, + image: "data:image/png;base64,iVBORw0K..", // space icon in base64 format + schedule: { + start: new Date("2024-04-24"), + }, +}); +``` + + + + +## Joining a Space + +### Setup Video State + + + + +```js +// data will store the given Space's current state, we will only use this to read the latest state +// and update the UI accordingly +let data = CONSTANTS.SPACE.INITIAL_DATA; + +// setData is a function that will update the state (this is used internally by the space object to manage the space state) +const setData = (fn) => { + data = fn(data); +}; +``` + + + + + +```js +// state to handle given space's current state +const [data, setData] = useState(CONSTANTS.SPACE.INITIAL_DATA); +``` + + + + + +```js +// data will store the given Space's current state, we will only use this to read the latest state +// and update the UI accordingly +let data = CONSTANTS.SPACE.INITIAL_DATA; + +// setData is a function that will update the state (this is used internally by the space object to manage the space state) +const setData = (fn) => { + data = fn(data); +}; +``` + + + + +### Initialize Space API + + + + +```js +// await userAlice.space.initialize(onChange, spaceId); +const userAliceSpace = await userAlice.space.initialize({ + onChange: setData, + spaceId: spaceId, // spaceId of the space you want to join, spaces:3a202e32394d03ba925a8bef908b657deb3d734cb3e61fdff785740dba312da9 +}); +``` + + + + + +```js +// await userAlice.space.initialize(onChange, spaceId); +const userAliceSpace = await userAlice.space.initialize({ + onChange: setData, + spaceId: spaceId, // spaceId of the space you want to join, spaces:3a202e32394d03ba925a8bef908b657deb3d734cb3e61fdff785740dba312da9 +}); +``` + + + + + +```js +// await userAlice.space.initialize(onChange, spaceId); +const userAliceSpace = await userAlice.space.initialize({ + onChange: setData, + spaceId: spaceId, // spaceId of the space you want to join, spaces:3a202e32394d03ba925a8bef908b657deb3d734cb3e61fdff785740dba312da9 +}); +``` + + + + +### Start the Space + +Space Creator can start the space by calling the `start` method on the space object. This will start the space and allow listeners to join the space. + + + + +```js +// await userAliceSpace.start(); +await userAliceSpace.start(); +``` + + + + + +```js +// await userAliceSpace.start(); +await userAliceSpace.start(); +``` + + + + + +```js +// await userAliceSpace.start(); +await userAliceSpace.start(); +``` + + + + +### Activate User Audio + +After starting/Joining a space, you have to enable your audio by calling `activateUserAudio` which allows you to speak and interact audibly within the Space. + + + + +```js +// await userAliceSpace.activateUserAudio(); +await userAliceSpace.activateUserAudio(); +``` + + + + + +```js +// await userAliceSpace.activateUserAudio(); +await userAliceSpace.activateUserAudio(); +``` + + + + + +```js +// await userAliceSpace.activateUserAudio(); +await userAliceSpace.activateUserAudio(); +``` + + + + +### Toggle Mic Audio + +Space Creator can toggle his mic audio by calling the `toggleMic` method on the space object. This will allow him to mute or unmute his mic in the space. + + + + +```js +// await userAliceSpace.current.config({ audio:!data.connectionData.local.audio }); +await userAliceSpace.current.config({ + audio: !data.connectionData.local.audio, +}); +``` + + + + + +```js +// await userAliceSpace.current.config({ audio:!data.connectionData.local.audio }); +await userAliceSpace.current.config({ + audio: !data.connectionData.local.audio, +}); +``` + + + + + +```js +// await userAliceSpace.current.config({ audio:!data.connectionData.local.audio }); +await userAliceSpace.current.config({ + audio: !data.connectionData.local.audio, +}); +``` + + + + +### Initialize Spaces Stream + +Space Stream is used to listen to space events. It is used to listen to any events related to the spaces that the user is associated with. + + + + +```js +// Initialize Stream +const stream = await userAlice.initStream([ + CONSTANTS.STREAM.SPACE, + CONSTANTS.STREAM.SPACE_OPS, +]); + +// Configure stream listen events and what to do +stream.on(CONSTANTS.STREAM.SPACE, (data: any) => { + console.log('new space event', data); +}); + +stream.on(CONSTANTS.STREAM.SPACE_OPS, (data: any) => { + console.log('new space operation event', data); +}); + +// connect stream +await stream.connect(); +``` + + + + + +```js +// Initialize Stream +const stream = await userAlice.initStream([ + CONSTANTS.STREAM.SPACE, + CONSTANTS.STREAM.SPACE_OPS, +]); + +// Configure stream listen events and what to do +stream.on(CONSTANTS.STREAM.SPACE, (data: any) => { + console.log('new space event', data); +}); + +stream.on(CONSTANTS.STREAM.SPACE_OPS, (data: any) => { + console.log('new space operation event', data); +}); + +// connect stream +await stream.connect(); +``` + + + + + +```js +// Initialize Stream +const stream = await userAlice.initStream([ + CONSTANTS.STREAM.SPACE, + CONSTANTS.STREAM.SPACE_OPS, +]); + +// Configure stream listen events and what to do +stream.on(CONSTANTS.STREAM.SPACE, (data: any) => { + console.log('new space event', data); +}); + +stream.on(CONSTANTS.STREAM.SPACE_OPS, (data: any) => { + console.log('new space operation event', data); +}); + +// connect stream +await stream.connect(); +``` + + + diff --git a/docs/spaces/101-Build-Section.mdx b/docs/spaces/101-Build-Section.mdx new file mode 100644 index 0000000000..2702fd4927 --- /dev/null +++ b/docs/spaces/101-Build-Section.mdx @@ -0,0 +1,21 @@ +--- +id: docs-spaces-build-section +title: Build +hide_title: true +slug: ./build +displayed_sidebar: pushSpacesSidebar +sidebar_position: 101 +image: "/assets/docs/previews/docs_spaces_section--build.png" +--- + +# Get Buidling! + +This section covers everything you will require from Push SDK to create any functionality or features related to Push Spaces. + + + Build section | Push Spaces | Push Documentation + + +import DocCardList from "@theme/DocCardList"; + + diff --git a/docs/spaces/102-Playground-Section.mdx b/docs/spaces/102-Playground-Section.mdx new file mode 100644 index 0000000000..9b5e0ed106 --- /dev/null +++ b/docs/spaces/102-Playground-Section.mdx @@ -0,0 +1,21 @@ +--- +id: docs-spaces-playground-section +title: Tutorials +hide_title: true +slug: ./playground +displayed_sidebar: pushSpacesSidebar +sidebar_position: 102 +image: "/assets/docs/previews/docs_spaces_playground_section--tutorials.png" +--- + +# Playground + +This section contains playgrounds that can help you understand the protocol and play with it's functionalities. + + + Playground Section | Push Spaces | Push Documentation + + +import DocCardList from "@theme/DocCardList"; + + diff --git a/sidebars.js b/sidebars.js index b0ed10d86d..b33d348d1a 100644 --- a/sidebars.js +++ b/sidebars.js @@ -242,6 +242,57 @@ const sidebars = { items: [{ type: "autogenerated", dirName: "video/02-playground" }], }, ], + pushSpacesSidebar: [ + { + type: "doc", + id: "spaces/spaces", + }, + { + type: "doc", + id: "spaces/docs-spaces-quickstart", + }, + { + type: "doc", + id: "spaces/docs-spaces-supported-wallet-standards", + }, + { + type: "category", + label: "Build", + link: { + type: "doc", + id: "spaces/docs-spaces-build-section", + }, + collapsed: false, + items: [ + { type: "autogenerated", dirName: "spaces/01-build" }, + { + label: "Build Push Notifications", + type: "link", + href: "https://push.org/docs/notifications", + }, + { + label: "Build Push Chat", + type: "link", + href: "https://push.org/docs/chat", + }, + { + label: "Build Push Video", + type: "link", + href: "https://push.org/docs/video", + }, + ], + }, + // { + // type: "category", + // label: "Playground", + // link: { + // type: "doc", + // id: "spaces/docs-spaces-playground-section", + // }, + // collapsed: true, + // items: [{ type: "autogenerated", dirName: "spaces/02-playground" }], + // }, + ], pushDaoSidebar: [ { type: "doc", diff --git a/src/config/DocsHubList.ts b/src/config/DocsHubList.ts index 0fb3344d2c..8bce978ffd 100644 --- a/src/config/DocsHubList.ts +++ b/src/config/DocsHubList.ts @@ -11,18 +11,18 @@ export interface ITechDocItem { alt?: string; link?: string; target?: string; -}; +} interface ISdkListItem { title: string; - Svg: React.ComponentType>; - PinkSvg?: React.ComponentType>; + Svg: React.ComponentType>; + PinkSvg?: React.ComponentType>; link?: string; } export const QuickstartItems: IQuickstartItem[] = [ { - title: 'Push Notification Quickstart', + title: "Push Notification Quickstart", codeblock: `// Import Push SDK & Ethers import { PushAPI } from '@pushprotocol/restapi'; import { ethers } from 'ethers'; @@ -39,10 +39,10 @@ const apiResponse = await userAlice.channel.send(['*'], { title: 'Hello World Notification', body: 'Web3 native notifications are here!', } -});` +});`, }, { - title: 'Push Chat Quickstart', + title: "Push Chat Quickstart", codeblock: `// Import Push SDK & Ethers import { PushAPI } from '@pushprotocol/restapi'; import { ethers } from 'ethers'; @@ -60,18 +60,19 @@ const aliceMessagesBob = await userAlice.chat.send( ); -` +`, }, -] +]; export const TechDocItems: ITechDocItem[] = [ { - title: 'Notifications', - srcref: 'notification', - alt: 'Logo representing Push Notifications - Push Protocol', - link: '/docs/notifications', - target: '_self', - description: 'Explore different ways of sending and receiving notifications and more.', + title: "Notifications", + srcref: "notification", + alt: "Logo representing Push Notifications - Push Protocol", + link: "/docs/notifications", + target: "_self", + description: + "Explore different ways of sending and receiving notifications and more.", codeblock: `// Initialize wallet user const userAlice = await PushAPI.initialize(signer); @@ -81,15 +82,16 @@ const response = await userAlice.channel.send(['*'], { title: 'Hello World Notification', body: 'Web3 native notifications are here!', } -});` +});`, }, { - title: 'Push Chat', - srcref: 'message', - alt: 'Logo representing Push Chat - Push Protocol', - link: '/docs/chat', - target: '_self', - description: 'Learn about the details of Push Chat and how to do web3 native messaging.', + title: "Push Chat", + srcref: "message", + alt: "Logo representing Push Chat - Push Protocol", + link: "/docs/chat", + target: "_self", + description: + "Learn about the details of Push Chat and how to do web3 native messaging.", codeblock: `// Initialize wallet user const userAlice = await PushAPI.initialize(signer); @@ -97,15 +99,16 @@ const userAlice = await PushAPI.initialize(signer); const aliceMessagesBob = await userAlice.chat.send( '0x99A08ac6254dcf7ccc37CeC662aeba8eFA666666', {content: "Gm gm! It's a me... Mario"} -);` +);`, }, { - title: 'Push Video', - srcref: 'video', - alt: 'Logo representing Push Video - Push Protocol', - link: '/docs/video', - target: '_self', - description: 'Learn about the details of Push Video and how to easily integrate it.', + title: "Push Video", + srcref: "video", + alt: "Logo representing Push Video - Push Protocol", + link: "/docs/video", + target: "_self", + description: + "Learn about the details of Push Video and how to easily integrate it.", codeblock: `// Initialize wallet user const userAlice = await PushAPI.initialize(signer); @@ -120,39 +123,54 @@ const aliceVideo = await userAlice.video.initialize(setData, {stream: stream}); // Request video call await aliceVideoCall.request([recipient]); -` +`, }, { - title: 'Push Spaces', - srcref: 'spaces', - alt: 'Logo representing Push Spaces - Push Protocol', - link: 'https://www.npmjs.com/package/@pushprotocol/restapi#for-spaces', - target: '_blank', - description: 'Learn about Push Spaces, the web3 native, token gated way of conducting spaces.', + title: "Push Spaces", + srcref: "spaces", + alt: "Logo representing Push Spaces - Push Protocol", + link: "/docs/spaces", + target: "_self", + description: + "Learn about Push Spaces, the web3 native, token gated way of conducting spaces.", + codeblock: `// Initialize wallet user +const userAlice = await PushAPI.initialize(signer); + +const [data, setData] = useState(CONSTANTS.SPACE.INITIAL_DATA); + +// Initialize Space +const userAliceSpace = await userAlice.space.initialize({onChange:setData, spaceId:spaceId}); + +// Start a space +await userAliceSpace.start(); +`, }, + { - title: 'Examples', - srcref: 'star', - alt: 'Logo representing examples repo - Push Protocol', - link: 'https://github.com/ethereum-push-notification-service/push-sdk/tree/main/packages/examples', - target: '_blank', - description: 'Examples to showcase the power of Push Protocol’s communication stack.', + title: "Examples", + srcref: "star", + alt: "Logo representing examples repo - Push Protocol", + link: "https://github.com/ethereum-push-notification-service/push-sdk/tree/main/packages/examples", + target: "_blank", + description: + "Examples to showcase the power of Push Protocol’s communication stack.", }, { - title: 'Hackers', - srcref: 'hackers', - alt: 'Logo representing hackers section - Push Protocol', - link: '/docs/hackers', - target: '_self', - description: 'Are you a hacker? Learn how to instantly get started with Push Protocol.', + title: "Hackers", + srcref: "hackers", + alt: "Logo representing hackers section - Push Protocol", + link: "/docs/hackers", + target: "_self", + description: + "Are you a hacker? Learn how to instantly get started with Push Protocol.", }, { - title: 'DAO', - srcref: 'dao', - alt: 'Logo representing Push DAO - Push Protocol', - link: '/docs/dao', - target: '_self', - description: 'DAO of Push Protocol and how to get involved.', + title: "DAO", + srcref: "dao", + alt: "Logo representing Push DAO - Push Protocol", + link: "/docs/dao", + target: "_self", + description: "DAO of Push Protocol and how to get involved.", }, // { // title: 'Showrunners', @@ -163,68 +181,82 @@ await aliceVideoCall.request([recipient]); // description: 'Showrunners Framework and how to boost your web3 communications.', // }, { - title: 'Tokenomics', - srcref: 'tokenomics', - alt: 'Logo representing tokenomics of $PUSH - Push Protocol', - link: '/docs/tokenomics', - target: '_self', - description: 'Learn about the tokenomics of $PUSH which powers the Push Protocol.', + title: "Tokenomics", + srcref: "tokenomics", + alt: "Logo representing tokenomics of $PUSH - Push Protocol", + link: "/docs/tokenomics", + target: "_self", + description: + "Learn about the tokenomics of $PUSH which powers the Push Protocol.", }, { - title: 'Roadmap', - srcref: 'roadmap', - alt: 'Logo representing roadmap of Push Protocol', - link: '/docs/roadmap', - target: '_self', - description: 'Roadmap of Push Protocol and all the exciting things to come.', - } -] + title: "Roadmap", + srcref: "roadmap", + alt: "Logo representing roadmap of Push Protocol", + link: "/docs/roadmap", + target: "_self", + description: + "Roadmap of Push Protocol and all the exciting things to come.", + }, +]; export const SdkItemsList: ISdkListItem[] = [ { - title: 'SDK Starter Kit', - Svg: require('@site/static/assets/docs/arrowupright.svg').default, - PinkSvg: require('@site/static/assets/docs/ArrowUpRight-pink.svg').default, - link: 'https://github.com/ethereum-push-notification-service/push-sdk', + title: "SDK Starter Kit", + Svg: require("@site/static/assets/docs/arrowupright.svg").default, + PinkSvg: require("@site/static/assets/docs/ArrowUpRight-pink.svg").default, + link: "https://github.com/ethereum-push-notification-service/push-sdk", }, { - title: 'REST API', - Svg: require('@site/static/assets/docs/arrowupright.svg').default, - PinkSvg: require('@site/static/assets/docs/ArrowUpRight-pink.svg').default, - link: 'https://www.npmjs.com/package/@pushprotocol/restapi', + title: "REST API", + Svg: require("@site/static/assets/docs/arrowupright.svg").default, + PinkSvg: require("@site/static/assets/docs/ArrowUpRight-pink.svg").default, + link: "https://www.npmjs.com/package/@pushprotocol/restapi", }, { - title: 'React Native', - Svg: require('@site/static/assets/docs/arrowupright.svg').default, - PinkSvg: require('@site/static/assets/docs/ArrowUpRight-pink.svg').default, - link: 'https://www.npmjs.com/package/@pushprotocol/reactnative', + title: "React Native", + Svg: require("@site/static/assets/docs/arrowupright.svg").default, + PinkSvg: require("@site/static/assets/docs/ArrowUpRight-pink.svg").default, + link: "https://www.npmjs.com/package/@pushprotocol/reactnative", }, { - title: 'Socket', - Svg: require('@site/static/assets/docs/arrowupright.svg').default, - PinkSvg: require('@site/static/assets/docs/ArrowUpRight-pink.svg').default, - link: 'https://www.npmjs.com/package/@pushprotocol/socket', + title: "Socket", + Svg: require("@site/static/assets/docs/arrowupright.svg").default, + PinkSvg: require("@site/static/assets/docs/ArrowUpRight-pink.svg").default, + link: "https://www.npmjs.com/package/@pushprotocol/socket", }, { - title: 'UIWeb', - Svg: require('@site/static/assets/docs/arrowupright.svg').default, - PinkSvg: require('@site/static/assets/docs/ArrowUpRight-pink.svg').default, - link: 'https://www.npmjs.com/package/@pushprotocol/uiweb', + title: "UIWeb", + Svg: require("@site/static/assets/docs/arrowupright.svg").default, + PinkSvg: require("@site/static/assets/docs/ArrowUpRight-pink.svg").default, + link: "https://www.npmjs.com/package/@pushprotocol/uiweb", }, { - title: 'UI Embed', - Svg: require('@site/static/assets/docs/arrowupright.svg').default, - PinkSvg: require('@site/static/assets/docs/ArrowUpRight-pink.svg').default, - link: 'https://www.npmjs.com/package/@pushprotocol/uiembed', - } -] - + title: "UI Embed", + Svg: require("@site/static/assets/docs/arrowupright.svg").default, + PinkSvg: require("@site/static/assets/docs/ArrowUpRight-pink.svg").default, + link: "https://www.npmjs.com/package/@pushprotocol/uiembed", + }, +]; export const accordionItems = [ - { title: 'What is Push?', content: 'Content for Section 1' }, - { title: 'How do I contact customer support?', content: 'You can try telekinesis, but we recommend using our contact form instead.' }, - { title: 'What is Push trying to solve?', content: 'Content for Section 3' }, - { title: 'How can I use Push as an end-user?', content: 'Content for Section 3' }, - { title: 'What are the web3 communication products launched by Push?', content: 'Content for Section 3' }, - { title: 'Do I have to pay to send notifications?', content: 'Content for Section 3' }, -]; \ No newline at end of file + { title: "What is Push?", content: "Content for Section 1" }, + { + title: "How do I contact customer support?", + content: + "You can try telekinesis, but we recommend using our contact form instead.", + }, + { title: "What is Push trying to solve?", content: "Content for Section 3" }, + { + title: "How can I use Push as an end-user?", + content: "Content for Section 3", + }, + { + title: "What are the web3 communication products launched by Push?", + content: "Content for Section 3", + }, + { + title: "Do I have to pay to send notifications?", + content: "Content for Section 3", + }, +];