# Expo quickstart (/docs/swivy/expo-quickstart)

<Callout type="warn" title="Preview: Swivy is not generally available">
Swivy is a **staging/testnet preview using software custody**, not a production custody service. All six public SDK packages are available at **1.0.1**. Use test assets only. [Set up the preview](/docs/swivy/preview-setup) or [request project access](/docs/swivy/request-access).
</Callout>

The mobile SDK, `@swivy/expo`, covers email login, session storage on the device, wallets, passkey approval through a native adapter, intents and Sign in with Swop.

<Callout title="Mobile limits today">
`split_custody` local signing isn't at browser parity on mobile yet. Use the default `managed_tee` custody on iOS and Android for now.
</Callout>

Use the API base URL shown in your environment’s Integrations screen. The public docs/dashboard alias is not the runtime API base URL. Follow the [SDK version and dependency guidance](/docs/swivy/preview-setup) before installing.

## 1. Install [#1-install]

```bash
npm install @swivy/expo@1.0.1
npx expo install expo-auth-session expo-secure-store expo-crypto
```

## 2. Keep the session in secure storage [#2-keep-the-session-in-secure-storage]

```ts
import * as SecureStore from 'expo-secure-store';
import { createAsyncStorageSessionPersistence } from '@swivy/expo';

export const sessionPersistence = createAsyncStorageSessionPersistence({
  getItem: (key) => SecureStore.getItemAsync(key),
  setItem: (key, value) => SecureStore.setItemAsync(key, value),
  removeItem: (key) => SecureStore.deleteItemAsync(key),
});
```

## 3. Plug in your passkey library [#3-plug-in-your-passkey-library]

Swivy doesn't force a passkey package. You provide an adapter that returns the WebAuthn JSON Swivy expects.

```ts
import type { SwivyExpoPasskeyAdapter } from '@swivy/expo';

export const passkeyAdapter: SwivyExpoPasskeyAdapter = {
  async isSupported() { return true; },
  async register(options, context) { return nativePasskeyRegister(options, context); },
  async authenticate(options, context) { return nativePasskeyAuthenticate(options, context); },
};
```

## 4. Create the client [#4-create-the-client]

```ts
import { SwivyExpoClient } from '@swivy/expo';

export const swivy = await SwivyExpoClient.create({
  baseUrl: process.env.EXPO_PUBLIC_SWIVY_BASE_URL!,
  appId: process.env.EXPO_PUBLIC_SWIVY_APP_ID!,
  publishableKey: process.env.EXPO_PUBLIC_SWIVY_PUBLISHABLE_KEY!,
  sessionPersistence,
  passkeyAdapter,
});
```

## 5. Sign in and load wallets [#5-sign-in-and-load-wallets]

```ts
await swivy.requestEmailCode('alice@example.com');
await swivy.verifyEmailCode('alice@example.com', '123456');

const evm = await swivy.ensureEmbeddedWallet('evm', { label: 'Primary wallet' });
const sol = await swivy.ensureEmbeddedWallet('solana', { label: 'Primary wallet' });
```

## 6. Approve and send [#6-approve-and-send]

```ts
const passkey = await swivy.ensurePasskey('Primary passkey');
const approval = await swivy.approveWithPasskey(passkey.authMethod.id, 'intent_approval');

const intent = await swivy.createTransactionIntentAndWait({
  accountId: evm.account.id,
  chain: 'evm',
  challengeId: approval.challenge.challengeId,
  payload: {
    network: 'base-sepolia',
    transaction: { to: '0x1111111111111111111111111111111111111111', value: '0x0', data: '0x' },
  },
});
```

## 7. Sign in with Swop from a mobile app [#7-sign-in-with-swop-from-a-mobile-app]

Run the hosted authorize flow with `expo-auth-session`, then turn the token into a session:

```ts
const discovery = await swivy.getOidcDiscovery('app_swop_...');
// …run the authorization-code + PKCE flow against discovery.authorization_endpoint…
const session = await swivy.exchangeOidcToken(idToken);
```

See [Sign in with Swop](/docs/swivy/sign-in-with-swop) for the full flow.
