未验证 提交 96e757af 编写于 作者: O openharmony_ci 提交者: Gitee

!9161 fix problems in demo code

Merge pull request !9161 from jidong/dev_0906
...@@ -1523,6 +1523,8 @@ getAuthenticatorCallback(sessionId: string): Promise<AuthenticatorCallback&gt ...@@ -1523,6 +1523,8 @@ getAuthenticatorCallback(sessionId: string): Promise<AuthenticatorCallback&gt
**示例:** **示例:**
```js ```js
import featureAbility from '@ohos.ability.featureAbility';
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
featureAbility.getWant().then((want) => { featureAbility.getWant().then((want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
......
...@@ -2326,7 +2326,7 @@ registerInputer(inputer: IInputer): boolean; ...@@ -2326,7 +2326,7 @@ registerInputer(inputer: IInputer): boolean;
**示例:** **示例:**
```js ```js
let pinAuth = new account_osAccount.PINAuth(); let pinAuth = new account_osAccount.PINAuth();
let password = new Uint8Array([0, 0, 0, 0, 0]; let password = new Uint8Array([0, 0, 0, 0, 0]);
let result = pinAuth.registerInputer({ let result = pinAuth.registerInputer({
onGetData: (pinSubType, callback) => { onGetData: (pinSubType, callback) => {
callback.onSetData(pinSubType, password); callback.onSetData(pinSubType, password);
...@@ -2509,7 +2509,7 @@ updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void; ...@@ -2509,7 +2509,7 @@ updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
} }
}); });
userIDM.openSession((err, challenge) => { userIDM.openSession((err, challenge) => {
userAuth.auth(challenge, credentialInfo.credType, account_osAccount.AuthTrustLevel.ATL_1, { userAuth.auth(challenge, credentialInfo.credType, account_osAccount.AuthTrustLevel.ATL1, {
onResult: (result, extraInfo) => { onResult: (result, extraInfo) => {
if (result != account_osAccount.ResultCode.SUCCESS) { if (result != account_osAccount.ResultCode.SUCCESS) {
return; return;
...@@ -2571,8 +2571,9 @@ cancel(challenge: Uint8Array): number; ...@@ -2571,8 +2571,9 @@ cancel(challenge: Uint8Array): number;
**示例:** **示例:**
```js ```js
let userIDM = new account_osAccount.UserIdentityManager(); let userIDM = new account_osAccount.UserIdentityManager();
let challenge = 1; let challenge = new Uint8Array([0]);
let cancelresult = userIDM.cancel(challenge); let result = userIDM.cancel(challenge);
console.log("cancel result: " + result);
``` ```
### delUser<sup>8+</sup> ### delUser<sup>8+</sup>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册