# 🔐 Alloy SDK

**[Alloy](https://alloy.com/)** helps top banks and fintechs make better decisions using a single API and dashboard to manage KYC/AML, fraud, and more.

## Installation

For npm users:

```shell
npm install @alloyidentity/web-sdk
```

For pnpm users:

```shell
pnpm add @alloyidentity/web-sdk
```

For yarn users:

```shell
yarn add @alloyidentity/web-sdk
```

## Documentation

https://developer.alloy.com/public/docs/document-verification-web-sdk

## Local Testing
Follow the steps below to run the SDK locally!

### Install dependencies

From the repository root:

```shell
npm install
```

### Init Params

Edit the [`example/src/App.jsx`](example/src/App.jsx) file with the appropriate init params:

```javascript
const alloyInitParams = {
  key: '<your-sdk-key>',
  journeyToken: '<your-journey-token>',
  journeyApplicationToken: '<your-journey-application-token>',
};
```

### Environment and API targets

By default the SDK points to Alloy's hosted endpoints (see [`src/config.ts`](src/config.ts)):

- SDK UI (iframe): `https://alloysdk.alloy.co/`
- API: `https://docv-prod-api.alloy.co/`

Override these in `alloy.init()` when testing against a specific Alloy environment:

```javascript
const alloyInitParams = {
  key: '<your-sdk-key>',
  journeyToken: '<your-journey-token>',
  journeyApplicationToken: '<your-journey-application-token>',
  apiUrl: 'https://corekube-dev-alloysdk.api.alloy.com/',
  appUrl: 'https://corekube-dev-alloysdk.app.alloy.com/',
};
```

### Run the SDK in a browser

The [`example/`](example/) app is a small React app that loads the local SDK build via `"alloy": "file:.."`.

To run the example app from the repository root:

```shell
npm run build
cd example
npm install
npm start
```

Open [http://localhost:3000](http://localhost:3000)
