> **Key takeaway:**  ☞   The renaming of "Ledger Live" to "Ledger Wallet" and\
>      "wallet" (in the hardware sense) to "signer" is still in progress.\
>      This page may contain legacy references that will be updated.

# Using the Storage Module in Wallet API Core Client

The Storage Module provides a way to interact with Ledger Wallet's internal storage. You can store and retrieve data using key-value pairs.

## Storage Module Overview

Access the Storage module via `walletApiClient.storage`.

### Methods:

#### 1. Get Data

Retrieve data from Ledger Wallet's internal storage by specifying a key. You can also specify a store ID to retrieve data from a particular store.

```javascript
walletApiClient.storage.get(key: string, storeId?: string): Promise<string | undefined>
```

**Parameters**:

- `key` (required): A string representing the key of the data you want to retrieve.
- `storeId` (optional): A string representing the ID of the store from which you want to retrieve data.

**Returns**: A promise that resolves with the value as a string or `undefined` if the key does not exist.

[**Required permission**:](https://developers.ledger.com/docs/ledger-live/discover/guides/wallet-api/appendix/manifest#permissions)
`storage.get`

##### Example:

```javascript
async function getData(walletApiClient, key, storeId) {
  try {
    const value = await walletApiClient.storage.get(key, storeId);
    console.log("Retrieved Value:", value);
  } catch (error) {
    console.error("Error retrieving data:", error);
  }
}
```

#### 2. Set Data

Store data in Ledger Wallet's internal storage. You can specify a key and value, and optionally provide a store ID to store data in a specific store.

```javascript
walletApiClient.storage.set(key: string, value: string, storeId?: string): Promise<void>
```

**Parameters**:

- `key` (required): A string representing the key under which you want to store the data.
- `value` (required): A string representing the data you want to store.
- `storeId` (optional): A string representing the ID of the store where you want to store the data.

**Returns**: A promise that resolves when the data is successfully stored. There is no return value.

[**Required permission**:](https://developers.ledger.com/docs/ledger-live/discover/guides/wallet-api/appendix/manifest#permissions)
`storage.set`

##### Example:

```javascript
async function setData(walletApiClient, key, value, storeId) {
  try {
    await walletApiClient.storage.set(key, value, storeId);
    console.log("Data successfully stored.");
  } catch (error) {
    console.error("Error storing data:", error);
  }
}
```

## Handling Errors

Make sure to handle errors gracefully and provide appropriate feedback to the user. Additionally, always remember to disconnect the `WindowMessageTransport` when you're done interacting with the  API to free up resources.
