authmatech-sdk-web
Version:
A lightweight JavaScript SDK for seamless, passwordless mobile number verification through mobile operator network (MNOs).
110 lines (70 loc) • 3.04 kB
Markdown
## Authmatech SDK WEB
A lightweight JavaScript SDK for seamless, passwordless mobile number verification through mobile operator network (MNOs).
### Client-side Only
The SDK runs entirely in front-end browser code; no server integration is required.
### Mobile Browser Only
This library is intended for use exclusively in mobile browsers.
## Overview
Authmatech SDK WEB enables silent mobile-network-based verification by integrating with Authmatech. It handles getting Authmatech code, response parsing, and error handling for both modern module bundlers and browser `<script>` tags.
## Features
* **Client-side Only**: The SDK runs entirely in the browser—no server-side components needed.
* **Mobile Browser Only**: Designed for mobile browsers; desktop usage is not supported.
* **Automatic Getting Authmatech Code**
* **Error Handling**: Built‑in checks for network protocol and flow errors.
* **Flexible Integration**: Supports ES modules, CommonJS bundlers, and UMD for script tags.
## Installation
Install via npm:
```bash
npm install authmatech-sdk-web
```
Or yarn:
```bash
yarn add authmatech-sdk-web
```
## Usage
Below are two common integration patterns:
### ES Module (Webpack, Rollup, Parcel, etc.)
Import and initialize the check in your modern build:
```js
import { initAuthmatechCheck } from 'authmatech-sdk-web';
// 1) Generate or supply your transaction ID (prefix will be provided by us)
const transactionId = 'prefix-550e8400-e29b-41d4-a716-446655440000';
// 2) Call the SDK
initAuthmatechCheck({
transactionId,
checkUrl: 'https://web.authmatech.com/verify'
});
```
### UMD Bundle (Browser)
Include the prebuilt UMD bundle via a CDN or your host:
```html
<script src="https://cdn.jsdelivr.net/npm/authmatech-sdk-web@1.0.2/dist/authmatech-sdk-web.umd.min.js"></script>
<script>
(function(){
// 1) Your generated transaction ID
var transactionId = 'prefix-550e8400-e29b-41d4-a716-446655440000';
// 2) Fire the check
AuthmatechSDKWeb.initAuthmatechCheck({
transactionId: transactionId,
checkUrl: 'https://web.authmatech.com/verify'
});
})();
</script>
```
## API
#### `initAuthmatechCheck(config)`
| Option | Type | Required | Description |
| --------------- | ------ | -------- | ------------------------------------------------------------- |
| `transactionId` | string | Yes | Your full transaction ID (format: `prefix-<UUIDv4>`). |
| `checkUrl` | string | Yes | Will be provided by Authmatech |
Throws an error if:
* `transactionId` is missing or empty.
* `checkUrl` is missing, invalid, or not using `https:` protocol.
## Browser Compatibility
* Modern browsers supporting ES modules or UMD script tags.
## Security & Privacy
* **No Local Storage**: No personal data is stored by the SDK.
## License
Distributed under the MIT License.