> ## Documentation Index
> Fetch the complete documentation index at: https://www.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate React Native from expo-secure-store to react-native-keychain

> Swap the legacy React Native SDK's secure-storage dependency from expo-secure-store to react-native-keychain.

The legacy React Native SDK (`@dynamic-labs/legacy-react-native-extension`) has moved its secure-storage dependency from [`expo-secure-store`](https://docs.expo.dev/versions/latest/sdk/securestore/) to [`react-native-keychain`](https://github.com/oblador/react-native-keychain). This is a breaking change for any app that installed the SDK directly or through its peer dependencies.

<Info>
  No code changes are required. The SDK manages the storage layer internally; you only need to update your dependency list and rebuild the native layer.
</Info>

<Note>
  The legacy React Native SDK packages have been renamed with a `legacy-` prefix. When you update your dependencies, use `@dynamic-labs/legacy-react-native-extension` (and `legacy-client`, `legacy-react-hooks`, `legacy-viem-extension`, etc.) instead of the unprefixed names. The installation docs already reflect these names.
</Note>

## What changes

| Before                                                        | After                                                                           |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| `expo-secure-store` installed                                 | `react-native-keychain` installed                                               |
| `@dynamic-labs/react-native-extension` (and related packages) | `@dynamic-labs/legacy-react-native-extension` (and related `legacy-*` packages) |
| Native build linked `ExpoSecureStore`                         | Native build links `RNKeychainManager`                                          |

## Migration steps

<Steps>
  <Step title="Replace the dependency">
    Remove `expo-secure-store` from your project and install `react-native-keychain`.

    <Tabs>
      <Tab title="npm">
        ```bash theme={"system"}
        npm uninstall expo-secure-store
        npm install react-native-keychain
        ```
      </Tab>

      <Tab title="yarn">
        ```bash theme={"system"}
        yarn remove expo-secure-store
        yarn add react-native-keychain
        ```
      </Tab>

      <Tab title="pnpm">
        ```bash theme={"system"}
        pnpm remove expo-secure-store
        pnpm add react-native-keychain
        ```
      </Tab>

      <Tab title="Expo">
        ```bash theme={"system"}
        npm uninstall expo-secure-store
        npx expo install react-native-keychain
        ```

        <Note>
          Replace `npm uninstall` with your package manager's remove command (`yarn remove` or `pnpm remove`) if you are not using npm.
        </Note>
      </Tab>
    </Tabs>
  </Step>

  <Step title="Clean and reinstall">
    Delete your lockfile and native build folders so the new dependency is the only secure-storage native module linked.

    <Warning>
      Only delete `ios/` and `android/` if you generated them from `npx expo prebuild` and have no manual native changes. Back up any custom native code first.
    </Warning>

    ```bash theme={"system"}
    rm -rf node_modules ios android package-lock.json
    npm install
    ```
  </Step>

  <Step title="Rebuild the native layer">
    For Expo managed or bare workflows, regenerate and rebuild the native projects.

    <Tabs>
      <Tab title="Expo (managed)">
        ```bash theme={"system"}
        npx expo prebuild
        npx expo run:ios
        npx expo run:android
        ```
      </Tab>

      <Tab title="Bare React Native">
        ```bash theme={"system"}
        cd ios && pod install && cd ..
        npx react-native run-ios
        npx react-native run-android
        ```
      </Tab>

      <Tab title="EAS Build">
        ```bash theme={"system"}
        eas build --profile <your-profile> --platform all
        ```
      </Tab>
    </Tabs>
  </Step>
</Steps>

## Verify the migration

After rebuilding, confirm that:

* `expo-secure-store` no longer appears in your lockfile.
* `react-native-keychain` appears in `node_modules`.
* Your app builds and the SDK initializes without a secure-storage error.
