Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
ed97251d
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
ed97251d
编写于
8月 26, 2023
作者:
O
openharmony_ci
提交者:
Gitee
8月 26, 2023
浏览文件
操作
浏览文件
下载
差异文件
!23082 【帐号docs】ts告警问题处理
Merge pull request !23082 from lichenchen/master
上级
00e0cc19
1b908325
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
237 addition
and
186 deletion
+237
-186
zh-cn/application-dev/reference/apis/js-apis-appAccount.md
zh-cn/application-dev/reference/apis/js-apis-appAccount.md
+140
-128
zh-cn/application-dev/reference/apis/js-apis-distributed-account.md
...ication-dev/reference/apis/js-apis-distributed-account.md
+12
-6
zh-cn/application-dev/reference/apis/js-apis-osAccount.md
zh-cn/application-dev/reference/apis/js-apis-osAccount.md
+85
-52
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-appAccount.md
浏览文件 @
ed97251d
...
@@ -105,9 +105,9 @@ createAccount(name: string, options: CreateAccountOptions, callback: AsyncCallba
...
@@ -105,9 +105,9 @@ createAccount(name: string, options: CreateAccountOptions, callback: AsyncCallba
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
options
=
{
let
options
:
account_appAccount
.
CreateAccountOptions
=
{
customData
:
{
customData
:
{
'
age
'
:
'
10
'
age
:
'
10
'
}
}
}
}
try
{
try
{
...
@@ -158,9 +158,9 @@ createAccount(name: string, options?: CreateAccountOptions): Promise<void>
...
@@ -158,9 +158,9 @@ createAccount(name: string, options?: CreateAccountOptions): Promise<void>
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
options
=
{
let
options
:
account_appAccount
.
CreateAccountOptions
=
{
customData
:
{
customData
:
{
'
age
'
:
'
10
'
age
:
'
10
'
}
}
}
}
try
{
try
{
...
@@ -205,20 +205,23 @@ createAccountImplicitly(owner: string, callback: AuthCallback): void
...
@@ -205,20 +205,23 @@ createAccountImplicitly(owner: string, callback: AuthCallback): void
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
import
common
from
'
@ohos.app.ability.common
'
;
function
onResultCallback
(
code
:
number
,
result
:
account_appAccount
.
AuthResult
)
{
let
context
=
getContext
(
this
)
as
common
.
UIAbilityContext
;
// UIAbilityContext
function
onResultCallback
(
code
:
number
,
result
?:
account_appAccount
.
AuthResult
):
void
{
console
.
log
(
'
resultCode:
'
+
code
);
console
.
log
(
'
resultCode:
'
+
code
);
console
.
log
(
'
result:
'
+
JSON
.
stringify
(
result
));
console
.
log
(
'
result:
'
+
JSON
.
stringify
(
result
));
}
}
function
onRequestRedirectedCallback
(
request
:
Want
)
{
function
onRequestRedirectedCallback
(
request
:
Want
)
:
void
{
let
wantInfo
=
{
let
wantInfo
:
Want
=
{
deviceId
:
''
,
deviceId
:
''
,
bundleName
:
'
com.example.accountjsdemo
'
,
bundleName
:
'
com.example.accountjsdemo
'
,
action
:
'
ohos.want.action.viewData
'
,
action
:
'
ohos.want.action.viewData
'
,
entities
:
[
'
entity.system.default
'
],
entities
:
[
'
entity.system.default
'
],
}
}
this
.
context
.
startAbility
(
wantInfo
).
then
(()
=>
{
context
.
startAbility
(
wantInfo
).
then
(()
=>
{
console
.
log
(
'
startAbility successfully
'
);
console
.
log
(
'
startAbility successfully
'
);
}).
catch
((
err
:
BusinessError
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
log
(
'
startAbility err:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
startAbility err:
'
+
JSON
.
stringify
(
err
));
...
@@ -267,27 +270,30 @@ createAccountImplicitly(owner: string, options: CreateAccountImplicitlyOptions,
...
@@ -267,27 +270,30 @@ createAccountImplicitly(owner: string, options: CreateAccountImplicitlyOptions,
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
import
common
from
'
@ohos.app.ability.common
'
;
let
context
=
getContext
(
this
)
as
common
.
UIAbilityContext
;
// UIAbilityContext
function
onResultCallback
(
code
:
number
,
result
:
account_appAccount
.
AuthResult
)
{
function
onResultCallback
(
code
:
number
,
result
?:
account_appAccount
.
AuthResult
):
void
{
console
.
log
(
'
resultCode:
'
+
code
);
console
.
log
(
'
resultCode:
'
+
code
);
console
.
log
(
'
result:
'
+
JSON
.
stringify
(
result
));
console
.
log
(
'
result:
'
+
JSON
.
stringify
(
result
));
}
}
function
onRequestRedirectedCallback
(
request
:
Want
)
{
function
onRequestRedirectedCallback
(
request
:
Want
)
:
void
{
let
wantInfo
=
{
let
wantInfo
:
Want
=
{
deviceId
:
''
,
deviceId
:
''
,
bundleName
:
'
com.example.accountjsdemo
'
,
bundleName
:
'
com.example.accountjsdemo
'
,
action
:
'
ohos.want.action.viewData
'
,
action
:
'
ohos.want.action.viewData
'
,
entities
:
[
'
entity.system.default
'
],
entities
:
[
'
entity.system.default
'
],
}
}
this
.
context
.
startAbility
(
wantInfo
).
then
(()
=>
{
context
.
startAbility
(
wantInfo
).
then
(()
=>
{
console
.
log
(
'
startAbility successfully
'
);
console
.
log
(
'
startAbility successfully
'
);
}).
catch
((
err
:
BusinessError
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
log
(
'
startAbility err:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
startAbility err:
'
+
JSON
.
stringify
(
err
));
})
})
}
}
let
options
=
{
let
options
:
account_appAccount
.
CreateAccountImplicitlyOptions
=
{
authType
:
'
getSocialData
'
,
authType
:
'
getSocialData
'
,
requiredLabels
:
[
'
student
'
]
requiredLabels
:
[
'
student
'
]
};
};
...
@@ -1328,7 +1334,7 @@ on(type: 'accountChange', owners: Array<string>, callback: Callback<Arr
...
@@ -1328,7 +1334,7 @@ on(type: 'accountChange', owners: Array<string>, callback: Callback<Arr
**示例:**
**示例:**
```
js
```
js
function
changeOnCallback
(
data
:
account_appAccount
.
AppAccountInfo
[]){
function
changeOnCallback
(
data
:
account_appAccount
.
AppAccountInfo
[])
:
void
{
console
.
log
(
'
receive change data:
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
receive change data:
'
+
JSON
.
stringify
(
data
));
}
}
try
{
try
{
...
@@ -1363,7 +1369,7 @@ off(type: 'accountChange', callback?: Callback<Array<AppAccountInfo>>
...
@@ -1363,7 +1369,7 @@ off(type: 'accountChange', callback?: Callback<Array<AppAccountInfo>>
**示例:**
**示例:**
```
js
```
js
function
changeOnCallback
(
data
:
account_appAccount
.
AppAccountInfo
[])
{
function
changeOnCallback
(
data
:
account_appAccount
.
AppAccountInfo
[])
:
void
{
console
.
log
(
'
receive change data:
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
receive change data:
'
+
JSON
.
stringify
(
data
));
}
}
try
{
try
{
...
@@ -1412,20 +1418,23 @@ auth(name: string, owner: string, authType: string, callback: AuthCallback): voi
...
@@ -1412,20 +1418,23 @@ auth(name: string, owner: string, authType: string, callback: AuthCallback): voi
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
import
common
from
'
@ohos.app.ability.common
'
;
let
context
=
getContext
(
this
)
as
common
.
UIAbilityContext
;
// UIAbilityContext
function
onResultCallback
(
code
:
number
,
authResult
:
account_appAccount
.
AuthResult
)
{
function
onResultCallback
(
code
:
number
,
authResult
?:
account_appAccount
.
AuthResult
):
void
{
console
.
log
(
'
resultCode:
'
+
code
);
console
.
log
(
'
resultCode:
'
+
code
);
console
.
log
(
'
authResult:
'
+
JSON
.
stringify
(
authResult
));
console
.
log
(
'
authResult:
'
+
JSON
.
stringify
(
authResult
));
}
}
function
onRequestRedirectedCallback
(
request
:
Want
)
{
function
onRequestRedirectedCallback
(
request
:
Want
)
:
void
{
let
wantInfo
=
{
let
wantInfo
:
Want
=
{
deviceId
:
''
,
deviceId
:
''
,
bundleName
:
'
com.example.accountjsdemo
'
,
bundleName
:
'
com.example.accountjsdemo
'
,
action
:
'
ohos.want.action.viewData
'
,
action
:
'
ohos.want.action.viewData
'
,
entities
:
[
'
entity.system.default
'
],
entities
:
[
'
entity.system.default
'
],
}
}
this
.
context
.
startAbility
(
wantInfo
).
then
(()
=>
{
context
.
startAbility
(
wantInfo
).
then
(()
=>
{
console
.
log
(
'
startAbility successfully
'
);
console
.
log
(
'
startAbility successfully
'
);
}).
catch
((
err
:
BusinessError
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
log
(
'
startAbility err:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
startAbility err:
'
+
JSON
.
stringify
(
err
));
...
@@ -1476,28 +1485,31 @@ auth(name: string, owner: string, authType: string, options: {[key: string]: Obj
...
@@ -1476,28 +1485,31 @@ auth(name: string, owner: string, authType: string, options: {[key: string]: Obj
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
import
common
from
'
@ohos.app.ability.common
'
;
function
onResultCallback
(
code
:
number
,
authResult
:
account_appAccount
.
AuthResult
)
{
let
context
=
getContext
(
this
)
as
common
.
UIAbilityContext
;
// UIAbilityContext
function
onResultCallback
(
code
:
number
,
authResult
?:
account_appAccount
.
AuthResult
):
void
{
console
.
log
(
'
resultCode:
'
+
code
);
console
.
log
(
'
resultCode:
'
+
code
);
console
.
log
(
'
authResult:
'
+
JSON
.
stringify
(
authResult
));
console
.
log
(
'
authResult:
'
+
JSON
.
stringify
(
authResult
));
}
}
function
onRequestRedirectedCallback
(
request
:
Want
)
{
function
onRequestRedirectedCallback
(
request
:
Want
)
:
void
{
let
wantInfo
=
{
let
wantInfo
:
Want
=
{
deviceId
:
''
,
deviceId
:
''
,
bundleName
:
'
com.example.accountjsdemo
'
,
bundleName
:
'
com.example.accountjsdemo
'
,
action
:
'
ohos.want.action.viewData
'
,
action
:
'
ohos.want.action.viewData
'
,
entities
:
[
'
entity.system.default
'
],
entities
:
[
'
entity.system.default
'
],
}
}
this
.
context
.
startAbility
(
wantInfo
).
then
(()
=>
{
context
.
startAbility
(
wantInfo
).
then
(()
=>
{
console
.
log
(
'
startAbility successfully
'
);
console
.
log
(
'
startAbility successfully
'
);
}).
catch
((
err
:
BusinessError
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
log
(
'
startAbility err:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
startAbility err:
'
+
JSON
.
stringify
(
err
));
})
})
}
}
let
options
=
{
let
options
:
Record
<
string
,
Object
>
=
{
'
password
'
:
'
xxxx
'
,
password
:
'
xxxx
'
,
};
};
try
{
try
{
appAccountManager
.
auth
(
'
LiSi
'
,
'
com.example.accountjsdemo
'
,
'
getSocialData
'
,
options
,
{
appAccountManager
.
auth
(
'
LiSi
'
,
'
com.example.accountjsdemo
'
,
'
getSocialData
'
,
options
,
{
...
@@ -2187,16 +2199,16 @@ getAuthCallback(sessionId: string, callback: AsyncCallback<AuthCallback>):
...
@@ -2187,16 +2199,16 @@ getAuthCallback(sessionId: string, callback: AsyncCallback<AuthCallback>):
import
AbilityConstant
from
'
@ohos.app.ability.AbilityConstant
'
;
import
AbilityConstant
from
'
@ohos.app.ability.AbilityConstant
'
;
export
default
class
EntryAbility
extends
UIAbility
{
export
default
class
EntryAbility
extends
UIAbility
{
onCreate
(
want
:
Want
,
param
:
AbilityConstant
.
LaunchParam
)
{
onCreate
(
want
:
Want
,
param
:
AbilityConstant
.
LaunchParam
)
{
// ability 生命周期函数
let
sessionId
=
want
.
parameters
[
account_appAccount
.
Constants
.
KEY_SESSION_ID
]
;
let
sessionId
:
string
=
want
.
parameters
!
[
account_appAccount
.
Constants
.
KEY_SESSION_ID
]
as
string
;
try
{
try
{
appAccountManager
.
getAuthCallback
(
sessionId
,
(
err
:
BusinessError
,
callback
:
account_appAccount
.
AuthCallback
)
=>
{
appAccountManager
.
getAuthCallback
(
sessionId
,
(
err
:
BusinessError
,
callback
:
account_appAccount
.
AuthCallback
)
=>
{
if
(
err
!=
null
)
{
if
(
err
!=
null
)
{
console
.
log
(
'
getAuthCallback err:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
getAuthCallback err:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
let
result
=
{
let
result
:
account_appAccount
.
AuthResult
=
{
account
Info
:
{
account
:
{
name
:
'
Lisi
'
,
name
:
'
Lisi
'
,
owner
:
'
com.example.accountjsdemo
'
,
owner
:
'
com.example.accountjsdemo
'
,
},
},
...
@@ -2251,12 +2263,12 @@ getAuthCallback(sessionId: string): Promise<AuthCallback>
...
@@ -2251,12 +2263,12 @@ getAuthCallback(sessionId: string): Promise<AuthCallback>
import
AbilityConstant
from
'
@ohos.app.ability.AbilityConstant
'
;
import
AbilityConstant
from
'
@ohos.app.ability.AbilityConstant
'
;
export
default
class
EntryAbility
extends
UIAbility
{
export
default
class
EntryAbility
extends
UIAbility
{
onCreate
(
want
:
Want
,
param
:
AbilityConstant
.
LaunchParam
)
{
onCreate
(
want
:
Want
,
param
:
AbilityConstant
.
LaunchParam
)
{
// ability 生命周期函数
let
sessionId
=
want
.
parameters
[
account_appAccount
.
Constants
.
KEY_SESSION_ID
]
;
let
sessionId
:
string
=
want
.
parameters
!
[
account_appAccount
.
Constants
.
KEY_SESSION_ID
]
as
string
;
try
{
try
{
appAccountManager
.
getAuthCallback
(
sessionId
).
then
((
callback
:
account_appAccount
.
AuthCallback
)
=>
{
appAccountManager
.
getAuthCallback
(
sessionId
).
then
((
callback
:
account_appAccount
.
AuthCallback
)
=>
{
let
result
=
{
let
result
:
account_appAccount
.
AuthResult
=
{
account
Info
:
{
account
:
{
name
:
'
Lisi
'
,
name
:
'
Lisi
'
,
owner
:
'
com.example.accountjsdemo
'
,
owner
:
'
com.example.accountjsdemo
'
,
},
},
...
@@ -2398,7 +2410,7 @@ checkAccountLabels(name: string, owner: string, labels: Array<string>, cal
...
@@ -2398,7 +2410,7 @@ checkAccountLabels(name: string, owner: string, labels: Array<string>, cal
let
labels
=
[
'
student
'
];
let
labels
=
[
'
student
'
];
try
{
try
{
appAccountManager
.
checkAccountLabels
(
'
zhangsan
'
,
'
com.example.accountjsdemo
'
,
labels
1
,
appAccountManager
.
checkAccountLabels
(
'
zhangsan
'
,
'
com.example.accountjsdemo
'
,
labels
,
(
err
:
BusinessError
,
hasAllLabels
:
boolean
)
=>
{
(
err
:
BusinessError
,
hasAllLabels
:
boolean
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
checkAccountLabels failed, error:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
checkAccountLabels failed, error:
'
+
JSON
.
stringify
(
err
));
...
@@ -2580,12 +2592,12 @@ selectAccountsByOptions(options: SelectAccountsOptions, callback: AsyncCallback&
...
@@ -2580,12 +2592,12 @@ selectAccountsByOptions(options: SelectAccountsOptions, callback: AsyncCallback&
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
options
=
{
let
options
:
account_appAccount
.
SelectAccountsOptions
=
{
allowedOwners
:
[
'
com.example.accountjsdemo
'
],
allowedOwners
:
[
'
com.example.accountjsdemo
'
],
requiredLabels
:
[
'
student
'
]
requiredLabels
:
[
'
student
'
]
};
};
try
{
try
{
appAccountManager
.
selectAccountsByOptions
(
options
5
,
appAccountManager
.
selectAccountsByOptions
(
options
,
(
err
:
BusinessError
,
accountArr
:
account_appAccount
.
AppAccountInfo
[])
=>
{
(
err
:
BusinessError
,
accountArr
:
account_appAccount
.
AppAccountInfo
[])
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
selectAccountsByOptions failed, error:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
selectAccountsByOptions failed, error:
'
+
JSON
.
stringify
(
err
));
...
@@ -2632,7 +2644,7 @@ selectAccountsByOptions(options: SelectAccountsOptions): Promise<Array<App
...
@@ -2632,7 +2644,7 @@ selectAccountsByOptions(options: SelectAccountsOptions): Promise<Array<App
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
options
=
{
let
options
:
account_appAccount
.
SelectAccountsOptions
=
{
allowedOwners
:
[
'
com.example.accountjsdemo
'
]
allowedOwners
:
[
'
com.example.accountjsdemo
'
]
};
};
try
{
try
{
...
@@ -2680,7 +2692,7 @@ verifyCredential(name: string, owner: string, callback: AuthCallback): void;
...
@@ -2680,7 +2692,7 @@ verifyCredential(name: string, owner: string, callback: AuthCallback): void;
try
{
try
{
appAccountManager
.
verifyCredential
(
'
zhangsan
'
,
'
com.example.accountjsdemo
'
,
{
appAccountManager
.
verifyCredential
(
'
zhangsan
'
,
'
com.example.accountjsdemo
'
,
{
onResult
:
(
resultCode
:
number
,
result
:
account_appAccount
.
AuthResult
)
=>
{
onResult
:
(
resultCode
:
number
,
result
?
:
account_appAccount
.
AuthResult
)
=>
{
console
.
log
(
'
verifyCredential onResult, resultCode:
'
+
JSON
.
stringify
(
resultCode
));
console
.
log
(
'
verifyCredential onResult, resultCode:
'
+
JSON
.
stringify
(
resultCode
));
console
.
log
(
'
verifyCredential onResult, result:
'
+
JSON
.
stringify
(
result
));
console
.
log
(
'
verifyCredential onResult, result:
'
+
JSON
.
stringify
(
result
));
},
},
...
@@ -2726,13 +2738,13 @@ verifyCredential(name: string, owner: string, options: VerifyCredentialOptions,
...
@@ -2726,13 +2738,13 @@ verifyCredential(name: string, owner: string, options: VerifyCredentialOptions,
```
js
```
js
import
Want
from
'
@ohos.app.ability.Want
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
options
=
{
let
options
:
account_appAccount
.
VerifyCredentialOptions
=
{
credentialType
:
'
pin
'
,
credentialType
:
'
pin
'
,
credential
:
'
123456
'
credential
:
'
123456
'
};
};
try
{
try
{
appAccountManager
.
verifyCredential
(
'
zhangsan
'
,
'
com.example.accountjsdemo
'
,
options
,
{
appAccountManager
.
verifyCredential
(
'
zhangsan
'
,
'
com.example.accountjsdemo
'
,
options
,
{
onResult
:
(
resultCode
:
number
,
result
:
account_appAccount
.
AuthResult
)
=>
{
onResult
:
(
resultCode
:
number
,
result
?
:
account_appAccount
.
AuthResult
)
=>
{
console
.
log
(
'
verifyCredential onResult, resultCode:
'
+
JSON
.
stringify
(
resultCode
));
console
.
log
(
'
verifyCredential onResult, resultCode:
'
+
JSON
.
stringify
(
resultCode
));
console
.
log
(
'
verifyCredential onResult, result:
'
+
JSON
.
stringify
(
result
));
console
.
log
(
'
verifyCredential onResult, result:
'
+
JSON
.
stringify
(
result
));
},
},
...
@@ -2777,7 +2789,7 @@ setAuthenticatorProperties(owner: string, callback: AuthCallback): void;
...
@@ -2777,7 +2789,7 @@ setAuthenticatorProperties(owner: string, callback: AuthCallback): void;
try
{
try
{
appAccountManager
.
setAuthenticatorProperties
(
'
com.example.accountjsdemo
'
,
{
appAccountManager
.
setAuthenticatorProperties
(
'
com.example.accountjsdemo
'
,
{
onResult
:
(
resultCode
:
number
,
result
:
account_appAccount
.
AuthResult
)
=>
{
onResult
:
(
resultCode
:
number
,
result
?
:
account_appAccount
.
AuthResult
)
=>
{
console
.
log
(
'
setAuthenticatorProperties onResult, resultCode:
'
+
JSON
.
stringify
(
resultCode
));
console
.
log
(
'
setAuthenticatorProperties onResult, resultCode:
'
+
JSON
.
stringify
(
resultCode
));
console
.
log
(
'
setAuthenticatorProperties onResult, result:
'
+
JSON
.
stringify
(
result
));
console
.
log
(
'
setAuthenticatorProperties onResult, result:
'
+
JSON
.
stringify
(
result
));
},
},
...
@@ -2821,12 +2833,12 @@ setAuthenticatorProperties(owner: string, options: SetPropertiesOptions, callbac
...
@@ -2821,12 +2833,12 @@ setAuthenticatorProperties(owner: string, options: SetPropertiesOptions, callbac
```
js
```
js
import
Want
from
'
@ohos.app.ability.Want
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
options
=
{
let
options
:
account_appAccount
.
SetPropertiesOptions
=
{
properties
:
{
'
prop1
'
:
'
value1
'
}
properties
:
{
prop1
:
'
value1
'
}
};
};
try
{
try
{
appAccountManager
.
setAuthenticatorProperties
(
'
com.example.accountjsdemo
'
,
options
,
{
appAccountManager
.
setAuthenticatorProperties
(
'
com.example.accountjsdemo
'
,
options
,
{
onResult
:
(
resultCode
:
number
,
result
:
account_appAccount
.
AuthResult
)
=>
{
onResult
:
(
resultCode
:
number
,
result
?
:
account_appAccount
.
AuthResult
)
=>
{
console
.
log
(
'
setAuthenticatorProperties onResult, resultCode:
'
+
JSON
.
stringify
(
resultCode
));
console
.
log
(
'
setAuthenticatorProperties onResult, resultCode:
'
+
JSON
.
stringify
(
resultCode
));
console
.
log
(
'
setAuthenticatorProperties onResult, result:
'
+
JSON
.
stringify
(
result
));
console
.
log
(
'
setAuthenticatorProperties onResult, result:
'
+
JSON
.
stringify
(
result
));
},
},
...
@@ -2961,20 +2973,23 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a
...
@@ -2961,20 +2973,23 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
import
common
from
'
@ohos.app.ability.common
'
;
let
context
=
getContext
(
this
)
as
common
.
UIAbilityContext
;
// UIAbilityContext
function
onResultCallback
(
code
:
number
,
result
:
{
[
key
:
string
]:
any
})
{
function
onResultCallback
(
code
:
number
,
result
:
Record
<
string
,
Object
>
):
void
{
console
.
log
(
'
resultCode:
'
+
code
);
console
.
log
(
'
resultCode:
'
+
code
);
console
.
log
(
'
result:
'
+
JSON
.
stringify
(
result
));
console
.
log
(
'
result:
'
+
JSON
.
stringify
(
result
));
}
}
function
onRequestRedirectedCallback
(
request
:
Want
)
{
function
onRequestRedirectedCallback
(
request
:
Want
)
:
void
{
let
wantInfo
=
{
let
wantInfo
:
Want
=
{
deviceId
:
''
,
deviceId
:
''
,
bundleName
:
'
com.example.accountjsdemo
'
,
bundleName
:
'
com.example.accountjsdemo
'
,
action
:
'
ohos.want.action.viewData
'
,
action
:
'
ohos.want.action.viewData
'
,
entities
:
[
'
entity.system.default
'
],
entities
:
[
'
entity.system.default
'
],
}
}
this
.
context
.
startAbility
(
wantInfo
).
then
(()
=>
{
context
.
startAbility
(
wantInfo
).
then
(()
=>
{
console
.
log
(
'
startAbility successfully
'
);
console
.
log
(
'
startAbility successfully
'
);
}).
catch
((
err
:
BusinessError
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
log
(
'
startAbility err:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
startAbility err:
'
+
JSON
.
stringify
(
err
));
...
@@ -3895,7 +3910,7 @@ on(type: 'change', owners: Array<string>, callback: Callback<Array<A
...
@@ -3895,7 +3910,7 @@ on(type: 'change', owners: Array<string>, callback: Callback<Array<A
**示例:**
**示例:**
```
js
```
js
function
changeOnCallback
(
data
:
account_appAccount
.
AppAccountInfo
[]){
function
changeOnCallback
(
data
:
account_appAccount
.
AppAccountInfo
[])
:
void
{
console
.
debug
(
'
receive change data:
'
+
JSON
.
stringify
(
data
));
console
.
debug
(
'
receive change data:
'
+
JSON
.
stringify
(
data
));
}
}
try
{
try
{
...
@@ -3928,7 +3943,7 @@ off(type: 'change', callback?: Callback<Array<AppAccountInfo>>): voi
...
@@ -3928,7 +3943,7 @@ off(type: 'change', callback?: Callback<Array<AppAccountInfo>>): voi
**示例:**
**示例:**
```
js
```
js
function
changeOnCallback
(
data
:
account_appAccount
.
AppAccountInfo
[]){
function
changeOnCallback
(
data
:
account_appAccount
.
AppAccountInfo
[])
:
void
{
console
.
debug
(
'
receive change data:
'
+
JSON
.
stringify
(
data
));
console
.
debug
(
'
receive change data:
'
+
JSON
.
stringify
(
data
));
appAccountManager
.
off
(
'
change
'
,
()
=>
{
appAccountManager
.
off
(
'
change
'
,
()
=>
{
console
.
debug
(
'
off finish
'
);
console
.
debug
(
'
off finish
'
);
...
@@ -3969,20 +3984,23 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri
...
@@ -3969,20 +3984,23 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
import
common
from
'
@ohos.app.ability.common
'
;
let
context
=
getContext
(
this
)
as
common
.
UIAbilityContext
;
// UIAbilityContext
function
onResultCallback
(
code
:
number
,
result
:
{
[
key
:
string
]:
Object
})
{
function
onResultCallback
(
code
:
number
,
result
:
Record
<
string
,
Object
>
):
void
{
console
.
log
(
'
resultCode:
'
+
code
);
console
.
log
(
'
resultCode:
'
+
code
);
console
.
log
(
'
result:
'
+
JSON
.
stringify
(
result
));
console
.
log
(
'
result:
'
+
JSON
.
stringify
(
result
));
}
}
function
onRequestRedirectedCallback
(
request
:
Want
)
{
function
onRequestRedirectedCallback
(
request
:
Want
)
:
void
{
let
wantInfo
=
{
let
wantInfo
:
Want
=
{
deviceId
:
''
,
deviceId
:
''
,
bundleName
:
'
com.example.accountjsdemo
'
,
bundleName
:
'
com.example.accountjsdemo
'
,
action
:
'
ohos.want.action.viewData
'
,
action
:
'
ohos.want.action.viewData
'
,
entities
:
[
'
entity.system.default
'
],
entities
:
[
'
entity.system.default
'
],
}
}
this
.
context
.
startAbility
(
wantInfo
).
then
(()
=>
{
context
.
startAbility
(
wantInfo
).
then
(()
=>
{
console
.
log
(
'
startAbility successfully
'
);
console
.
log
(
'
startAbility successfully
'
);
}).
catch
((
err
:
BusinessError
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
log
(
'
startAbility err:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
startAbility err:
'
+
JSON
.
stringify
(
err
));
...
@@ -4517,19 +4535,20 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback<Authentic
...
@@ -4517,19 +4535,20 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback<Authentic
import
AbilityConstant
from
'
@ohos.app.ability.AbilityConstant
'
;
import
AbilityConstant
from
'
@ohos.app.ability.AbilityConstant
'
;
export
default
class
EntryAbility
extends
UIAbility
{
export
default
class
EntryAbility
extends
UIAbility
{
onCreate
(
want
:
Want
,
param
:
AbilityConstant
.
LaunchParam
)
{
onCreate
(
want
:
Want
,
param
:
AbilityConstant
.
LaunchParam
)
{
// ability 生命周期函数
let
sessionId
=
want
.
parameters
[
account_appAccount
.
Constants
.
KEY_SESSION_ID
]
;
let
sessionId
:
string
=
want
.
parameters
!
[
account_appAccount
.
Constants
.
KEY_SESSION_ID
]
as
string
;
appAccountManager
.
getAuthenticatorCallback
(
sessionId
,
appAccountManager
.
getAuthenticatorCallback
(
sessionId
,
(
err
:
BusinessError
,
callback
:
account_appAccount
.
AuthenticatorCallback
)
=>
{
(
err
:
BusinessError
,
callback
:
account_appAccount
.
AuthenticatorCallback
)
=>
{
if
(
err
.
code
!=
account_appAccount
.
ResultCode
.
SUCCESS
)
{
if
(
err
.
code
!=
account_appAccount
.
ResultCode
.
SUCCESS
)
{
console
.
log
(
'
getAuthenticatorCallback err:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
getAuthenticatorCallback err:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
let
result
=
{[
account_appAccount
.
Constants
.
KEY_NAME
]:
'
LiSi
'
,
callback
.
onResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
{
[
account_appAccount
.
Constants
.
KEY_OWNER
]:
'
com.example.accountjsdemo
'
,
name
:
'
LiSi
'
,
[
account_appAccount
.
Constants
.
KEY_AUTH_TYPE
]:
'
getSocialData
'
,
owner
:
'
com.example.accountjsdemo
'
,
[
account_appAccount
.
Constants
.
KEY_TOKEN
]:
'
xxxxxx
'
};
authType
:
'
getSocialData
'
,
callback
.
onResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
result
);
token
:
'
xxxxxx
'
}
);
});
});
}
}
}
}
...
@@ -4568,15 +4587,16 @@ getAuthenticatorCallback(sessionId: string): Promise<AuthenticatorCallback>
...
@@ -4568,15 +4587,16 @@ getAuthenticatorCallback(sessionId: string): Promise<AuthenticatorCallback>
import
AbilityConstant
from
'
@ohos.app.ability.AbilityConstant
'
;
import
AbilityConstant
from
'
@ohos.app.ability.AbilityConstant
'
;
export
default
class
EntryAbility
extends
UIAbility
{
export
default
class
EntryAbility
extends
UIAbility
{
onCreate
(
want
:
Want
,
param
:
AbilityConstant
.
LaunchParam
)
{
onCreate
(
want
:
Want
,
param
:
AbilityConstant
.
LaunchParam
)
{
// ability 生命周期函数
let
sessionId
=
want
.
parameters
[
account_appAccount
.
Constants
.
KEY_SESSION_ID
]
;
let
sessionId
:
string
=
want
.
parameters
!
[
account_appAccount
.
Constants
.
KEY_SESSION_ID
]
as
string
;
appAccountManager
.
getAuthenticatorCallback
(
sessionId
).
then
((
appAccountManager
.
getAuthenticatorCallback
(
sessionId
).
then
((
callback
:
account_appAccount
.
AuthenticatorCallback
)
=>
{
callback
:
account_appAccount
.
AuthenticatorCallback
)
=>
{
let
result
=
{[
account_appAccount
.
Constants
.
KEY_NAME
]:
'
LiSi
'
,
callback
.
onResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
{
[
account_appAccount
.
Constants
.
KEY_OWNER
]:
'
com.example.accountjsdemo
'
,
name
:
'
LiSi
'
,
[
account_appAccount
.
Constants
.
KEY_AUTH_TYPE
]:
'
getSocialData
'
,
owner
:
'
com.example.accountjsdemo
'
,
[
account_appAccount
.
Constants
.
KEY_TOKEN
]:
'
xxxxxx
'
};
authType
:
'
getSocialData
'
,
callback
.
onResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
result
);
token
:
'
xxxxxx
'
}
);
}).
catch
((
err
:
BusinessError
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
log
(
'
getAuthenticatorCallback err:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
getAuthenticatorCallback err:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -4855,8 +4875,8 @@ onResult: (code: number, result?: AuthResult) => void
...
@@ -4855,8 +4875,8 @@ onResult: (code: number, result?: AuthResult) => void
let
appAccountManager
=
account_appAccount
.
createAppAccountManager
();
let
appAccountManager
=
account_appAccount
.
createAppAccountManager
();
let
sessionId
=
'
1234
'
;
let
sessionId
=
'
1234
'
;
appAccountManager
.
getAuthCallback
(
sessionId
).
then
((
callback
:
account_appAccount
.
AuthCallback
)
=>
{
appAccountManager
.
getAuthCallback
(
sessionId
).
then
((
callback
:
account_appAccount
.
AuthCallback
)
=>
{
let
result
=
{
let
result
:
account_appAccount
.
AuthResult
=
{
account
Info
:
{
account
:
{
name
:
'
Lisi
'
,
name
:
'
Lisi
'
,
owner
:
'
com.example.accountjsdemo
'
,
owner
:
'
com.example.accountjsdemo
'
,
},
},
...
@@ -4891,16 +4911,17 @@ onRequestRedirected: (request: Want) => void
...
@@ -4891,16 +4911,17 @@ onRequestRedirected: (request: Want) => void
class
MyAuthenticator
extends
account_appAccount
.
Authenticator
{
class
MyAuthenticator
extends
account_appAccount
.
Authenticator
{
createAccountImplicitly
(
createAccountImplicitly
(
options
:
account_appAccount
.
CreateAccountImplicitlyOptions
,
callback
:
account_appAccount
.
AuthCallback
)
{
options
:
account_appAccount
.
CreateAccountImplicitlyOptions
,
callback
:
account_appAccount
.
AuthCallback
)
{
callback
.
onRequestRedirected
({
let
want
:
Want
=
{
bundleName
:
'
com.example.accountjsdemo
'
,
bundleName
:
'
com.example.accountjsdemo
'
,
abilityName
:
'
com.example.accountjsdemo.LoginAbility
'
,
abilityName
:
'
com.example.accountjsdemo.LoginAbility
'
,
});
};
callback
.
onRequestRedirected
(
want
);
}
}
auth
(
name
:
string
,
authType
:
string
,
auth
(
name
:
string
,
authType
:
string
,
options
:
{
[
key
:
string
]:
Object
},
callback
:
account_appAccount
.
AuthCallback
)
{
options
:
{
[
key
:
string
]:
Object
},
callback
:
account_appAccount
.
AuthCallback
)
{
let
result
=
{
let
result
:
account_appAccount
.
AuthResult
=
{
account
Info
:
{
account
:
{
name
:
'
Lisi
'
,
name
:
'
Lisi
'
,
owner
:
'
com.example.accountjsdemo
'
,
owner
:
'
com.example.accountjsdemo
'
,
},
},
...
@@ -4930,9 +4951,11 @@ onRequestContinued?: () => void
...
@@ -4930,9 +4951,11 @@ onRequestContinued?: () => void
let
appAccountManager
=
account_appAccount
.
createAppAccountManager
();
let
appAccountManager
=
account_appAccount
.
createAppAccountManager
();
let
sessionId
=
'
1234
'
;
let
sessionId
=
'
1234
'
;
appAccountManager
.
getAuthCallback
(
sessionId
).
then
((
callback
:
account_appAccount
.
AuthCallback
)
=>
{
appAccountManager
.
getAuthCallback
(
sessionId
).
then
((
callback
:
account_appAccount
.
AuthCallback
)
=>
{
if
(
callback
.
onRequestContinued
!=
undefined
)
{
callback
.
onRequestContinued
();
callback
.
onRequestContinued
();
}
}).
catch
((
err
:
BusinessError
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
log
(
'
getAuthCallback err:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
getAuthCallback err:
'
+
JSON
.
stringify
(
err
));
});
});
```
```
...
@@ -4967,11 +4990,12 @@ onResult: (code: number, result: {[key: string]: any}) => void
...
@@ -4967,11 +4990,12 @@ onResult: (code: number, result: {[key: string]: any}) => void
let
appAccountManager
=
account_appAccount
.
createAppAccountManager
();
let
appAccountManager
=
account_appAccount
.
createAppAccountManager
();
let
sessionId
=
'
1234
'
;
let
sessionId
=
'
1234
'
;
appAccountManager
.
getAuthenticatorCallback
(
sessionId
).
then
((
callback
:
account_appAccount
.
AuthenticatorCallback
)
=>
{
appAccountManager
.
getAuthenticatorCallback
(
sessionId
).
then
((
callback
:
account_appAccount
.
AuthenticatorCallback
)
=>
{
let
result
=
{[
account_appAccount
.
Constants
.
KEY_NAME
]:
'
LiSi
'
,
callback
.
onResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
{
[
account_appAccount
.
Constants
.
KEY_OWNER
]:
'
com.example.accountjsdemo
'
,
name
:
'
LiSi
'
,
[
account_appAccount
.
Constants
.
KEY_AUTH_TYPE
]:
'
getSocialData
'
,
owner
:
'
com.example.accountjsdemo
'
,
[
account_appAccount
.
Constants
.
KEY_TOKEN
]:
'
xxxxxx
'
};
authType
:
'
getSocialData
'
,
callback
.
onResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
result
);
token
:
'
xxxxxx
'
}
);
}).
catch
((
err
:
BusinessError
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
log
(
'
getAuthenticatorCallback err:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
getAuthenticatorCallback err:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -4997,44 +5021,24 @@ onRequestRedirected: (request: Want) => void
...
@@ -4997,44 +5021,24 @@ onRequestRedirected: (request: Want) => void
class
MyAuthenticator
extends
account_appAccount
.
Authenticator
{
class
MyAuthenticator
extends
account_appAccount
.
Authenticator
{
addAccountImplicitly
(
authType
:
string
,
callerBundleName
:
string
,
addAccountImplicitly
(
authType
:
string
,
callerBundleName
:
string
,
options
:
{
[
key
:
string
]:
Object
},
callback
:
account_appAccount
.
AuthenticatorCallback
)
{
options
:
{
[
key
:
string
]:
Object
},
callback
:
account_appAccount
.
AuthenticatorCallback
)
{
callback
.
onRequestRedirected
({
let
want
:
Want
=
{
bundleName
:
'
com.example.accountjsdemo
'
,
bundleName
:
'
com.example.accountjsdemo
'
,
abilityName
:
'
com.example.accountjsdemo.LoginAbility
'
,
abilityName
:
'
com.example.accountjsdemo.LoginAbility
'
,
});
};
callback
.
onRequestRedirected
(
want
);
}
}
authenticate
(
name
:
string
,
authType
:
string
,
callerBundleName
:
string
,
authenticate
(
name
:
string
,
authType
:
string
,
callerBundleName
:
string
,
options
:
{
[
key
:
string
]:
Object
},
callback
:
account_appAccount
.
AuthenticatorCallback
)
{
options
:
{
[
key
:
string
]:
Object
},
callback
:
account_appAccount
.
AuthenticatorCallback
)
{
let
result
=
{[
account_appAccount
.
Constants
.
KEY_NAME
]:
name
,
callback
.
onResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
{
[
account_appAccount
.
Constants
.
KEY_AUTH_TYPE
]:
authType
,
name
:
name
,
[
account_appAccount
.
Constants
.
KEY_TOKEN
]:
'
xxxxxx
'
};
authType
:
authType
,
callback
.
onResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
result
);
token
:
'
xxxxxx
'
}
);
}
}
}
}
```
```
### onRequestContinued<sup>9+</sup>
onRequestContinued?: () =
>
void
通知请求被继续处理。
**系统能力:**
SystemCapability.Account.AppAccount
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
appAccountManager
=
account_appAccount
.
createAppAccountManager
();
let
sessionId
=
'
1234
'
;
appAccountManager
.
getAuthenticatorCallback
(
sessionId
).
then
((
callback
:
account_appAccount
.
AuthenticatorCallback
)
=>
{
callback
.
onRequestContinued
();
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
log
(
'
getAuthenticatorCallback err:
'
+
JSON
.
stringify
(
err
));
});
```
## Authenticator<sup>8+</sup>
## Authenticator<sup>8+</sup>
认证器基类。
认证器基类。
...
@@ -5193,49 +5197,57 @@ getRemoteObject(): rpc.RemoteObject;
...
@@ -5193,49 +5197,57 @@ getRemoteObject(): rpc.RemoteObject;
class
MyAuthenticator
extends
account_appAccount
.
Authenticator
{
class
MyAuthenticator
extends
account_appAccount
.
Authenticator
{
addAccountImplicitly
(
authType
:
string
,
callerBundleName
:
string
,
addAccountImplicitly
(
authType
:
string
,
callerBundleName
:
string
,
options
:
{
[
key
:
string
]:
Object
},
callback
:
account_appAccount
.
AuthenticatorCallback
)
{
options
:
{
[
key
:
string
]:
Object
},
callback
:
account_appAccount
.
AuthenticatorCallback
)
{
callback
.
onRequestRedirected
(
{
let
want
:
Want
=
{
bundleName
:
'
com.example.accountjsdemo
'
,
bundleName
:
'
com.example.accountjsdemo
'
,
abilityName
:
'
com.example.accountjsdemo.LoginAbility
'
,
abilityName
:
'
com.example.accountjsdemo.LoginAbility
'
,
});
};
callback
.
onRequestRedirected
(
want
);
}
}
authenticate
(
name
:
string
,
authType
:
string
,
callerBundleName
:
string
,
authenticate
(
name
:
string
,
authType
:
string
,
callerBundleName
:
string
,
options
:
{
[
key
:
string
]:
Object
},
callback
:
account_appAccount
.
AuthenticatorCallback
)
{
options
:
{
[
key
:
string
]:
Object
},
callback
:
account_appAccount
.
AuthenticatorCallback
)
{
let
result
=
{[
account_appAccount
.
Constants
.
KEY_NAME
]:
name
,
callback
.
onResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
{
[
account_appAccount
.
Constants
.
KEY_AUTH_TYPE
]:
authType
,
name
:
name
,
[
account_appAccount
.
Constants
.
KEY_TOKEN
]:
'
xxxxxx
'
};
authType
:
authType
,
callback
.
onResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
result
);
token
:
'
xxxxxx
'
}
);
}
}
verifyCredential
(
name
:
string
,
verifyCredential
(
name
:
string
,
options
:
account_appAccount
.
VerifyCredentialOptions
,
callback
:
account_appAccount
.
AuthCallback
)
{
options
:
account_appAccount
.
VerifyCredentialOptions
,
callback
:
account_appAccount
.
AuthCallback
)
{
callback
.
onRequestRedirected
(
{
let
want
:
Want
=
{
bundleName
:
'
com.example.accountjsdemo
'
,
bundleName
:
'
com.example.accountjsdemo
'
,
abilityName
:
'
com.example.accountjsdemo.VerifyAbility
'
,
abilityName
:
'
com.example.accountjsdemo.VerifyAbility
'
,
parameters
:
{
parameters
:
{
name
:
name
name
:
name
}
}
});
};
callback
.
onRequestRedirected
(
want
);
}
}
setProperties
(
options
:
account_appAccount
.
SetPropertiesOptions
,
callback
:
account_appAccount
.
AuthCallback
)
{
setProperties
(
options
:
account_appAccount
.
SetPropertiesOptions
,
callback
:
account_appAccount
.
AuthCallback
)
{
callback
.
onResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
{});
let
want
:
Want
=
{
bundleName
:
'
com.example.accountjsdemo
'
,
abilityName
:
'
com.example.accountjsdemo.SetPropertiesAbility
'
,
parameters
:
{
options
:
options
}
};
callback
.
onRequestRedirected
(
want
);
}
}
checkAccountLabels
(
name
:
string
,
labels
:
string
[],
callback
:
account_appAccount
.
AuthCallback
)
{
checkAccountLabels
(
name
:
string
,
labels
:
string
[],
callback
:
account_appAccount
.
AuthCallback
)
{
let
result
=
{[
account_appAccount
.
Constants
.
KEY_BOOLEAN_RESULT
]:
false
};
callback
.
onResult
(
account_appAccount
.
ResultCode
.
SUCCESS
);
callback
.
onResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
result
);
}
}
checkAccountRemovable
(
name
:
string
,
callback
:
account_appAccount
.
AuthCallback
)
{
checkAccountRemovable
(
name
:
string
,
callback
:
account_appAccount
.
AuthCallback
)
{
let
result
=
{[
account_appAccount
.
Constants
.
KEY_BOOLEAN_RESULT
]:
true
};
callback
.
onResult
(
account_appAccount
.
ResultCode
.
SUCCESS
);
callback
.
onResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
result
);
}
}
}
}
let
authenticator
=
null
;
export
default
{
export
default
{
onConnect
(
want
):
rpc
.
RemoteObject
{
onConnect
(
want
):
rpc
.
RemoteObject
{
// serviceAbility 生命周期函数
authenticator
=
new
MyAuthenticator
();
let
authenticator
=
new
MyAuthenticator
();
return
authenticator
.
getRemoteObject
();
return
authenticator
.
getRemoteObject
();
}
}
}
}
...
...
zh-cn/application-dev/reference/apis/js-apis-distributed-account.md
浏览文件 @
ed97251d
...
@@ -297,7 +297,8 @@ setOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCallbac
...
@@ -297,7 +297,8 @@ setOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCallbac
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
let
accountInfo
=
{
id
:
'
12345
'
,
name
:
'
ZhangSan
'
,
event
:
'
Ohos.account.event.LOGIN
'
};
let
accountInfo
:
account_distributedAccount
.
DistributedInfo
=
{
id
:
'
12345
'
,
name
:
'
ZhangSan
'
,
event
:
'
Ohos.account.event.LOGIN
'
};
try
{
try
{
accountAbility
.
setOsAccountDistributedInfo
(
accountInfo
,
(
err
:
BusinessError
)
=>
{
accountAbility
.
setOsAccountDistributedInfo
(
accountInfo
,
(
err
:
BusinessError
)
=>
{
if
(
err
)
{
if
(
err
)
{
...
@@ -346,7 +347,8 @@ setOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise<void>
...
@@ -346,7 +347,8 @@ setOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise<void>
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
let
accountInfo
=
{
id
:
'
12345
'
,
name
:
'
ZhangSan
'
,
event
:
'
Ohos.account.event.LOGIN
'
};
let
accountInfo
:
account_distributedAccount
.
DistributedInfo
=
{
id
:
'
12345
'
,
name
:
'
ZhangSan
'
,
event
:
'
Ohos.account.event.LOGIN
'
};
try
{
try
{
accountAbility
.
setOsAccountDistributedInfo
(
accountInfo
).
then
(()
=>
{
accountAbility
.
setOsAccountDistributedInfo
(
accountInfo
).
then
(()
=>
{
console
.
log
(
'
setOsAccountDistributedInfo successfully
'
);
console
.
log
(
'
setOsAccountDistributedInfo successfully
'
);
...
@@ -391,7 +393,8 @@ setOsAccountDistributedInfoByLocalId(localId: number, distributedInfo: Distribut
...
@@ -391,7 +393,8 @@ setOsAccountDistributedInfoByLocalId(localId: number, distributedInfo: Distribut
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
let
accountInfo
=
{
id
:
'
12345
'
,
name
:
'
ZhangSan
'
,
event
:
'
Ohos.account.event.LOGIN
'
};
let
accountInfo
:
account_distributedAccount
.
DistributedInfo
=
{
id
:
'
12345
'
,
name
:
'
ZhangSan
'
,
event
:
'
Ohos.account.event.LOGIN
'
};
try
{
try
{
accountAbility
.
setOsAccountDistributedInfoByLocalId
(
100
,
accountInfo
,
(
err
:
BusinessError
)
=>
{
accountAbility
.
setOsAccountDistributedInfoByLocalId
(
100
,
accountInfo
,
(
err
:
BusinessError
)
=>
{
if
(
err
)
{
if
(
err
)
{
...
@@ -444,7 +447,8 @@ setOsAccountDistributedInfoByLocalId(localId: number, distributedInfo: Distribut
...
@@ -444,7 +447,8 @@ setOsAccountDistributedInfoByLocalId(localId: number, distributedInfo: Distribut
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
let
accountInfo
=
{
id
:
'
12345
'
,
name
:
'
ZhangSan
'
,
event
:
'
Ohos.account.event.LOGIN
'
};
let
accountInfo
:
account_distributedAccount
.
DistributedInfo
=
{
id
:
'
12345
'
,
name
:
'
ZhangSan
'
,
event
:
'
Ohos.account.event.LOGIN
'
};
try
{
try
{
accountAbility
.
setOsAccountDistributedInfoByLocalId
(
100
,
accountInfo
).
then
(()
=>
{
accountAbility
.
setOsAccountDistributedInfoByLocalId
(
100
,
accountInfo
).
then
(()
=>
{
console
.
log
(
'
setOsAccountDistributedInfoByLocalId successfully
'
);
console
.
log
(
'
setOsAccountDistributedInfoByLocalId successfully
'
);
...
@@ -482,7 +486,8 @@ updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCall
...
@@ -482,7 +486,8 @@ updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCall
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
let
accountInfo
=
{
id
:
'
12345
'
,
name
:
'
ZhangSan
'
,
event
:
'
Ohos.account.event.LOGIN
'
};
let
accountInfo
:
account_distributedAccount
.
DistributedInfo
=
{
id
:
'
12345
'
,
name
:
'
ZhangSan
'
,
event
:
'
Ohos.account.event.LOGIN
'
};
accountAbility
.
updateOsAccountDistributedInfo
(
accountInfo
,
(
err
:
BusinessError
)
=>
{
accountAbility
.
updateOsAccountDistributedInfo
(
accountInfo
,
(
err
:
BusinessError
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
queryOsAccountDistributedInfo exception:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
queryOsAccountDistributedInfo exception:
'
+
JSON
.
stringify
(
err
));
...
@@ -521,7 +526,8 @@ updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise<void>
...
@@ -521,7 +526,8 @@ updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise<void>
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
let
accountInfo
=
{
id
:
'
12345
'
,
name
:
'
ZhangSan
'
,
event
:
'
Ohos.account.event.LOGIN
'
};
let
accountInfo
:
account_distributedAccount
.
DistributedInfo
=
{
id
:
'
12345
'
,
name
:
'
ZhangSan
'
,
event
:
'
Ohos.account.event.LOGIN
'
};
accountAbility
.
updateOsAccountDistributedInfo
(
accountInfo
).
then
(()
=>
{
accountAbility
.
updateOsAccountDistributedInfo
(
accountInfo
).
then
(()
=>
{
console
.
log
(
'
updateOsAccountDistributedInfo successfully
'
);
console
.
log
(
'
updateOsAccountDistributedInfo successfully
'
);
}).
catch
((
err
:
BusinessError
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
...
...
zh-cn/application-dev/reference/apis/js-apis-osAccount.md
浏览文件 @
ed97251d
...
@@ -1249,7 +1249,7 @@ getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallb
...
@@ -1249,7 +1249,7 @@ getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallb
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
domainInfo
=
{
domain
:
'
testDomain
'
,
accountName
:
'
testAccountName
'
};
let
domainInfo
:
account_osAccount
.
DomainAccountInfo
=
{
domain
:
'
testDomain
'
,
accountName
:
'
testAccountName
'
};
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
try
{
accountManager
.
getOsAccountLocalIdForDomain
(
domainInfo
,
(
err
:
BusinessError
,
localId
:
number
)
=>
{
accountManager
.
getOsAccountLocalIdForDomain
(
domainInfo
,
(
err
:
BusinessError
,
localId
:
number
)
=>
{
...
@@ -1298,7 +1298,7 @@ getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise<number&g
...
@@ -1298,7 +1298,7 @@ getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise<number&g
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
domainInfo
=
{
domain
:
'
testDomain
'
,
accountName
:
'
testAccountName
'
};
let
domainInfo
:
account_osAccount
.
DomainAccountInfo
=
{
domain
:
'
testDomain
'
,
accountName
:
'
testAccountName
'
};
try
{
try
{
accountManager
.
getOsAccountLocalIdForDomain
(
domainInfo
).
then
((
localId
:
number
)
=>
{
accountManager
.
getOsAccountLocalIdForDomain
(
domainInfo
).
then
((
localId
:
number
)
=>
{
console
.
log
(
'
getOsAccountLocalIdForDomain successfully, localId:
'
+
localId
);
console
.
log
(
'
getOsAccountLocalIdForDomain successfully, localId:
'
+
localId
);
...
@@ -1765,7 +1765,8 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, cal
...
@@ -1765,7 +1765,8 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, cal
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
domainInfo
=
{
domain
:
'
testDomain
'
,
accountName
:
'
testAccountName
'
};
let
domainInfo
:
account_osAccount
.
DomainAccountInfo
=
{
domain
:
'
testDomain
'
,
accountName
:
'
testAccountName
'
};
try
{
try
{
accountManager
.
createOsAccountForDomain
(
account_osAccount
.
OsAccountType
.
NORMAL
,
domainInfo
,
accountManager
.
createOsAccountForDomain
(
account_osAccount
.
OsAccountType
.
NORMAL
,
domainInfo
,
(
err
:
BusinessError
,
osAccountInfo
:
account_osAccount
.
OsAccountInfo
)
=>
{
(
err
:
BusinessError
,
osAccountInfo
:
account_osAccount
.
OsAccountInfo
)
=>
{
...
@@ -1817,7 +1818,8 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Pr
...
@@ -1817,7 +1818,8 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Pr
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
domainInfo
=
{
domain
:
'
testDomain
'
,
accountName
:
'
testAccountName
'
};
let
domainInfo
:
account_osAccount
.
DomainAccountInfo
=
{
domain
:
'
testDomain
'
,
accountName
:
'
testAccountName
'
};
try
{
try
{
accountManager
.
createOsAccountForDomain
(
account_osAccount
.
OsAccountType
.
NORMAL
,
domainInfo
).
then
(
accountManager
.
createOsAccountForDomain
(
account_osAccount
.
OsAccountType
.
NORMAL
,
domainInfo
).
then
(
(
accountInfo
:
account_osAccount
.
OsAccountInfo
)
=>
{
(
accountInfo
:
account_osAccount
.
OsAccountInfo
)
=>
{
...
@@ -4084,7 +4086,7 @@ getProperty(request: GetPropertyRequest, callback: AsyncCallback<ExecutorProp
...
@@ -4084,7 +4086,7 @@ getProperty(request: GetPropertyRequest, callback: AsyncCallback<ExecutorProp
account_osAccount
.
GetPropertyType
.
REMAIN_TIMES
,
account_osAccount
.
GetPropertyType
.
REMAIN_TIMES
,
account_osAccount
.
GetPropertyType
.
FREEZING_TIME
account_osAccount
.
GetPropertyType
.
FREEZING_TIME
];
];
let
request
=
{
let
request
:
account_osAccount
.
GetPropertyRequest
=
{
authType
:
account_osAccount
.
AuthType
.
PIN
,
authType
:
account_osAccount
.
AuthType
.
PIN
,
keys
:
keys
keys
:
keys
};
};
...
@@ -4138,7 +4140,7 @@ getProperty(request: GetPropertyRequest): Promise<ExecutorProperty>;
...
@@ -4138,7 +4140,7 @@ getProperty(request: GetPropertyRequest): Promise<ExecutorProperty>;
account_osAccount
.
GetPropertyType
.
REMAIN_TIMES
,
account_osAccount
.
GetPropertyType
.
REMAIN_TIMES
,
account_osAccount
.
GetPropertyType
.
FREEZING_TIME
account_osAccount
.
GetPropertyType
.
FREEZING_TIME
];
];
let
request
=
{
let
request
:
account_osAccount
.
GetPropertyRequest
=
{
authType
:
account_osAccount
.
AuthType
.
PIN
,
authType
:
account_osAccount
.
AuthType
.
PIN
,
keys
:
keys
keys
:
keys
};
};
...
@@ -4183,7 +4185,7 @@ setProperty(request: SetPropertyRequest, callback: AsyncCallback<void>): v
...
@@ -4183,7 +4185,7 @@ setProperty(request: SetPropertyRequest, callback: AsyncCallback<void>): v
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
request
=
{
let
request
:
account_osAccount
.
SetPropertyRequest
=
{
authType
:
account_osAccount
.
AuthType
.
PIN
,
authType
:
account_osAccount
.
AuthType
.
PIN
,
key
:
account_osAccount
.
SetPropertyType
.
INIT_ALGORITHM
,
key
:
account_osAccount
.
SetPropertyType
.
INIT_ALGORITHM
,
setInfo
:
new
Uint8Array
([
0
])
setInfo
:
new
Uint8Array
([
0
])
...
@@ -4236,7 +4238,7 @@ setProperty(request: SetPropertyRequest): Promise<void>;
...
@@ -4236,7 +4238,7 @@ setProperty(request: SetPropertyRequest): Promise<void>;
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
request2
=
{
let
request2
:
account_osAccount
.
SetPropertyRequest
=
{
authType
:
account_osAccount
.
AuthType
.
PIN
,
authType
:
account_osAccount
.
AuthType
.
PIN
,
key
:
account_osAccount
.
SetPropertyType
.
INIT_ALGORITHM
,
key
:
account_osAccount
.
SetPropertyType
.
INIT_ALGORITHM
,
setInfo
:
new
Uint8Array
([
0
])
setInfo
:
new
Uint8Array
([
0
])
...
@@ -4608,16 +4610,17 @@ auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUs
...
@@ -4608,16 +4610,17 @@ auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUs
**示例:**
**示例:**
```
js
```
js
import
{
AsyncCallback
}
from
'
./@ohos.base
'
;
import
{
AsyncCallback
}
from
'
./@ohos.base
'
;
let
plugin
=
{
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{
// mock authentication
// mock authentication
// notify authentication result
// notify authentication result
callback
.
onResult
(
0
,
{
let
result
:
account_osAccount
.
AuthResult
=
{
token
:
new
Uint8Array
([
0
]),
token
:
new
Uint8Array
([
0
]),
remainTimes
:
5
,
remainTimes
:
5
,
freezingTime
:
0
freezingTime
:
0
});
};
callback
.
onResult
(
0
,
result
);
},
},
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
...
@@ -4671,18 +4674,19 @@ authWithPopup(domainAccountInfo: DomainAccountInfo, callback: IUserAuthCallback)
...
@@ -4671,18 +4674,19 @@ authWithPopup(domainAccountInfo: DomainAccountInfo, callback: IUserAuthCallback)
**示例:**
**示例:**
```
js
```
js
import
{
AsyncCallback
}
from
'
./@ohos.base
'
;
import
{
AsyncCallback
}
from
'
./@ohos.base
'
;
let
plugin
=
{
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{
// mock authentication
// mock authentication
// notify authentication result
// notify authentication result
callback
.
onResult
(
0
,
{
let
result
:
account_osAccount
.
AuthResult
=
{
token
:
new
Uint8Array
([
0
]),
token
:
new
Uint8Array
([
0
]),
remainTimes
:
5
,
remainTimes
:
5
,
freezingTime
:
0
freezingTime
:
0
});
};
callback
.
onResult
(
0
,
result
);
},
},
authWithToken
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
token
:
Uint8Array
,
authWithToken
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
token
:
Uint8Array
,
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
...
@@ -4721,7 +4725,7 @@ authWithToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback:
...
@@ -4721,7 +4725,7 @@ authWithToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback:
**示例:**
**示例:**
```
js
```
js
import
{
AsyncCallback
}
from
'
./@ohos.base
'
;
import
{
AsyncCallback
}
from
'
./@ohos.base
'
;
let
plugin
=
{
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
...
@@ -4730,11 +4734,12 @@ authWithToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback:
...
@@ -4730,11 +4734,12 @@ authWithToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback:
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{
// mock authentication
// mock authentication
// notify authentication result
// notify authentication result
callback
.
onResult
(
0
,
{
let
result
:
account_osAccount
.
AuthResult
=
{
token
:
new
Uint8Array
([
0
]),
token
:
new
Uint8Array
([
0
]),
remainTimes
:
5
,
remainTimes
:
5
,
freezingTime
:
0
freezingTime
:
0
});
};
callback
.
onResult
(
0
,
result
);
},
},
getAccountInfo
:
(
domain
:
string
,
accountName
:
string
,
getAccountInfo
:
(
domain
:
string
,
accountName
:
string
,
callback
:
AsyncCallback
<
account_osAccount
.
DomainAccountInfo
>
)
=>
{},
callback
:
AsyncCallback
<
account_osAccount
.
DomainAccountInfo
>
)
=>
{},
...
@@ -4771,7 +4776,7 @@ getAccountInfo(domain: string, accountName: string, callback: AsyncCallback<D
...
@@ -4771,7 +4776,7 @@ getAccountInfo(domain: string, accountName: string, callback: AsyncCallback<D
**示例:**
**示例:**
```
js
```
js
import
{
AsyncCallback
,
BusinessError
}
from
'
@ohos.base
'
;
import
{
AsyncCallback
,
BusinessError
}
from
'
@ohos.base
'
;
let
plugin
=
{
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
...
@@ -4782,12 +4787,17 @@ getAccountInfo(domain: string, accountName: string, callback: AsyncCallback<D
...
@@ -4782,12 +4787,17 @@ getAccountInfo(domain: string, accountName: string, callback: AsyncCallback<D
callback
:
AsyncCallback
<
account_osAccount
.
DomainAccountInfo
>
)
=>
{
callback
:
AsyncCallback
<
account_osAccount
.
DomainAccountInfo
>
)
=>
{
// mock getting account information
// mock getting account information
// notify result
// notify result
let
code
:
BusinessError
let
code
:
BusinessError
=
{
callback
(
code
,
{
code
:
0
,
name
:
""
,
message
:
""
};
let
accountInfo
:
account_osAccount
.
DomainAccountInfo
=
{
domain
:
domain
,
domain
:
domain
,
accountName
:
accountName
,
accountName
:
accountName
,
accountId
:
'
xxxx
'
accountId
:
'
xxxx
'
})
};
callback
(
code
,
accountInfo
);
},
},
getAuthStatusInfo
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
getAuthStatusInfo
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
callback
:
AsyncCallback
<
account_osAccount
.
AuthStatusInfo
>
)
=>
{},
callback
:
AsyncCallback
<
account_osAccount
.
AuthStatusInfo
>
)
=>
{},
...
@@ -4821,7 +4831,7 @@ getAuthStatusInfo(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback&
...
@@ -4821,7 +4831,7 @@ getAuthStatusInfo(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback&
**示例:**
**示例:**
```
js
```
js
import
{
AsyncCallback
,
BusinessError
}
from
'
@ohos.base
'
;
import
{
AsyncCallback
,
BusinessError
}
from
'
@ohos.base
'
;
let
plugin
=
{
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
...
@@ -4832,11 +4842,16 @@ getAuthStatusInfo(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback&
...
@@ -4832,11 +4842,16 @@ getAuthStatusInfo(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback&
callback
:
AsyncCallback
<
account_osAccount
.
DomainAccountInfo
>
)
=>
{},
callback
:
AsyncCallback
<
account_osAccount
.
DomainAccountInfo
>
)
=>
{},
getAuthStatusInfo
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
getAuthStatusInfo
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
callback
:
AsyncCallback
<
account_osAccount
.
AuthStatusInfo
>
)
=>
{
callback
:
AsyncCallback
<
account_osAccount
.
AuthStatusInfo
>
)
=>
{
let
code
:
BusinessError
;
let
code
:
BusinessError
=
{
callback
(
code
,
{
code
:
0
,
name
:
""
,
message
:
""
};
let
statusInfo
:
account_osAccount
.
AuthStatusInfo
=
{
remainTimes
:
5
,
remainTimes
:
5
,
freezingTime
:
0
freezingTime
:
0
})
};
callback
(
code
,
statusInfo
);
},
},
bindAccount
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
localId
:
number
,
bindAccount
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
localId
:
number
,
callback
:
AsyncCallback
<
void
>
)
=>
{},
callback
:
AsyncCallback
<
void
>
)
=>
{},
...
@@ -4868,7 +4883,7 @@ bindAccount(domainAccountInfo: DomainAccountInfo, localId: number, callback: Asy
...
@@ -4868,7 +4883,7 @@ bindAccount(domainAccountInfo: DomainAccountInfo, localId: number, callback: Asy
**示例:**
**示例:**
```
js
```
js
import
{
AsyncCallback
,
BusinessError
}
from
'
./@ohos.base
'
;
import
{
AsyncCallback
,
BusinessError
}
from
'
./@ohos.base
'
;
let
plugin
=
{
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
...
@@ -4883,8 +4898,12 @@ bindAccount(domainAccountInfo: DomainAccountInfo, localId: number, callback: Asy
...
@@ -4883,8 +4898,12 @@ bindAccount(domainAccountInfo: DomainAccountInfo, localId: number, callback: Asy
callback
:
AsyncCallback
<
void
>
)
=>
{
callback
:
AsyncCallback
<
void
>
)
=>
{
// mock unbinding operation
// mock unbinding operation
// notify binding result
// notify binding result
let
code
:
BusinessError
;
let
code
:
BusinessError
=
{
callback
(
code
)
code
:
0
,
name
:
""
,
message
:
""
};
callback
(
code
);
},
},
unbindAccount
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
callback
:
AsyncCallback
<
void
>
)
=>
{},
unbindAccount
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
callback
:
AsyncCallback
<
void
>
)
=>
{},
isAccountTokenValid
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
token
:
Uint8Array
,
isAccountTokenValid
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
token
:
Uint8Array
,
...
@@ -4914,7 +4933,7 @@ unbindAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<v
...
@@ -4914,7 +4933,7 @@ unbindAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<v
**示例:**
**示例:**
```
js
```
js
import
{
AsyncCallback
,
BusinessError
}
from
'
./@ohos.base
'
;
import
{
AsyncCallback
,
BusinessError
}
from
'
./@ohos.base
'
;
let
plugin
=
{
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
...
@@ -4930,8 +4949,12 @@ unbindAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<v
...
@@ -4930,8 +4949,12 @@ unbindAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<v
unbindAccount
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
callback
:
AsyncCallback
<
void
>
)
=>
{
unbindAccount
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
callback
:
AsyncCallback
<
void
>
)
=>
{
// mock unbinding operation
// mock unbinding operation
// notify unbinding result
// notify unbinding result
let
code
:
BusinessError
;
let
code
:
BusinessError
=
{
callback
(
code
)
code
:
0
,
name
:
""
,
message
:
""
};
callback
(
code
);
},
},
isAccountTokenValid
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
token
:
Uint8Array
,
isAccountTokenValid
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
token
:
Uint8Array
,
callback
:
AsyncCallback
<
boolean
>
)
=>
{},
callback
:
AsyncCallback
<
boolean
>
)
=>
{},
...
@@ -4961,7 +4984,7 @@ isAccountTokenValid(domainAccountInfo: DomainAccountInfo, token: Uint8Array, cal
...
@@ -4961,7 +4984,7 @@ isAccountTokenValid(domainAccountInfo: DomainAccountInfo, token: Uint8Array, cal
**示例:**
**示例:**
```
js
```
js
import
{
AsyncCallback
,
BusinessError
}
from
'
./@ohos.base
'
;
import
{
AsyncCallback
,
BusinessError
}
from
'
./@ohos.base
'
;
let
plugin
=
{
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
...
@@ -4979,7 +5002,11 @@ isAccountTokenValid(domainAccountInfo: DomainAccountInfo, token: Uint8Array, cal
...
@@ -4979,7 +5002,11 @@ isAccountTokenValid(domainAccountInfo: DomainAccountInfo, token: Uint8Array, cal
callback
:
AsyncCallback
<
boolean
>
)
=>
{
callback
:
AsyncCallback
<
boolean
>
)
=>
{
// mock checking operation
// mock checking operation
// notify checking result
// notify checking result
let
code
:
BusinessError
let
code
:
BusinessError
=
{
code
:
0
,
name
:
""
,
message
:
""
};
callback
(
code
,
true
);
callback
(
code
,
true
);
},
},
getAccessToken
:
(
options
:
account_osAccount
.
GetDomainAccessTokenOptions
,
callback
:
AsyncCallback
<
Uint8Array
>
)
=>
{}
getAccessToken
:
(
options
:
account_osAccount
.
GetDomainAccessTokenOptions
,
callback
:
AsyncCallback
<
Uint8Array
>
)
=>
{}
...
@@ -5007,7 +5034,7 @@ getAccessToken(options: GetDomainAccessTokenOptions, callback: AsyncCallback<
...
@@ -5007,7 +5034,7 @@ getAccessToken(options: GetDomainAccessTokenOptions, callback: AsyncCallback<
**示例:**
**示例:**
```
js
```
js
import
{
AsyncCallback
,
BusinessError
}
from
'
./@ohos.base
'
;
import
{
AsyncCallback
,
BusinessError
}
from
'
./@ohos.base
'
;
let
plugin
=
{
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
...
@@ -5025,9 +5052,13 @@ getAccessToken(options: GetDomainAccessTokenOptions, callback: AsyncCallback<
...
@@ -5025,9 +5052,13 @@ getAccessToken(options: GetDomainAccessTokenOptions, callback: AsyncCallback<
callback
:
AsyncCallback
<
boolean
>
)
=>
{},
callback
:
AsyncCallback
<
boolean
>
)
=>
{},
getAccessToken
:
(
options
:
account_osAccount
.
GetDomainAccessTokenOptions
,
callback
:
AsyncCallback
<
Uint8Array
>
)
=>
{
getAccessToken
:
(
options
:
account_osAccount
.
GetDomainAccessTokenOptions
,
callback
:
AsyncCallback
<
Uint8Array
>
)
=>
{
// mock getting operation
// mock getting operation
//let token = new Uint8Array([0]);
// notify result
// notify result
let
code
:
BusinessError
let
code
:
BusinessError
=
{
code
:
0
,
name
:
""
,
message
:
""
};
let
token
:
Uint8Array
=
new
Uint8Array
([
0
]);
callback
(
code
,
token
);
callback
(
code
,
token
);
}
}
}
}
...
@@ -5064,7 +5095,7 @@ static registerPlugin(plugin: DomainPlugin): void
...
@@ -5064,7 +5095,7 @@ static registerPlugin(plugin: DomainPlugin): void
**示例:**
**示例:**
```
js
```
js
import
{
AsyncCallback
}
from
'
./@ohos.base
'
;
import
{
AsyncCallback
}
from
'
./@ohos.base
'
;
let
plugin
=
{
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
callback
:
account_osAccount
.
IUserAuthCallback
)
=>
{},
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
authWithPopup
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
...
@@ -5150,7 +5181,7 @@ auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUs
...
@@ -5150,7 +5181,7 @@ auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUs
**示例:**
**示例:**
```
js
```
js
let
domainAccountInfo
=
{
let
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
=
{
domain
:
'
CHINA
'
,
domain
:
'
CHINA
'
,
accountName
:
'
zhangsan
'
accountName
:
'
zhangsan
'
}
}
...
@@ -5347,7 +5378,7 @@ hasAccount(domainAccountInfo: DomainAccountInfo): Promise<boolean>
...
@@ -5347,7 +5378,7 @@ hasAccount(domainAccountInfo: DomainAccountInfo): Promise<boolean>
**示例:**
**示例:**
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
domainAccountInfo
=
{
let
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
=
{
domain
:
'
CHINA
'
,
domain
:
'
CHINA
'
,
accountName
:
'
zhangsan
'
accountName
:
'
zhangsan
'
}
}
...
@@ -5393,7 +5424,7 @@ updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, call
...
@@ -5393,7 +5424,7 @@ updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, call
**示例:**
**示例:**
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
domainAccountInfo
=
{
let
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
=
{
domain
:
'
CHINA
'
,
domain
:
'
CHINA
'
,
accountName
:
'
zhangsan
'
,
accountName
:
'
zhangsan
'
,
accountId
:
'
123456
'
accountId
:
'
123456
'
...
@@ -5448,7 +5479,7 @@ updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array): Pro
...
@@ -5448,7 +5479,7 @@ updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array): Pro
**示例:**
**示例:**
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
domainAccountInfo
=
{
let
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
=
{
domain
:
'
CHINA
'
,
domain
:
'
CHINA
'
,
accountName
:
'
zhangsan
'
,
accountName
:
'
zhangsan
'
,
accountId
:
'
123456
'
accountId
:
'
123456
'
...
@@ -5662,10 +5693,10 @@ updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
...
@@ -5662,10 +5693,10 @@ updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
let
userAuth
:
account_osAccount
.
UserAuth
=
new
account_osAccount
.
UserAuth
();
let
userAuth
:
account_osAccount
.
UserAuth
=
new
account_osAccount
.
UserAuth
();
let
pinAuth
:
account_osAccount
.
PINAuth
=
new
account_osAccount
.
PINAuth
();
let
pinAuth
:
account_osAccount
.
PINAuth
=
new
account_osAccount
.
PINAuth
();
let
password
:
Uint8Array
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
,
0
]);
let
password
:
Uint8Array
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
,
0
]);
let
credentialInfo
=
{
let
credentialInfo
:
account_osAccount
.
CredentialInfo
=
{
credType
:
account_osAccount
.
AuthType
.
PIN
,
credType
:
account_osAccount
.
AuthType
.
PIN
,
credSubType
:
account_osAccount
.
AuthSubType
.
PIN_SIX
,
credSubType
:
account_osAccount
.
AuthSubType
.
PIN_SIX
,
token
:
n
ull
token
:
n
ew
Uint8Array
([]),
};
};
pinAuth
.
registerInputer
({
pinAuth
.
registerInputer
({
onGetData
:
(
authSubType
:
account_osAccount
.
AuthSubType
,
callback
:
account_osAccount
.
IInputData
)
=>
{
onGetData
:
(
authSubType
:
account_osAccount
.
AuthSubType
,
callback
:
account_osAccount
.
IInputData
)
=>
{
...
@@ -5678,7 +5709,9 @@ updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
...
@@ -5678,7 +5709,9 @@ updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
if
(
result
!=
account_osAccount
.
ResultCode
.
SUCCESS
)
{
if
(
result
!=
account_osAccount
.
ResultCode
.
SUCCESS
)
{
return
;
return
;
}
}
credentialInfo
.
token
=
extraInfo
.
token
;
if
(
extraInfo
.
token
!=
null
)
{
credentialInfo
.
token
=
extraInfo
.
token
;
}
try
{
try
{
userIDM
.
updateCredential
(
credentialInfo
,
{
userIDM
.
updateCredential
(
credentialInfo
,
{
onResult
:
(
result
:
number
,
extraInfo
:
account_osAccount
.
RequestResult
)
=>
{
onResult
:
(
result
:
number
,
extraInfo
:
account_osAccount
.
RequestResult
)
=>
{
...
@@ -5997,7 +6030,7 @@ onSetData: (authSubType: AuthSubType, data: Uint8Array) => void;
...
@@ -5997,7 +6030,7 @@ onSetData: (authSubType: AuthSubType, data: Uint8Array) => void;
```
js
```
js
let
password
:
Uint8Array
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
,
0
]);
let
password
:
Uint8Array
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
,
0
]);
let
passwordNumber
:
Uint8Array
=
new
Uint8Array
([
1
,
2
,
3
,
4
]);
let
passwordNumber
:
Uint8Array
=
new
Uint8Array
([
1
,
2
,
3
,
4
]);
let
inputer
=
{
let
inputer
:
account_osAccount
.
IInputer
=
{
onGetData
:
(
authSubType
:
account_osAccount
.
AuthSubType
,
callback
:
account_osAccount
.
IInputData
)
=>
{
onGetData
:
(
authSubType
:
account_osAccount
.
AuthSubType
,
callback
:
account_osAccount
.
IInputData
)
=>
{
if
(
authSubType
==
account_osAccount
.
AuthSubType
.
PIN_NUMBER
)
{
if
(
authSubType
==
account_osAccount
.
AuthSubType
.
PIN_NUMBER
)
{
callback
.
onSetData
(
authSubType
,
passwordNumber
);
callback
.
onSetData
(
authSubType
,
passwordNumber
);
...
@@ -6034,7 +6067,7 @@ onGetData: (authSubType: AuthSubType, callback: IInputData) => void;
...
@@ -6034,7 +6067,7 @@ onGetData: (authSubType: AuthSubType, callback: IInputData) => void;
```
js
```
js
let
password
:
Uint8Array
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
,
0
]);
let
password
:
Uint8Array
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
,
0
]);
let
passwordNumber
:
Uint8Array
=
new
Uint8Array
([
1
,
2
,
3
,
4
]);
let
passwordNumber
:
Uint8Array
=
new
Uint8Array
([
1
,
2
,
3
,
4
]);
let
inputer
=
{
let
inputer
:
account_osAccount
.
IInputer
=
{
onGetData
:
(
authSubType
:
account_osAccount
.
AuthSubType
,
callback
:
account_osAccount
.
IInputData
)
=>
{
onGetData
:
(
authSubType
:
account_osAccount
.
AuthSubType
,
callback
:
account_osAccount
.
IInputData
)
=>
{
if
(
authSubType
==
account_osAccount
.
AuthSubType
.
PIN_NUMBER
)
{
if
(
authSubType
==
account_osAccount
.
AuthSubType
.
PIN_NUMBER
)
{
callback
.
onSetData
(
authSubType
,
passwordNumber
);
callback
.
onSetData
(
authSubType
,
passwordNumber
);
...
@@ -6073,8 +6106,8 @@ onResult: (result: number, extraInfo: AuthResult) => void;
...
@@ -6073,8 +6106,8 @@ onResult: (result: number, extraInfo: AuthResult) => void;
**示例:**
**示例:**
```
js
```
js
let
authCallback
=
{
let
authCallback
:
account_osAccount
.
IUserAuthCallback
=
{
onResult
:
(
result
:
account_osAccount
.
AuthSubType
,
extraInfo
:
account_osAccount
.
IInputData
)
=>
{
onResult
:
(
result
:
number
,
extraInfo
:
account_osAccount
.
AuthResult
)
=>
{
console
.
log
(
'
auth result =
'
+
result
);
console
.
log
(
'
auth result =
'
+
result
);
console
.
log
(
'
auth extraInfo =
'
+
JSON
.
stringify
(
extraInfo
));
console
.
log
(
'
auth extraInfo =
'
+
JSON
.
stringify
(
extraInfo
));
}
}
...
@@ -6101,8 +6134,8 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
...
@@ -6101,8 +6134,8 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
**示例:**
**示例:**
```
js
```
js
let
authCallback
=
{
let
authCallback
:
account_osAccount
.
IUserAuthCallback
=
{
onResult
:
(
result
:
account_osAccount
.
AuthSubType
,
extraInfo
:
account_osAccount
.
IInputData
)
=>
{
onResult
:
(
result
:
number
,
extraInfo
:
account_osAccount
.
AuthResult
)
=>
{
console
.
log
(
'
auth result =
'
+
result
)
console
.
log
(
'
auth result =
'
+
result
)
console
.
log
(
'
auth extraInfo =
'
+
JSON
.
stringify
(
extraInfo
));
console
.
log
(
'
auth extraInfo =
'
+
JSON
.
stringify
(
extraInfo
));
},
},
...
@@ -6139,7 +6172,7 @@ onResult: (result: number, extraInfo: RequestResult) => void;
...
@@ -6139,7 +6172,7 @@ onResult: (result: number, extraInfo: RequestResult) => void;
**示例:**
**示例:**
```
js
```
js
let
idmCallback
=
{
let
idmCallback
:
account_osAccount
.
IIdmCallback
=
{
onResult
:
(
result
:
number
,
extraInfo
:
account_osAccount
.
RequestResult
)
=>
{
onResult
:
(
result
:
number
,
extraInfo
:
account_osAccount
.
RequestResult
)
=>
{
console
.
log
(
'
callback result =
'
+
result
)
console
.
log
(
'
callback result =
'
+
result
)
console
.
info
(
'
callback extraInfo =
'
+
JSON
.
stringify
(
extraInfo
));
console
.
info
(
'
callback extraInfo =
'
+
JSON
.
stringify
(
extraInfo
));
...
@@ -6167,7 +6200,7 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
...
@@ -6167,7 +6200,7 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
**示例:**
**示例:**
```
js
```
js
let
idmCallback
=
{
let
idmCallback
:
account_osAccount
.
IIdmCallback
=
{
onResult
:
(
result
:
number
,
extraInfo
:
Object
)
=>
{
onResult
:
(
result
:
number
,
extraInfo
:
Object
)
=>
{
console
.
log
(
'
callback result =
'
+
result
)
console
.
log
(
'
callback result =
'
+
result
)
console
.
log
(
'
callback onResult =
'
+
JSON
.
stringify
(
extraInfo
));
console
.
log
(
'
callback onResult =
'
+
JSON
.
stringify
(
extraInfo
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录