@layers/amba-expo
v4.3.1
Published
amba SDK for Expo apps — wraps @layers/amba-react-native with Expo-native conveniences: SecureStore-backed token persistence, expo-apple-authentication + expo-auth-session sign-in wrappers, expo-notifications push-token capture, config plugin for expo pre
Keywords
Readme
@layers/amba-expo
Amba is the agent-native backend-as-a-service for mobile and web apps. This package is the Expo config plugin and a re-export of @layers/amba-react-native. Use it if you're on Expo (managed or bare workflow).
What's new in 2.0.0
Tracks @layers/[email protected] — pure-JS HTTP client, smaller bundles, no native runtime dependency. The public API is unchanged; no code changes required when upgrading from 1.x.
Install
npx expo install @layers/amba-expo @react-native-async-storage/async-storage expo-secure-storeOn iOS and Android builds, Amba.configure() stores the session and refresh tokens in SecureStore (Keychain on iOS, EncryptedSharedPreferences on Android) when expo-secure-store and AsyncStorage are both installed and SecureStore is available on the device. Otherwise it logs a warning and keeps the tokens in memory, so users sign in again after each launch; tokenStorage: "asyncStorage" opts into plain AsyncStorage, where anyone who can read the app's files or an unencrypted backup can copy them. Install expo-secure-store in every app that signs users in.
Amba.signInWithApple() and Amba.signInWithGoogle({...}) bind every attempt to a one-time nonce drawn from the secure random source the SDK installs at Amba.configure() (react-native-get-random-values, which ships with the SDK).
Configure the plugin
// app.json
{
"expo": {
"plugins": [
[
"@layers/amba-expo",
{
"scheme": "myapp",
"googleIosClientId": "…"
}
]
]
}
}The plugin writes native config only: scheme adds the deep-link URL scheme on iOS and Android, and googleIosClientId adds the Google sign-in redirect scheme on iOS. Your project id and client key go to Amba.configure() at runtime.
Then rebuild your native projects (npx expo prebuild or EAS Build).
First call
import { Amba } from "@layers/amba-expo";
await Amba.configure({
projectId: process.env.EXPO_PUBLIC_AMBA_PROJECT_ID!,
clientKey: process.env.EXPO_PUBLIC_AMBA_CLIENT_KEY!,
});
await Amba.auth.signInAnonymously();
await Amba.events.track("app_opened");Amba is the same singleton exported by @layers/amba-react-native — see that package for the full surface.
Docs
Full reference: https://docs.amba.dev/sdk/expo.
License
MIT
