未验证 提交 778e9c75 编写于 作者: O openharmony_ci 提交者: Gitee

!9191 更新userauth资料

Merge pull request !9191 from youliang_1314/master
......@@ -277,7 +277,8 @@ cancelAuth(contextID : Uint8Array) : number
// contextId可通过auth接口获取,此处直接定义
let contextId = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7]);
let cancelCode = auth.cancel(contextId);
let auth = new userIAM_userAuth.UserAuth();
let cancelCode = auth.cancelAuth(contextId);
if (cancelCode == userIAM_userAuth.ResultCode.SUCCESS) {
console.info("cancel auth success");
} else {
......@@ -539,13 +540,14 @@ execute(type: AuthType, level: SecureLevel, callback: AsyncCallback<number&gt
**示例:**
```js
authenticator.execute("FACE_ONLY", "S2", (code)=>{
if (code == userIAM_userAuth.AuthenticationResult.SUCCESS) {
let authenticator = userIAM_userAuth.getAuthenticator();
authenticator.execute("FACE_ONLY", "S2", (error, code)=>{
if (code === userIAM_userAuth.ResultCode.SUCCESS) {
console.info("auth success");
return;
}
console.error("auth fail, code = " + code);
})
});
```
......@@ -575,14 +577,14 @@ execute(type:AuthType, level:SecureLevel): Promise<number>
**示例:**
```js
let authenticator = userIAM_userAuth.getAuthenticator();
authenticator.execute("FACE_ONLY", "S2").then((code)=>{
console.info("auth success");
}).catch((code)=>{
console.error("auth fail, code = " + code);
});
```
```js
let authenticator = userIAM_userAuth.getAuthenticator();
authenticator.execute("FACE_ONLY", "S2").then((code)=>{
console.info("auth success");
}).catch((error)=>{
console.error("auth fail, code = " + error);
});
```
## AuthenticationResult<sup>(deprecated)</sup>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册