Adds an app account name and additional information (information that can be converted into the string type, such as token) to the **AppAccountManager** service. This API uses a promise to return the result.
...
...
@@ -100,7 +100,7 @@ Adds an app account name and additional information (information that can be con
| name | string | Yes | Name of the app account to add. |
| extraInfo | string | Yes | Additional information to add. The additional information cannot contain sensitive information, such as the app account password.|
| extraInfo | string | No | Additional information to add. The additional information cannot contain sensitive information, such as the app account password.|
**Return value**
...
...
@@ -1696,7 +1696,7 @@ Checks whether an app account has specific labels. This API uses an asynchronous
| name | string | Yes | Name of the target app account. |
| owner | string | Yes | Owner of the app account. The value is the bundle name of the app.|
| localId | number | Yes | ID of the target OS account.|
| constraint | string | Yes | Name of the [constraint](#constraints) to query.|
| callback | AsyncCallback<Array<[ConstraintSourceTypeInfo](#constraintsourcetypeinfo)>> | Yes | Callback used to return the source information about the specified [constraint] (#constraints). |
| callback | AsyncCallback<Array<[ConstraintSourceTypeInfo](#constraintsourcetypeinfo)>> | Yes | Callback invoked to return the source information about the specified [constraint](#constraints). |
**Example**
...
...
@@ -1902,7 +1902,7 @@ This is a system API and cannot be called by third-party applications.
| Promise<Array<[ConstraintSourceTypeInfo](#constraintsourcetypeinfo)>> | Promise used to return the source information about the specified [constraint](#constraints).|
| Promise<Array<[ConstraintSourceTypeInfo](#constraintsourcetypeinfo)>> | Promise used to return the source information about the specified [constraint](#constraints).|
**Example**
...
...
@@ -1912,6 +1912,1289 @@ This is a system API and cannot be called by third-party applications.
| request | [GetPropertyRequest](#GetPropertyRequest<sup>8+</sup>) | Yes | Request information, including the authentication credential type and property list.|
| callback | AsyncCallback<[ExecutorProperty](#ExecutorProperty<sup>8+</sup>)> | Yes | Callback invoked to return the executor property obtained. |
| request | [GetPropertyRequest](#GetPropertyRequest<sup>8+</sup>) | Yes | Request information, including the authentication credential type and property list.|
| request | [SetPropertyRequest](#SetPropertyRequest<sup>8+</sup>)| Yes | Request information, including the authentication credential type and key value to set. |
| callback | AsyncCallback<number> | Yes | Callback invoked to return the [result code](#ResultCode<sup>8+</sup>).|
| request | [SetPropertyRequest](#SetPropertyRequest<sup>8+</sup>) | Yes | Request information, including the authentication credential type and the key value to set.|
| authTrustLevel | [AuthTrustLevel](#AuthTrustLevel<sup>8+</sup>) | Yes | Trust level of the authentication result. |
| callback | [IUserAuthCallback](#IUserAuthCallback<sup>8+</sup>) | Yes | Callback invoked to return the authentication result and obtained information. |
**Return value**
| Type | Description |
| :--------- | :----------------- |
| Uint8Array | ID of the context for canceling the authentication.|
**Example**
```js
letuserAuth=newosAccount.UserAuth();
letauthType=osAccount.AuthType.PIN;
letchallenge=1;
letauthTrustLevel=osAccount.AuthTrustLevel.ATL1;
letonresult={
authresult:null,
authextr:null,
}
userAuth.auth(challenge,authType,authTrustLevel,{
onResult:function(result,extraInfo){
console.log("====>test for examples auth result = "+result);
onresult.authresult=result;
console.log("====>test for examples auth extraInfo = "+JSON.stringify(extraInfo));
onresult.authextr=extraInfo;
console.info('====>test for examples auth onResult = '+JSON.stringify(onresult));
| authTrustLevel | [AuthTrustLevel](#AuthTrustLevel<sup>8+</sup>) | Yes | Trust level of the authentication result. |
| callback | [IUserAuthCallback](#IUserAuthCallback<sup>8+</sup>) | Yes | Callback invoked to return the authentication result and obtained information. |
**Return value**
| Type | Description |
| :--------- | :----------------- |
| Uint8Array | ID of the context for canceling the authentication.|
Opens a session to start identity management (IDM) so that a challenge value can be obtained. This API uses an asynchronous callback to return the result.
This is a system API and cannot be called by third-party applications.
| callback | AsyncCallback<Uint8Array> | Yes | Callback invoked to return the result. If **0** is returned, the operation failed. If the operation is successful, the challenge value (a non-zero value) will be returned.|
**Example**
```js
varuserIDM=newosAccount.UserIdentityManager();
varchallenge;
userIDM.openSession(function(err,data){
try{
console.log("====>test for examples before get challenge");
console.log("====>test for examples + "+data);
challenge=data;
console.log("====>test for examples end ");
console.log("====>test for examples after get challenge");
}
catch(e){
console.info('====>test for examples openSession error = '+JSON.stringify(e));
}
});
```
### openSession<sup>8+</sup>
openSession(): Promise<Uint8Array>;
Opens a session to start IDM so that a challenge value can be obtained. This API uses a promise to return the result.
This is a system API and cannot be called by third-party applications.
| Promise<Uint8Array> | Promise used to return the result. If **0** is returned, the operation failed. If the operation is successful, the challenge value (a non-zero value) will be returned.|
**Example**
```js
varuserIDM=newosAccount.UserIdentityManager();
varchallenge;
userIDM.openSession().then((data)=>{
try{
console.log("====>test for examples before get challenge");
console.log("====>test for examples + "+data);
challenge=data;
console.log("====>test for examples end ");
console.log("====>test for examples after get challenge");
}
catch(err){
console.info('====>test for examples faceDemo openSession error1 = '+JSON.stringify(err));
}
})
.catch((err)=>{
console.info('====>test for examples faceDemo openSession error2 = '+JSON.stringify(err));
Adds credential information, which includes the authentication credential type, subtype, and token (if a non-PIN credential is added). This API uses a callback to return the result.
This is a system API and cannot be called by third-party applications.
| callback | AsyncCallback<Array<[EnrolledCredInfo](#EnrolledCredInfo<sup>8+</sup>)>> | Yes | Callback invoked to return information about all enrolled credentials of the specified type of the user.|
| Promise<Array<[EnrolledCredInfo](#EnrolledCredInfo<sup>8+</sup>)>> | Promise used to return information about all enrolled credentials of the specified type of the user.|
**Example**
```js
varuserIDM=newosAccount.UserIdentityManager();
varauthType=osAccount.AuthType.PIN;
userIDM.getAuthInfo(authType).then((authInfo)=>{
console.log("====>test for examples getAuthInfo AsyncCallback = "+JSON.stringify(authInfo))
| result | number | Yes | Authentication result code.|
| extraInfo | [AuthResult](#AuthResult<sup>8+</sup>) | Yes | Specific authentication result information. If the authentication is successful, the authentication token is returned in **extrainfo**. If the authentication fails, the remaining authentication time is returned. If the authentication executor is locked, the freezing time is returned.|
**Example**
```js
letuserAuth=newosAccount.UserAuth();
letauthType=osAccount.AuthType.PIN;
letchallenge=1;
letauthTrustLevel=osAccount.AuthTrustLevel.ATL1;
letonresult={
authresult:null,
authextr:null,
}
userAuth.auth(challenge,authType,authTrustLevel,{
onResult:function(result,extraInfo){
console.log("====>test for examples auth result = "+result);
onresult.authresult=result;
console.log("====>test for examples auth extraInfo = "+JSON.stringify(extraInfo));
onresult.authextr=extraInfo;
console.info('====>test for examples auth onResult = '+JSON.stringify(onresult));