# Huddle01 Auth SDK Add-On

![https://huddle01-assets-frontend.s3.amazonaws.com/general/huddle01-logo-blue.svg](https://huddle01-assets-frontend.s3.amazonaws.com/general/huddle01-logo-blue.svg)

<p align="center">
  <strong>Web3-Native Zoom for Builders/DAOs/NFT Communities</strong>
</p>

<h3 align="center">
  <a href="https://discord.com/invite/AZ5TRMMP55">Community</a>
  <span> · </span>
  <a href="https://huddle01.com/docs">Documentation</a>
</h3>

# Auth SDK Add-On

The Huddle01 React SDK offers a comprehensive suite of hooks, methods and event listeners that allow for seamless real-time audio and video communication with minimal coding required.

## Pre Requisites

Before using the Huddle01 Auth Add-On, you must be acquainted with **`@huddle01/react`** or **`@huddle01/web-core`** or **`@huddle01/react-native`**

## Installing the packages:

To get started with the Huddle01 React SDK, you can install the package using npm or pnpm or yarn:

```bash
npm install @huddle01/auth
```

## Importing Methods:

After installing the package, you can initialize the SDK by using the **`useHuddle01`** hook:

```jsx
import {
  getAccessToken,
  getLensAccessToken,
  getLensMessage,
  getMessage,
} from '@huddle01/auth';
```

## Auth Flow

### 1. Get message

ETH :

```js
const address = '0x15900c698ee356E6976e5645394F027F0704c8Eb';

const message = getMessage(address);
```

Lens :

```js
const address = '0x15900c698ee356E6976e5645394F027F0704c8Eb';

const message = getLensMessage(address);
```

### 2. Sign the message using your methods

E.g. Using wagmi

```jsx
import { useSignMessage } from 'wagmi';

const { signature, signMessage } = useSignMessage;

signMessage(message);
```

### 3. Get Access Token from signature

ETH:

```jsx
const accessToken = getAccessToken(signature, address);
```

Lens:

```jsx
const accessToken = getLensAccessToken(signature, address);
```

### 4. Join Room using Access Token

```jsx
import { useLobby } from '@huddle01/react';

const { joinLobby } = useLobby();

joinLobby('YOUR_ROOM_ID', accessToken);
```

💡 For more information head to https://huddle01.com/docs

💡 For any help reach out to us on
[Discord](https://discord.com/invite/AZ5TRMMP55)
