> For the complete documentation index, see [llms.txt](https://pintswap.gitbook.io/pintswap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pintswap.gitbook.io/pintswap/pintswap-sdk/account.md).

# Account

Methods used to customize an account's data including username, biography, and profile image.

## Get Pint Peer Address

```typescript
pintswap.address
```

Returns the pint address for the PintSwap `PeerId`

A pint address is an encoding of the underlying libp2p multihash, converted to bech32 with a `pint` prefix.

```typescript
const pintAddress = pintswap.address;
console.log(pintAddress);
// pint1zgsw52stcg9kgy4y6qvl3rpu0dzwzdcy9m3yy4mdnfm22c5ht90jh8qtvlwzh
```

## Assign Username

```typescript
await pintswap.registerName(name)
```

Uses the `/pintswap/0.1.0/ns/register` protocol handler.

Registers a name on the PintSwap nameservers. Currently, only `.drip` nameservers are available for registration, however there are plans to increase options. The nameserver this request is routed to depends on the table stored in `NS_MULTIADDRS` exported by @pintswap/sdk

```typescript
await pintswap.registerName('wock.drip');
//{ status: 0 }
```

The default `pintswap-ns` implementation requires that you retain custody of your `PeerId` for as long as you wish to use the name registered. If the `PeerId` is lost, the name cannot be released unless nameserver operators release it intentionally.

## Assign Profile Picture

```typescript
pintswap.setImage(buffer)
```

Registers an image per peer that is used as the peer's profile picture. It is important to note that an array buffer must be passed into the parameters of this method.

An implementation of the following can be found below that is used as the event handler for a `<input type="file" />`:

```typescript
async function handleImageChange(e?: ChangeEventHandler<HTMLInputElement>) {
    const image = (e.target.files as any)[0] ?? null;
    const buffer = Buffer.from(await image.arrayBuffer());
    pintswap.setImage(buffer);
}
```

## Assign Biography

```typescript
pintswap.setBio(bio: string)
```

Registers a biography for the connected peer.
