open-index/open-npm huggingface dataset:
npm package: @ihavealink.app/expo
Description: IHaveALink expo module
Author: Ahmed Ben Gayess
Latest version: 0.6.3

# IHaveALink Expo SDK

A lightweight deep linking and deferred deep linking SDK for Expo apps.

## Installation

```bash
npm install @ihavealink/expo
```

## Quick start

```ts
import IHaveALink, {
  checkForDeferredLink,
  createLink,
  initialize,
  resolveLink,
} from "@ihavealink/expo";

await initialize({ publishableKey: "pk_..." });

const deferred = await checkForDeferredLink();
if (deferred) {
  // Route user based on deferred link data
}

const createResult = await createLink({
  title: "My Link",
  description: "Created from app",
  tags: ["mobile"],
});

if (createResult.success) {
  // createResult.link contains the created link
} else {
  // createResult.error contains error details
}

const resolveResult = await resolveLink("https://myapp.ihavea.link/abc123");
if (resolveResult.success) {
  // resolveResult.link contains the resolved link data
} else {
  // resolveResult.error contains error details
}
```

## Design choices in v1

- Domain validation is dynamic: the SDK fetches your verified custom domains from the server and validates incoming URLs against that allowlist. Default base domain is `ihavea.link`.
- Link creation is server-side: to keep publishable keys safe and align with best practices, client apps should call your backend to create links.
- Consistent device fingerprinting: the SDK sends CSS pixels, DPR (2 decimals), timezone, language and color depth. The server performs fuzzy matching with adaptive thresholds.
- Error handling: all functions use discriminated unions for consistent error handling patterns.

## Headers sent by SDK

- `X-Publishable-Key`: your publishable key
- `X-App-Bundle-Id`: host app bundle identifier
- `X-SDK-Platform`: `iOS` or `Android`
- `X-SDK-Version`: SDK version string

## Notes

- Rate limiting and bot protections should be configured on the server.
- Apple Search Ads integration and additional matching signals can be added in future versions.