Integration of ZOLOZ HarmonyOS SDK

This document introduces the complete process of manually integrating the ZOLOZ HarmonyOS SDK.

Prerequisites

Before integrating the ZOLOZ HarmonyOS SDK, ensure that your DevEco Studio version is 5.0.5 or later.

Products supported

  • RealID
  • Face Capture
  • ID Recognition

Procedures

Step 1: Download and Install SDK

Method 1: Install via command line from the third-party library repository

  1. Open the ZOLOZ HarmonyOS repository.
  2. Select the desired ZOLOZKit version (it is recommended to use the latest version).
  3. In the root directory of the Hap/Har that needs to be integrated, install the SDK using the following command.
copy
ohpm install @zoloz/zolozkit@<version\>  

Note:

4. Verify installation.

After installation, the dependencies section in the on-package.json file at the root directory should display zolozkit.

image.png

Method 2: Manual download and installation

  1. Open the ZOLOZ HarmonyOS repository.
  2. Select the desired ZOLOZKit version (it is recommended to use the latest version), and download the corresponding zolozkit.har package.
  3. Drag the downloaded SDK file (.har) into the libs directory of your project.

image.png

  1. Manually add the following dependency configuration in the on-package.json file at the root directory of your project.
copy
  "dependencies": {
    "zolozkit": "file:../zolozkit"
  }

image

Step 2: Importing SDK into Main Project

Run the following codes to import SDK into main project.

copy
//import zoloz
import {ZolozFacade,ZolozRequest,ZolozResponse} from "@zoloz/zolozkit"

//use
  
const request = new ZolozRequest(clientCfg, { rsaPubKey });
const response= await ZolozFacade.getInstance().startWithRequest(getContext(this),request);

Verify Integration Result

Verify Har Integration

Add the following test codes, if the metainfo string is retrieved successfully, the SDK integration is confirmed.

copy
//import zoloz
import {ZolozFacade} from "@zoloz/zolozkit"

//Test calling ZolozFacade getMetaInfo
const metainfo = ZolozFacade.getMetaInfo()