React Native

iOS App Attest and Android Play Integrity in both auth modes.

pnpm add @securelink/react-native react-native-keychain

Production requirements

  1. Keychain / Keystore — install react-native-keychain (or pass Expo SecureStore). Memory fallback is off unless allowInsecureMemoryStorage: true (demos only).
  2. Attestation — pass getAttestationToken for App Attest / Play Integrity. Stub proofs are off unless allowInsecureDevAttestation: true (demos only).
  3. Server must set tokenHashSecret, real attestation verifiers, and not use allowInsecureDevMode.

Anonymous

import {
  createReactNativeSecureLink,
  createKeychainStorage,
} from "@securelink/react-native";
import * as Keychain from "react-native-keychain";
 
const client = createReactNativeSecureLink({
  baseUrl: "https://api.example.com",
  authMode: "anonymous",
  nativePlatform: "ios",
  secureStorage: createKeychainStorage(Keychain), // or rely on auto-detect
  getAttestationToken: (challenge) => nativeAppAttest(challenge),
});

Custom auth

const client = createReactNativeSecureLink({
  baseUrl: "https://api.example.com",
  authMode: "customAuth",
  nativePlatform: "android",
  getAttestationToken: (challenge) => playIntegrity(challenge),
  authorization: {
    async getAuthorization() {
      return { authorization: `Bearer ${userToken}`, scheme: "custom" };
    },
  },
});

customAuth skips anonymous identity; attestation stays on by default.