Note
This package supports only new architecture.
Aziface SDK adapter to react native.
- Installation
- Usage
- API
- Types
- Components
- Dynamic Strings
- Theme
- Vocal Guidance
- Enabling Camera (iOS only)
- Integration guide
- Expo
- Limitations
- Contributing
- License
npm install @azify/aziface-mobile
# or
yarn add @azify/aziface-mobileOnly iOS:
cd ios && pod install && cd ..Every integration follows the same three steps:
- (Optional) Customize the SDK with
setTheme,setLocaleandsetDynamicStrings. - Initialize the SDK once with
initialize. - Start a flow (
enroll,authenticate,liveness,photoMatchorphotoScan) and read the returnedProcessor.
import {
initialize,
enroll,
Errors,
type Params,
type Headers,
} from '@azify/aziface-mobile';
const params: Params = {
deviceKeyIdentifier: 'YOUR_DEVICE_KEY_IDENTIFIER',
baseUrl: 'YOUR_BASE_URL',
isDevelopment: true, // use `false` in production
};
const headers: Headers = {
'x-token-bearer': 'YOUR_TOKEN_BEARER',
// your headers
};
export async function startEnrollment() {
// 1. Initialize once, before calling any other flow.
const initialized = await initialize({ params, headers });
if (!initialized) {
console.warn('Aziface SDK could not be initialized');
return;
}
// 2. Open the face scan. The promise resolves when the session ends.
const result = await enroll();
// 3. Always check `isSuccess`: session errors are resolved, not thrown.
if (result.isSuccess) {
console.log('Enrolled!', result.data?.externalDatabaseRefID);
} else if (result.error?.code === Errors.UserCancelledFaceScan) {
console.log('The user closed the session');
} else {
console.warn(result.error?.code, result.error?.message);
}
}| Situation | What happens |
|---|---|
initialize without deviceKeyIdentifier/baseUrl |
Promise rejects. error.message is ConfigNotProvided or ParamsNotProvided. |
initialize fails inside the SDK (invalid key, network, unsupported device, etc.) |
Promise resolves false. |
| A flow finishes successfully | Promise resolves { isSuccess: true, data, error: null }. |
| A flow fails or is cancelled | Promise resolves { isSuccess: false, data: null, error: { code, message } }. See Errors. |
Important
Only one session can run at a time. If you call a flow (or initialize) while another one is still running, the new call is ignored and its promise never settles. Disable your buttons while a session is in progress.
The request headers are:
- every key you passed in
Headers; Content-Type: application/json;X-Device-Key: yourdeviceKeyIdentifier;X-Testing-API-Header: only whenisDevelopmentistrue.
A screen with one button per flow. The FaceView component is used to listen to SDK events.
import { useState } from 'react';
import { StyleSheet, Text, TouchableOpacity, ScrollView } from 'react-native';
import {
initialize,
enroll,
authenticate,
liveness,
photoMatch,
photoScan,
setLocale,
FaceView,
type Params,
type Headers,
type Processor,
type Locale,
} from '@azify/aziface-mobile';
type Flow = 'enroll' | 'authenticate' | 'liveness' | 'photoMatch' | 'photoScan';
const FLOWS: Record<Flow, (data?: object) => Promise<Processor>> = {
enroll,
authenticate,
liveness,
photoMatch,
photoScan,
};
const LOCALES: Locale[] = ['default', 'en', 'es', 'pt-BR'];
export default function App() {
const [isInitialized, setIsInitialized] = useState(false);
const [isRunning, setIsRunning] = useState(false);
const [locale, setCurrentLocale] = useState<Locale>('default');
const isDisabled = !isInitialized || isRunning;
const onInitialize = async () => {
const params: Params = {
isDevelopment: false,
deviceKeyIdentifier: 'YOUR_DEVICE_KEY_IDENTIFIER',
baseUrl: 'YOUR_BASE_URL',
isDevelopment: true,
};
const headers: Headers = {
'x-token-bearer': 'YOUR_TOKEN_BEARER',
// Any other header is forwarded to your backend on every request.
'x-api-key': 'YOUR_X_API_KEY',
};
try {
setIsInitialized(await initialize({ params, headers }));
} catch (error) {
// `deviceKeyIdentifier` or `baseUrl` is missing.
setIsInitialized(false);
console.error(error);
}
};
const onFlow = async (flow: Flow) => {
setIsRunning(true);
try {
const result = await FLOWS[flow]();
if (result.isSuccess) {
console.log(flow, 'succeeded', result.data);
} else {
console.warn(flow, 'failed', result.error?.code);
}
} finally {
setIsRunning(false);
}
};
const onLocale = () => {
const next = LOCALES[(LOCALES.indexOf(locale) + 1) % LOCALES.length]!;
setCurrentLocale(next);
setLocale(next);
};
return (
<ScrollView contentContainerStyle={styles.scrollContent}>
<FaceView
style={styles.content}
onInitialize={(initialized) => console.log('onInitialize', initialized)}
onOpen={(opened) => console.log('onOpen', opened)}
onClose={(closed) => console.log('onClose', closed)}
onCancel={(cancelled) => console.log('onCancel', cancelled)}
onError={(hasError) => console.log('onError', hasError)}
>
<TouchableOpacity style={styles.button} onPress={onInitialize}>
<Text style={styles.buttonText}>Initialize SDK</Text>
</TouchableOpacity>
{(Object.keys(FLOWS) as Flow[]).map((flow) => (
<TouchableOpacity
key={flow}
style={[styles.button, isDisabled && styles.disabled]}
disabled={isDisabled}
onPress={() => onFlow(flow)}
>
<Text style={styles.buttonText}>{flow}</Text>
</TouchableOpacity>
))}
<TouchableOpacity style={styles.button} onPress={onLocale}>
<Text style={styles.buttonText}>Locale: {locale}</Text>
</TouchableOpacity>
</FaceView>
</ScrollView>
);
}
const styles = StyleSheet.create({
scrollContent: {
flexGrow: 1,
},
content: {
flex: 1,
justifyContent: 'center',
gap: 16,
padding: 24,
},
button: {
alignItems: 'center',
padding: 20,
borderRadius: 16,
backgroundColor: '#4a68b3',
},
disabled: {
opacity: 0.5,
},
buttonText: {
fontSize: 16,
fontWeight: 'bold',
color: 'white',
},
});| Methods | Return Type | Platform |
|---|---|---|
initialize |
Promise<boolean> |
All |
enroll |
Promise<Processor> |
All |
authenticate |
Promise<Processor> |
All |
liveness |
Promise<Processor> |
All |
photoMatch |
Promise<Processor> |
All |
photoScan |
Promise<Processor> |
All |
setLocale |
void |
All |
vocal |
void |
All |
The initialize of the Aziface SDK is the process of configuring and preparing the SDK for use before any face capture, liveness, authentication, or identity verification sessions can begin.
During initialization, the application provides the SDK with the required configuration data, such as the device key identifier, base URL, and x-token-bearer. The SDK validates these parameters, performs internal setup, and prepares the necessary resources for secure camera access, biometric processing, and user interface rendering.
A successful initialization confirms that the SDK is correctly licensed, properly configured for the target environment, and ready to start user sessions. If initialization fails due to invalid keys, network issues, or unsupported device conditions, the SDK returns boolean information (true or false) so the application can handle the failure gracefully and prevent session startup.
Initialization is a mandatory step and must be completed once during the application lifecycle (or as required by the platform) before invoking any Aziface SDK workflows.
try {
const initialized = await initialize({
params: {
deviceKeyIdentifier: 'YOUR_DEVICE_KEY_IDENTIFIER',
baseUrl: 'YOUR_BASE_URL',
},
headers: {
'x-token-bearer': 'YOUR_TOKEN_BEARER',
// your headers...
},
});
// `false` when the SDK itself fails to initialize.
console.log(initialized);
} catch (error) {
// Rejected when `deviceKeyIdentifier` or `baseUrl` is missing.
console.error(error);
}Initialize |
type | Required |
|---|---|---|
params |
Params |
✅ |
headers |
Headers |
✅ |
The enroll method in the Aziface SDK is responsible for registering a user’s face for the first time and creating a secure biometric identity. During enrollment, the SDK guides the user through a liveness detection process to ensure that a real person is present and not a photo, video, or spoofing attempt.
While the user follows on-screen instructions (such as positioning their face within the oval and performing natural movements), the SDK captures a set of facial data and generates a secure face scan. This face scan is then encrypted and sent to the backend for processing and storage.
The result of a successful enrollment is a trusted biometric template associated with the user’s identity, which can later be used for authentication, verification, or ongoing identity checks. If the enrollment fails due to poor lighting, incorrect positioning, or liveness issues, the SDK returns detailed status and error information so the application can handle retries or user feedback appropriately.
const result = await enroll();
// Optionally, send extra data to your backend in the request body.
const resultWithData = await enroll({ userId: '123' });
console.log(result.isSuccess, resultWithData.isSuccess);| Property | type | Required | Default | Description |
|---|---|---|---|---|
data |
object |
❌ | undefined |
Extra data sent in the data field of the request body. |
The authentication method in the Aziface SDK is used to verify a user’s identity by comparing a newly captured face scan against a previously enrolled biometric template. This process confirms that the person attempting to access the system is the same individual who completed the enrollment.
During authentication, the SDK performs an active liveness check while guiding the user through simple on-screen instructions. A fresh face scan is captured, encrypted, and securely transmitted to the backend, where it is matched against the stored enrollment data.
If the comparison is successful and the liveness checks pass, the authentication is approved and the user is granted access. If the process fails due to a mismatch, spoofing attempt, or poor capture conditions, the SDK returns detailed result and error codes so the application can handle denial, retries, or alternative verification flows.
Important
authenticate requires a successful enroll (or photoMatch) earlier in the same app session. Otherwise, it resolves with the NotAuthenticated error. Running liveness or cancelling a session also clears the enrolled reference.
const enrollment = await enroll();
if (enrollment.isSuccess) {
const result = await authenticate();
console.log(result);
}| Property | type | Required | Default | Description |
|---|---|---|---|---|
data |
object |
❌ | undefined |
Extra data sent in the data field of the request body. |
The liveness method in the Aziface SDK is designed to determine whether the face presented to the camera belongs to a real, live person at the time of capture, without necessarily verifying their identity against a stored template.
In this flow, the SDK guides the user through a short interaction to capture facial movements and depth cues that are difficult to replicate with photos, videos, or masks. The resulting face scan is encrypted and sent to the backend, where advanced liveness detection algorithms analyze it for signs of spoofing or fraud.
A successful liveness result confirms real human presence and can be used as a standalone security check or as part of broader workflows such as authentication, onboarding, or high-risk transactions. If the liveness check fails, the SDK provides detailed feedback to allow the application to respond appropriately.
const result = await liveness();
console.log(result);| Property | type | Required | Default | Description |
|---|---|---|---|---|
data |
object |
❌ | undefined |
Extra data sent in the data field of the request body. |
The photoMatch method in the Aziface SDK is used to verify a user’s identity by analyzing a government-issued identity document and comparing it with the user’s live facial biometric data.
In this flow, the SDK first guides the user to capture high-quality images of their identity document. Then, a face scan is collected through a liveness-enabled facial capture. Both the document images and the face scan are encrypted and securely transmitted to the backend.
A successful result provides strong identity assurance, combining document authenticity and biometric verification. This flow is commonly used in regulated onboarding, KYC, and high-security access scenarios. If any step fails, the SDK returns detailed results and error information to support retries or alternative verification paths.
const result = await photoMatch();
console.log(result);| Property | type | Required | Default | Description |
|---|---|---|---|---|
data |
object |
❌ | undefined |
Extra data sent in the data field of the request body. |
The photoScan method in the Aziface SDK is used to verify the authenticity and validity of a government-issued identity document without performing facial biometric verification.
In this flow, the SDK guides the user to capture images of the identity document, ensuring proper framing, focus, and lighting. The captured document images are encrypted and securely sent to the backend for analysis.
A successful document-only verification is suitable for lower-risk scenarios or cases where biometric capture is not required. If the verification fails due to image quality issues, unsupported documents, or suspected tampering, the SDK provides detailed feedback for proper error handling and user guidance.
const result = await photoScan();
console.log(result);| Property | type | Required | Default | Description |
|---|---|---|---|---|
data |
object |
❌ | undefined |
Extra data sent in the data field of the request body. |
The setLocale method in the Aziface SDK is used to define the language and locale used by the SDK’s user interface and vocal guidance during verification sessions.
By calling this method, the application specifies which language the SDK should use for on-screen text, voice prompts, and user instructions. This allows the SDK to present a localized experience that matches the user’s preferred or device language.
The selected language applies to all Aziface SDK workflows, including enrollment, authentication, liveness checks, photo scan, and photo match verification. The language must be set before starting a session to ensure consistent localization throughout the user interaction.
If an unsupported or invalid language code is provided, the SDK falls back to its default language (English). setLocale doesn't return anything.
setLocale('pt-BR');
// Sessions started from now on use Brazilian Portuguese.
await liveness();| Property | type | Required |
|---|---|---|
locale |
Locale |
✅ |
The Vocal Guidance feature in the Aziface SDK provides spoken, real-time instructions to guide users through face capture, liveness, authentication, and identity verification flows.
During a session, the SDK uses voice prompts to instruct the user on what to do next, such as positioning their face within the camera frame, moving closer or farther, or maintaining proper alignment. This auditory guidance complements on-screen visual cues, helping users complete the process more easily and with fewer errors.
Each call toggles the vocal guidance on or off. Listen to FaceView's onVocal to know the current state. See Vocal Guidance.
vocal();| Enums | Platform |
|---|---|
Errors |
All |
| Types | Platform |
|---|---|
Params |
All |
Headers |
All |
Processor |
All |
ProcessorData |
All |
ProcessorError |
All |
ProcessorAdditionalSessionData |
All |
ProcessorResult |
All |
ProcessorHttpCallInfo |
All |
ProcessorRequestMethod |
All |
ProcessorIDScanResultsSoFar |
All |
Locale |
All |
The parameters required to initialize the Aziface SDK. If deviceKeyIdentifier or baseUrl is missing, initialize rejects with ConfigNotProvided.
Params |
type | Required | Default | Description |
|---|---|---|---|---|
deviceKeyIdentifier |
string |
✅ | - | The identifier used to initialize the SDK. |
baseUrl |
string |
✅ | - | The base URL used during the request of the processor. |
isDevelopment |
boolean |
❌ | false |
Only effective in DEBUG builds. Release builds always ignore this flag and never send X-Testing-API-Header. |
Headers sent on every session request to baseUrl. Only string, null or undefined values are accepted.
Headers |
type | Required | Default |
|---|---|---|---|
x-token-bearer |
string |
✅ | - |
[key: string] |
string or null or undefined |
❌ | undefined |
A processor always return this properties.
Processor |
type | Description |
|---|---|---|
isSuccess |
boolean |
Indicates if the processing was successful. |
data |
ProcessorData or null or undefined |
The processor data response. |
error |
ProcessorError or null or undefined |
The processor error response. |
This is data response processor. Each processor can give different responses.
ProcessorData |
type | Description |
|---|---|---|
idScanSessionId |
string or null or undefined |
The unique identifier for the ID scan session. |
externalDatabaseRefID |
string or null or undefined |
The unique identifier for the face session. |
additionalSessionData |
ProcessorAdditionalSessionData |
The additional session data. |
result |
ProcessorResult or null or undefined |
The result of the processing. |
responseBlob |
string |
The raw response blob from the server. |
httpCallInfo |
ProcessorHttpCallInfo or null or undefined |
The HTTP call information. |
didError |
boolean |
Indicates if an error occurred during processing. |
serverInfo |
unknown or null or undefined |
The server information. |
idScanResultsSoFar |
ProcessorIDScanResultsSoFar or or null or undefined |
The ID scan results so far. |
This is error response processor.
ProcessorError |
type | Description |
|---|---|---|
code |
Errors |
The error code. |
message |
string |
The error message. |
The additional session data are extra information about device and processor.
ProcessorAdditionalSessionData |
type | Description |
|---|---|---|
platform |
string |
The platform of the device. |
appID |
string |
The application ID. |
installationID |
string |
The installation ID. |
deviceModel |
string |
The device model. |
deviceSDKVersion |
string |
The device SDK version. |
userAgent |
string |
The user agent. |
sessionID |
string |
The session ID. |
The result object of the face or scan analyze.
ProcessorResult |
type | Description |
|---|---|---|
livenessProven |
boolean |
Indicates if it's liveness proven. |
auditTrailImage |
string |
The audit trail image in base64 format. |
ageV2GroupEnumInt |
number |
The age group enumeration integer. |
matchLevel |
number or undefined |
The match level. |
The HTTP information of the processor request.
ProcessorHttpCallInfo |
type | Description |
|---|---|---|
tid |
string |
The transaction ID. |
path |
string |
The request path. |
date |
string |
The date of the request. |
epochSecond |
number |
The epoch second of the request. |
requestMethod |
ProcessorRequestMethod |
The request method. |
The request method of the processor.
ProcessorRequestMethod |
Description |
|---|---|
GET |
GET request. |
POST |
POST request. |
The processor scan result. It's shown when you use photoScan or photoMatch.
ProcessorIDScanResultsSoFar |
Type | Description |
|---|---|---|
photoIDNextStepEnumInt |
number |
The photo ID next step enumeration integer. |
fullIDStatusEnumInt |
number |
The full ID status enumeration integer. |
faceOnDocumentStatusEnumInt |
number |
The face on document status enumeration integer. |
textOnDocumentStatusEnumInt |
number |
The text on document status enumeration integer. |
expectedMediaStatusEnumInt |
number |
The expected media status enumeration integer. |
unexpectedMediaEncounteredAtLeastOnce |
boolean |
Indicates if unexpected media was encountered at least once. |
documentData |
string |
The document data in stringified JSON format. |
nfcStatusEnumInt |
number |
The NFC status enumeration integer. |
nfcAuthenticationStatusEnumInt |
number |
The NFC authentication status enumeration integer. |
barcodeStatusEnumInt |
number |
The barcode status enumeration integer. |
mrzStatusEnumInt |
number |
The MRZ status enumeration integer. |
idFoundWithoutQualityIssueDetected |
boolean |
Indicates if the ID was found without quality issues. |
idFacePhotoFoundWithoutQualityIssueDetected |
boolean |
Indicates if the face photo was found without quality issues. |
idScanAgeV2GroupEnumInt |
number |
The ID scan age group enumeration integer. |
didMatchIDScanToOCRTemplate |
boolean |
Indicates if the ID scan matched the OCR template. |
isUniversalIDMode |
boolean |
Indicates if the universal ID mode is enabled. |
matchLevel |
number |
The match level. |
matchLevelNFCToFaceMap |
number |
The match level NFC to face map. |
faceMapAgeV2GroupEnumInt |
number |
The face map age group enumeration integer. |
watermarkAndHologramStatusEnumInt |
number |
The watermark and hologram status enumeration integer. |
The Locale type use the ISO 639 language codes pattern.
| type | Description | Platform |
|---|---|---|
af |
Afrikaans language. | All |
ar |
Arabic language. | All |
de |
German language. | All |
default |
English language. | All |
en |
English language. | All |
el |
Greek language. | All |
es |
Spanish and Castilian language. | All |
fr |
French language. | All |
ja |
Japanese language. | All |
kk |
Kazakh language. | All |
nb |
Norwegian Bokmål language. | All |
pt-BR |
Portuguese Brazilian language. | All |
ru |
Russian language. | All |
vi |
Vietnamese language. | All |
zh |
Chinese language. | All |
Errors |
Description | Platform |
|---|---|---|
NotInitialized |
When trying to initialize a process, but SDK wasn't initialized. | All |
ConfigNotProvided |
When deviceKeyIdentifier and baseUrl aren't provided. |
All |
ParamsNotProvided |
When parameters aren't provided, this case, it is null. |
All |
NotFoundTargetView |
When Activity (Android) or ViewController (iOS) aren't found on call processor. |
All |
CameraError |
When an error on use the camera occurs. | All |
CameraPermissionsDenied |
When the user doesn't permit the use camera. | All |
UserCancelledIdScan |
When process was cancelled on ID scan. | All |
UserCancelledFaceScan |
When process was cancelled on face scan. | All |
RequestAborted |
When process has request aborted. Some error in JSON or network. | All |
LockedOut |
When process is locked out. | All |
UnknownInternalError |
When process has unknown internal error. | All |
The FaceView extends all properties of the View, but it has six new callbacks to listen to Aziface SDK events. Each callback receives a boolean.
<FaceView
style={{ flex: 1 }}
onOpen={(opened) => console.log('SDK opened', opened)}
onClose={(closed) => console.log('SDK closed', closed)}
>
{/* your screen */}
</FaceView>| Property | Description | Parameter | Platform |
|---|---|---|---|
onOpen |
Callback function called when the Aziface SDK is opened. | boolean |
All |
onClose |
Callback function called when the Aziface SDK is closed. | boolean |
All |
onCancel |
Callback function called when the Aziface SDK is cancelled. | boolean |
All |
onError |
Callback function called when an error occurs in the Aziface SDK. | boolean |
All |
onVocal |
Callback function called when the vocal guidance state changes. | boolean |
All |
onInitialize |
Callback function called when the Aziface SDK is initialized. | boolean |
All |
The setDynamicStrings method in the Aziface SDK allows applications to dynamically customize and override the text strings displayed in the SDK’s user interface during verification sessions.
This method enables the application to replace default UI messages such as instructions, error messages, button labels, and guidance text with custom strings at runtime. It is commonly used to adapt wording, terminology, or tone to better align with product language, branding, regulatory requirements, or user context.
The dynamic strings defined through this method apply across Aziface SDK workflows, including enrollment, authentication, liveness checks, photo scan, and photo match verification. To ensure consistency, setDynamicStrings should be called before starting a session so that all UI elements display the customized text.
If a provided string key is invalid or missing, the SDK falls back to its default text for that element. This ensures that the user experience remains functional even if some custom strings are not defined.
We separated another documentation about the dynamic strings, see more here!
The Aziface SDK provides the ability to change the theme of each flow. We separated another documentation about the theme, see more here!
The Aziface SDK provides the vocal method to toggle the vocal guidance. Call it only after the SDK is initialized. The vocal guidance is always turned off (onVocal receives false) when the device is muted.
Note: We recommend using the FaceView component to keep the vocal guidance state in sync.
import { useState } from 'react';
import { Button } from 'react-native';
import {
initialize,
vocal,
FaceView,
type Params,
type Headers,
} from '@azify/aziface-mobile';
export default function App() {
const [isInitialized, setIsInitialized] = useState(false);
const [isVocalEnabled, setIsVocalEnabled] = useState(false);
async function onInitialize() {
const params: Params = {
isDevelopment: false,
deviceKeyIdentifier: 'YOUR_DEVICE_KEY_IDENTIFIER',
baseUrl: 'YOUR_BASE_URL',
};
const headers: Headers = {
'x-token-bearer': 'YOUR_TOKEN_BEARER',
};
try {
setIsInitialized(await initialize({ params, headers }));
} catch {
setIsInitialized(false);
}
}
return (
// `onVocal` is called with the new state every time `vocal()` runs.
<FaceView onVocal={setIsVocalEnabled}>
<Button title="Initialize" onPress={onInitialize} />
<Button
title={isVocalEnabled ? 'Vocal ON' : 'Vocal OFF'}
onPress={vocal}
disabled={!isInitialized}
/>
</FaceView>
);
}If you want to enable the camera, you need to add the following instructions in your Info.plist file:
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) need access to your camera to take picture.</string>That's will be necessary to what iOS works correctly!
The Azify offers an example App for Flutter developers. Currently, this example App has full implementation in Android apps. Now, in iOS apps it's still in progress. Check that's the documentation here.
In Expo, you need to convert to a custom development build or use prebuild. You can use also React Native without Expo. Check Expo example App here.
Sometimes, the World is a bit cruel... 🫠
- We only support hexadecimal colors. Read more here!
- We recommend to test the theme changes in physical devices. Read more here!
- The document scan works in physical devices only. Currently, the Aziface SDK not support documents scan in Android emulators.
- The
initializefunction works in physical devices only. Currently, the Aziface SDK not support initialization in iOS emulators directly. - We only support
.ttfand.otffonts. Read more here!
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT License. 🙂
Made with create-react-native-library. 😊