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

!9191 更新userauth资料

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