@ideem/zsm-react-native
Version:
ZSM makes 2FA easy and invisible for everyone, all the time, using advanced cryptography like MPC to establish cryptographic proof of the origin of any transaction or login attempt, while eliminating opportunities for social engineering. ZSM has no relian
155 lines (108 loc) • 4.17 kB
Markdown
# ZSM Client SDK for React Native
## Contents
This SDK contains the resources needed to learn about Ideem's FIDO2 Authenticator and
Universal MFA capabilities, and integrate them into your own React native applications.
These resources include documentation and example applications.
**NOTE:** Prior to integrating the SDK into your own applications, please reach out to Ideem
support, <a href="mailto:support@useideem.com">support@useideem.com</a>, to obtain configuration
## Getting Started
### Prerequisites
1. **React Native Version**: `>=0.60`
2. **Node.js Version**: `>=12.0.0`
3. An **Application ID** from Ideem. Reach out to [support@useideem.com](mailto:support@useideem.com) to obtain one.
### Installation
#### 1. Install the Package
```bash
npm install @ideem/zsm-react-native
```
Or with Yarn:
```bash
yarn add @ideem/zsm-react-native
```
#### 2. Link Native Modules
This library uses React Native's auto-linking. However, if manual linking is necessary:
- **iOS**: Add the following to your `Podfile`:
```ruby
pod 'zsm-react-native', :path => '../node_modules/@ideem/zsm-react-native'
```
Then run:
```bash
cd ios && pod install
```
- **Android**: No additional setup is required unless auto-linking is disabled.
#### 3. Verify Installation
Check the library is correctly installed and linked:
```bash
react-native doctor
```
### Usage
#### **Basic Integration Example**
Here’s how to initialize and use the SDK:
```javascript
import { UMFAClient } from '@ideem/zsm-react-native';
const config = {
application_id: 'YOUR_APPLICATION_ID',
host_url: 'https://zsm-authenticator-demo.useideem.com/',
application_environment: 'PRODUCTION',
api_key: 'YOUR_API_KEY',
consumer_id: 'user123', // Dynamic user identifier
};
const client = new UMFAClient(config);
async function login(username) {
try {
const isEnrolled = await client.checkEnrollment(username);
const token = isEnrolled
? await client.authenticate(username)
: await client.enroll(username);
console.log('Authentication Token:', token);
} catch (error) {
console.error('Error during authentication:', error.message);
}
}
```
## Example Application
You can find example applications in the `examples/` directory. These include:
1. **Basic Authentication**: Demonstrates login and enrollment.
2. **Payment Flow**: Simulates payment using authentication.
To run an example, e.g. for the `umfa` example:
1. Navigate to the example directory:
```bash
cd examples/umfa
```
2. Install dependencies:
```bash
npm install
```
3. Start the development server:
```bash
npm start
```
## Troubleshooting
- **React Native Environment Issues**:
Ensure your environment is correctly configured for React Native. Refer to the [React Native Environment Setup](https://reactnative.dev/docs/environment-setup).
- **Native Dependency Issues**:
- Run `pod install` for iOS.
- Verify your `android/app/build.gradle` for proper linking.
### Documentation
Documentation can be viewed online at:
* *UMFA*: <a href="https://docs.useideem.com/umfa_sdk/index.html">https://docs.useideem.com/umfa_sdk/index.html</a>.
* *FIDO2*: <a href="https://docs.useideem.com/fido2_sdk/index.html">https://docs.useideem.com/fido2_sdk/index.html</a>.
## Support
Support can be received by emailing <a href="mailto:support@useideem.com">support@useideem.com</a>
or accessing our Customer Support site at <a href="https://support.useideem.com">https://support.useideem.com</a>
## Legal
Copyright (C) Ideem, Inc. - All Rights Reserved
This source code and other resources included in this SDK are protected under international
copyright law. All rights reserved and protected by the copyright holders.
The files included in this distribution are confidential and only available to authorized
individuals with the permission of the copyright holders. If you encounter this file and
do not have permission, please contact the copyright holders and delete this file.
This library is proprietary and licensed under Ideem's terms of use. Unauthorized use or distribution is prohibited.