> This page is for Browser SDK, version v4 (default).
> For other versions, use one of these documentation indexes:
> - v4 (default): https://signalwire.com/docs/browser-sdk/v4/llms.txt
> - v3: https://signalwire.com/docs/browser-sdk/v3/llms.txt
> - v2: https://signalwire.com/docs/browser-sdk/v2/llms.txt

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# Storage

> Key-value storage interface for persisting SDK preferences and state.

Key-value storage interface for persisting SDK preferences and state.

## **Methods**

### clear()

```ts
clear(scope): Promise<void>
```

Clears all keys in the given scope. Implementations may scope the clear to SDK keys only.

#### Parameters

**`scope`** `StorageScope` — required

Storage scope (e.g. session vs. persistent).

---

#### Returns

`Promise<void>`

---

### getItem()

```ts
getItem(key, scope): Promise<string | null>
```

#### Parameters

**`key`** `string` — required

Storage key to read or write.

---

**`scope`** `StorageScope` — required

Storage scope (e.g. session vs. persistent).

---

#### Returns

`Promise<string | null>`

---

### removeItem()

```ts
removeItem(key, scope): Promise<void>
```

#### Parameters

**`key`** `string` — required

Storage key to read or write.

---

**`scope`** `StorageScope` — required

Storage scope (e.g. session vs. persistent).

---

#### Returns

`Promise<void>`

---

### setItem()

```ts
setItem(key, value, scope): Promise<void>
```

#### Parameters

**`key`** `string` — required

Storage key to read or write.

---

**`value`** `string | null` — required

Value to write, or `null` to clear the key.

---

**`scope`** `StorageScope` — required

Storage scope (e.g. session vs. persistent).

---

#### Returns

`Promise<void>`