> For the complete documentation index, see [llms.txt](https://docs.sns.id/dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sns.id/dev/sns-sdk/x-handle-methods.md).

# X Handle Methods

SNS supports the registration of Twitter handles, allowing users to connect their Twitter profile to their wallet as described in this section: [X (formerly Twitter) TLD](/dev/tld/x-formerly-twitter.md).

### X (formerly Twitter) root TLD

```typescript
const TWITTER_ROOT_PARENT_REGISTRY_KEY = new PublicKey(
  "4YcexoW3r78zz16J2aqmukBLRwGq6rAvWzJpkYAXqebv"
);
```

The `.twitter` TLD is owned by the `root` TLD and all twitter handles are subdomains of the `.twitter` TLD.

### Direct look up

To find the Twitter handle associated to a public key

```js
import { getHandleAndRegistryKey } from "@bonfida/spl-name-service";

const pubkey = new PublicKey("FidaeBkZkvDqi1GXNEwB8uWmj9Ngx2HXSS5nyGRuVFcZ");

const [handle] = await getHandleAndRegistryKey(connection, pubkey);
```

### Reverse look up <a href="#reverse-look-up" id="reverse-look-up"></a>

To find the public key associated to a Twitter handle

```js
import { getTwitterRegistry } from "@bonfida/spl-name-service";

const handle = "bonfida";

const registry = await getTwitterRegistry(connection, handle);
const owner = registry.owner.toBase58()
```

\ <br>
