IFAA provides the passwordless authentication capability for mobile devices to implement passwordless sign-in, passwordless payment, and other IIFAA-compliant services. (Note: In this document, we use "IFAA" to refer to the passwordless authentication module of the HarmonyOS system, and "IIFAA" to refer to the International Internet Finance Authentication Alliance and related technical specifications.)
Since: 4.1.0(11)
getVersionSync(): number
Obtains the version number of the IFAA passwordless authentication API and returns the result synchronously.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Returns
| Type | Description |
|---|---|
| number | Version number of the IFAA passwordless authentication API. |
Error codes
For details about the error codes, please refer to Universal Error Codes.
| ID | Error Message |
|---|---|
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
Example
let res: number = ifaa.getVersionSync();
console.info('Succeeded in doing getVersionSync. version:', res);
// Process res. getAnonymousIdSync(userToken: Uint8Array): Uint8Array
Obtains the anonymous ID for IFAA passwordless authentication and returns the result synchronously.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| userToken | Uint8Array | Yes | ID that uniquely identifies a user. |
Returns
| Type | Description |
|---|---|
| Uint8Array | Anonymous ID for IFAA passwordless authentication. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 401 | Parameter error. |
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
// Construct an input parameter based on the TLV format of IIFAA and convert it into a Uint8Array parameter. Here, the arg value needs to be replaced with the actual input parameter.
let arg = new Uint8Array([0]);
let getAnonIdResult: Uint8Array = ifaa.getAnonymousIdSync(arg);
console.info('Succeeded in doing getAnonymousIdSync. anonymousId:', getAnonIdResult);
// Process getAnonIdResult. getAnonymousId(userToken: Uint8Array): Promise<Uint8Array>
Obtains the anonymous ID for IFAA passwordless authentication and returns the result asynchronously through a promise.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| userToken | Uint8Array | Yes | ID that uniquely identifies a user. |
Returns
| Type | Description |
|---|---|
| Promise<Uint8Array> | Anonymous ID returned through a promise. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 401 | Parameter error. |
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
import { BusinessError } from '@kit.BasicServicesKit';
// Construct an input parameter based on the TLV format of IIFAA and convert it into a Uint8Array parameter. Here, the arg value needs to be replaced with the actual input parameter.
let arg = new Uint8Array([0]);
let getAnonIdPromise: Promise<Uint8Array> = ifaa.getAnonymousId(arg);
getAnonIdPromise.then(result => {
console.info('Succeeded in doing getAnonymousId. anonymousId:', result);
// Process result.
}).catch((err: BusinessError) => {
console.error(`Failed to call getAnonymousId. Code: ${err.code}, message: ${err.message}`);
}); getAnonymousId(userToken: Uint8Array, callback: AsyncCallback<Uint8Array>): void
Obtains the anonymous ID for IFAA passwordless authentication and returns the result asynchronously through a callback.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| userToken | Uint8Array | Yes | ID that uniquely identifies a user. |
| callback | AsyncCallback<Uint8Array> | Yes | Callback function. If the operation is successful, the value of err is undefined, and the value of data is the obtained anonymous ID; otherwise, err becomes an error object. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 401 | Parameter error. |
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
import { BusinessError } from '@kit.BasicServicesKit';
// Construct an input parameter based on the TLV format of IIFAA and convert it into a Uint8Array parameter. Here, the arg value needs to be replaced with the actual input parameter.
let arg = new Uint8Array([0]);
ifaa.getAnonymousId(arg,
(err: BusinessError, result: Uint8Array) => {
if (err) {
console.error(`Failed to call getAnonymousId. Code: ${err.code}, message: ${err.message}`);
} else {
console.info('Succeeded in doing getAnonymousId. anonymousId:', result);
// Process result.
}
}); queryStatusSync(userToken: Uint8Array): boolean
Queries the status of IFAA passwordless authentication and returns the result synchronously.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| userToken | Uint8Array | Yes | ID that uniquely identifies a user. |
Returns
| Type | Description |
|---|---|
| boolean | Indicates whether IFAA passwordless authentication is enabled. The value true indicates yes, and the value false indicates no. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 401 | Parameter error. |
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
// Construct an input parameter based on the TLV format of IIFAA and convert it into a Uint8Array parameter. Here, the arg value needs to be replaced with the actual input parameter.
let arg = new Uint8Array([0]);
let status: boolean = ifaa.queryStatusSync(arg);
if (status) {
console.info('ifaa registered');
} else {
console.info('ifaa deregistered');
} queryStatus(userToken: Uint8Array): Promise<boolean>
Queries the status of IFAA passwordless authentication and returns the result asynchronously through a promise.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| userToken | Uint8Array | Yes | ID that uniquely identifies a user. |
Returns
| Type | Description |
|---|---|
| Promise<boolean> | Promise object, which indicates whether the function is enabled. The value true indicates yes, and the value false indicates no. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 401 | Parameter error. |
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
import { BusinessError } from '@kit.BasicServicesKit';
// Construct an input parameter based on the TLV format of IIFAA and convert it into a Uint8Array parameter. Here, the arg value needs to be replaced with the actual input parameter.
let arg = new Uint8Array([0]);
let promise: Promise<boolean> = ifaa.queryStatus(arg);
promise.then(queryStatusResult => {
console.info('Succeeded in doing queryStatus. status:', queryStatusResult);
// Process queryStatusResult.
}).catch((err: BusinessError) => {
console.error(`Failed to call queryStatus. Code: ${err.code}, message: ${err.message}`);
}); queryStatus(userToken: Uint8Array, callback: AsyncCallback<boolean>): void
Queries the status of IFAA passwordless authentication and returns the result asynchronously through a callback.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| userToken | Uint8Array | Yes | ID that uniquely identifies a user. |
| callback | AsyncCallback<boolean> | Yes | Callback function used to obtain the enabling status of the function. The value true indicates yes, and the value false indicates no. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 401 | Parameter error. |
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
import { BusinessError } from '@kit.BasicServicesKit';
// Construct an input parameter based on the TLV format of IIFAA and convert it into a Uint8Array parameter. Here, the arg value needs to be replaced with the actual input parameter.
let arg = new Uint8Array([0]);
ifaa.queryStatus(arg,
(err: BusinessError, result: boolean) => {
if (err) {
console.error(`Failed to call queryStatus. Code: ${err.code}, message: ${err.message}`);
} else {
console.info('Succeeded in doing queryStatus. status:', result);
// Process result.
}
}); register(registerData: Uint8Array): Promise<Uint8Array>
Enables IFAA passwordless authentication and returns the result asynchronously through a promise.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| registerData | Uint8Array | Yes | Registration data in TLV format, which is delivered by the IIFAA server. |
Returns
| Type | Description |
|---|---|
| Promise<Uint8Array> | Registration data returned through a promise. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 401 | Parameter error. |
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
import { BusinessError } from '@kit.BasicServicesKit';
// Construct an input parameter based on the TLV format of IIFAA and convert it into a Uint8Array parameter. Here, the arg value needs to be replaced with the actual input parameter.
let arg = new Uint8Array([0]);
let registerPromise: Promise<Uint8Array> = ifaa.register(arg);
registerPromise.then(registerResult => {
console.info('Succeeded in doing register. registerResult:', registerResult);
// Process registerResult.
}).catch((err: BusinessError) =>{
console.error(`Failed to call register. Code: ${err.code}, message: ${err.message}`);
}); register(registerData: Uint8Array, callback: AsyncCallback<Uint8Array>): void
Enables IFAA passwordless authentication and returns the result asynchronously through a callback.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| registerData | Uint8Array | Yes | Registration data in TLV format, which is delivered by the IIFAA server. |
| callback | AsyncCallback<Uint8Array> | Yes | Callback function. If the operation is successful, the value of err is undefined, and the value of data is the obtained enabling data; otherwise, err becomes an error object. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 401 | Parameter error. |
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
import { BusinessError } from '@kit.BasicServicesKit';
// Construct an input parameter based on the TLV format of IIFAA and convert it into a Uint8Array parameter. Here, the arg value needs to be replaced with the actual input parameter.
let arg = new Uint8Array([0]);
ifaa.register(arg, (err: BusinessError, registerResult: Uint8Array) => {
if (err) {
console.error(`Failed to call register. Code: ${err.code}, message: ${err.message}`);
} else {
console.info('Succeeded in doing register. registerResult:', registerResult);
// Process registerResult.
}
}); preAuthSync(): Uint8Array
Obtains the preauthentication parameters for IFAA passwordless authentication and returns the result synchronously.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Returns
| Type | Description |
|---|---|
| Uint8Array | Preauthentication parameters for IFAA passwordless authentication, including the challenge value required for subsequent biometric authentication. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
let preAuthResult: Uint8Array = ifaa.preAuthSync();
console.info('Succeeded in doing preAuthSync. preAuthResult:', preAuthResult);
// Process preAuthResult. preAuth(): Promise<Uint8Array>
Obtains the preauthentication parameters for IFAA passwordless authentication and returns the result asynchronously through a promise.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Returns
| Type | Description |
|---|---|
| Promise<Uint8Array> | Preauthentication data returned through a promise. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
import { BusinessError } from '@kit.BasicServicesKit';
let preAuthPromise: Promise<Uint8Array> = ifaa.preAuth();
preAuthPromise.then(preAuthResult => {
console.info('Succeeded in doing preAuth. preAuthResult:', preAuthResult);
// Process preAuthResult.
}).catch((err: BusinessError) =>{
console.error(`Failed to call preAuth. Code: ${err.code}, message: ${err.message}`);
}); preAuth(callback: AsyncCallback<Uint8Array>): void
Obtains the preauthentication parameters for IFAA passwordless authentication and returns the result asynchronously through a callback.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| callback | AsyncCallback<Uint8Array> | Yes | Callback function. If the operation is successful, the value of err is undefined, and the value of data is the obtained preauthentication data; otherwise, err becomes an error object. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 401 | Parameter error. |
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
import { BusinessError } from '@kit.BasicServicesKit';
ifaa.preAuth(
(err: BusinessError, preAuthResult:Uint8Array) => {
if (err) {
console.error(`Failed to call preAuth. Code: ${err.code}, message: ${err.message}`);
} else {
console.info('Succeeded in doing preAuth. preAuthResult:', preAuthResult);
// Process preAuthResult.
}
}); authSync(authToken: Uint8Array, authData: Uint8Array): Uint8Array
Performs IFAA passwordless authentication and returns the result synchronously.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| authToken | Uint8Array | Yes | Credential proving that a user passes the authentication. (Obtain this credential by calling the getUserAuthInstance API of the @ohos.userIAM.userAuth module.) |
| authData | Uint8Array | Yes | Authentication data in TLV format, which is delivered by the IIFAA server. |
Returns
| Type | Description |
|---|---|
| Uint8Array | Authentication result in TLV format. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 401 | Parameter error. |
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
// Call getUserAuthInstance of @ohos.userIAM.userAuth to obtain the token. Here, the token value needs to be replaced with the actual input parameter.
let token = new Uint8Array([0]);
// Construct an input parameter based on the TLV format of IIFAA and convert it into a Uint8Array parameter. Here, the arg value needs to be replaced with the actual input parameter.
let arg = new Uint8Array([0]);
let authResult: Uint8Array = ifaa.authSync(token, arg);
console.info('Succeeded in doing authSync. authResult:', authResult);
// Process authResult. auth(authToken: Uint8Array, authData: Uint8Array): Promise<Uint8Array>
Performs IFAA passwordless authentication and returns the result asynchronously through a promise.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| authToken | Uint8Array | Yes | Credential proving that a user passes the authentication. (Obtain this credential by calling the getUserAuthInstance API of the @ohos.userIAM.userAuth module.) |
| authData | Uint8Array | Yes | Authentication data in TLV format, which is delivered by the IIFAA server. |
Returns
| Type | Description |
|---|---|
| Promise<Uint8Array> | Authentication result in TLV format, which is returned through a promise. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 401 | Parameter error. |
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
import { BusinessError } from '@kit.BasicServicesKit';
// Call getUserAuthInstance of @ohos.userIAM.userAuth to obtain the token. Here, the token value needs to be replaced with the actual input parameter.
let token = new Uint8Array([0]);
// Construct an input parameter based on the TLV format of IIFAA and convert it into a Uint8Array parameter. Here, the arg value needs to be replaced with the actual input parameter.
let arg = new Uint8Array([0]);
let authPromise: Promise<Uint8Array> = ifaa.auth(token, arg);
authPromise.then(authResult => {
console.info('Succeeded in doing auth. authResult:', authResult);
// Process authResult.
}).catch((err: BusinessError) =>{
console.error(`Failed to call auth. Code: ${err.code}, message: ${err.message}`);
}); auth(authToken: Uint8Array, authData: Uint8Array, callback: AsyncCallback<Uint8Array>): void
Performs IFAA passwordless authentication and returns the result asynchronously through a callback.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| authToken | Uint8Array | Yes | Credential proving that a user passes the authentication. (Obtain this credential by calling the getUserAuthInstance API of the @ohos.userIAM.userAuth module.) |
| authData | Uint8Array | Yes | Authentication data in TLV format, which is delivered by the IIFAA server. |
| callback | AsyncCallback<Uint8Array> | Yes | Callback function. If the operation is successful, the value of err is undefined, and the value of data is the obtained return data; otherwise, err becomes an error object. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 401 | Parameter error. |
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
import { BusinessError } from '@kit.BasicServicesKit';
// Call getUserAuthInstance of @ohos.userIAM.userAuth to obtain the token. Here, the token value needs to be replaced with the actual input parameter.
let token = new Uint8Array([0]);
// Construct an input parameter based on the TLV format of IIFAA and convert it into a Uint8Array parameter. Here, the arg value needs to be replaced with the actual input parameter.
let arg = new Uint8Array([0]);
ifaa.auth(token, arg,
(err: BusinessError, authResult: Uint8Array) => {
if (err) {
console.error(`Failed to call auth. Code: ${err.code}, message: ${err.message}`);
} else {
console.info('Succeeded in doing auth. authResult:', authResult);
// Process authResult.
}
}); deregisterSync(deregisterData: Uint8Array): void
Deregisters IFAA passwordless authentication and returns the result synchronously.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| deregisterData | Uint8Array | Yes | Deregistration data in TLV format, which is delivered by the IIFAA server. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 401 | Parameter error. |
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
// Construct an input parameter based on the TLV format of IIFAA and convert it into a Uint8Array parameter. Here, the arg value needs to be replaced with the actual input parameter. let arg = new Uint8Array([0]); ifaa.deregisterSync(arg);
deregister(deregisterData: Uint8Array): Promise<void>
Deregisters IFAA passwordless authentication and returns the result asynchronously through a promise.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| deregisterData | Uint8Array | Yes | Deregistration data in TLV format, which is delivered by the IIFAA server. |
Returns
| Type | Description |
|---|---|
| Promise<void> | Promise that returns no value. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 401 | Parameter error. |
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
import { BusinessError } from '@kit.BasicServicesKit';
// Construct an input parameter based on the TLV format of IIFAA and convert it into a Uint8Array parameter. Here, the arg value needs to be replaced with the actual input parameter.
let arg = new Uint8Array([0]);
let promise: Promise<void> = ifaa.deregister(arg);
promise.then(()=> {
console.info('Succeeded in doing deregister.');
}).catch((err: BusinessError) => {
console.error(`Failed to call deregister. Code: ${err.code}, message: ${err.message}`);
}); deregister(deregisterData: Uint8Array, callback: AsyncCallback<void>): void
Deregisters IFAA passwordless authentication and returns the result asynchronously through a callback.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| deregisterData | Uint8Array | Yes | Deregistration data in TLV format, which is delivered by the IIFAA server. |
| callback | AsyncCallback<void> | Yes | Callback function. If the operation is successful, err is undefined; otherwise, err becomes an error object. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 401 | Parameter error. |
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
import { BusinessError } from '@kit.BasicServicesKit';
// Construct an input parameter based on the TLV format of IIFAA and convert it into a Uint8Array parameter. Here, the arg value needs to be replaced with the actual input parameter.
let arg = new Uint8Array([0]);
ifaa.deregister(arg,
(err: BusinessError) => {
if (err) {
console.error(`Failed to call deregister. Code: ${err.code}, message: ${err.message}`);
} else {
console.info('Succeeded in doing deregister.');
}
}); getProtocolVersionSync(): Uint8Array
Obtains the version number of the IFAA passwordless authentication protocol and returns the result synchronously.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Returns
| Type | Description |
|---|---|
| Uint8Array | Version number of the IFAA passwordless authentication protocol. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
let res: Uint8Array = ifaa.getProtocolVersionSync();
getProtocolVersion(): Promise<Uint8Array>
Obtains the version number of the IFAA passwordless authentication protocol and returns the result asynchronously through a promise.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Returns
| Type | Description |
|---|---|
| Promise<Uint8Array> | Protocol version number returned through a promise. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
import { BusinessError } from '@kit.BasicServicesKit';
let promise: Promise<Uint8Array> = ifaa.getProtocolVersion();
promise.then(result => {
console.info('Succeeded in doing getProtocolVersion. protocolVersion:', result);
// Process result.
}).catch((err: BusinessError) => {
console.error(`Failed to call getProtocolVersion. Code: ${err.code}, message: ${err.message}`);
}); getProtocolVersion(callback: AsyncCallback<Uint8Array>): void
Obtains the version number of the IFAA passwordless authentication protocol and returns the result asynchronously through a callback.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| callback | AsyncCallback<Uint8Array> | Yes | Callback function. If the operation is successful, the value of err is undefined, and the value of data is the obtained protocol version; otherwise, err becomes an error object. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 401 | Parameter error. |
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
import { BusinessError } from '@kit.BasicServicesKit';
ifaa.getProtocolVersion(
(err: BusinessError, result: Uint8Array) => {
if (err) {
console.error(`Failed to call getProtocolVersion. Code: ${err.code}, message: ${err.message}`);
} else {
console.info('Succeeded in doing getProtocolVersion. protocolVersion:', result);
// Process result.
}
}); getSupportedCertTypesSync(): Uint8Array
Obtains the certificate format supported by IFAA passwordless authentication and returns the result synchronously.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Returns
| Type | Description |
|---|---|
| Uint8Array | Certificate format supported by IFAA passwordless authentication. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
let result: Uint8Array = ifaa.getSupportedCertTypesSync();
console.info('Succeeded in doing getSupportedCertTypesSync. supportedCertTypes:', result);
// Process result. getSupportedCertTypes(): Promise<Uint8Array>
Obtains the certificate format supported by IFAA passwordless authentication and returns the result asynchronously through a promise.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Returns
| Type | Description |
|---|---|
| Promise<Uint8Array> | Supported certificate format, which is returned through a promise. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
import { BusinessError } from '@kit.BasicServicesKit';
let promise: Promise<Uint8Array> = ifaa.getSupportedCertTypes();
promise.then(result => {
console.info('Succeeded in doing getSupportedCertTypes. supportedCertTypes:', result);
// Process result.
}).catch((err: BusinessError) => {
console.error(`Failed to call getSupportedCertTypes. Code: ${err.code}, message: ${err.message}`);
}); getSupportedCertTypes(callback: AsyncCallback<Uint8Array>): void
Obtains the certificate format supported by IFAA passwordless authentication and returns the result asynchronously through a callback.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Security.Ifaa
Since: 4.1.0(11)
Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| callback | AsyncCallback<Uint8Array> | Yes | Callback function. If the operation is successful, the value of err is undefined, and the value of data is the obtained certificate format; otherwise, err becomes an error object. |
Error codes
For details about the error codes, please refer to Universal Error Codes and IFAA Passwordless Authentication Error Codes.
| ID | Error Message |
|---|---|
| 401 | Parameter error. |
| 801 | Device type error. Applicable versions: 21+6.0.1(21)+ |
| 1006100001 | System Interruption. |
| 1006100002 | The service is abnormal. |
Example
import { BusinessError } from '@kit.BasicServicesKit';
ifaa.getSupportedCertTypes(
(err: BusinessError, result: Uint8Array) => {
if (err) {
console.error(`Failed to call getSupportedCertTypes. Code: ${err.code}, message: ${err.message}`);
} else {
console.info('Succeeded in doing getSupportedCertTypes. supportedCertTypes:', result);
// Process result.
}
});