Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
0b01b141
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看板
提交
0b01b141
编写于
1月 19, 2023
作者:
J
jidong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add new api docs
Signed-off-by:
N
jidong
<
jidong4@huawei.com
>
Change-Id: I6912add9f419eba07707377d46b08a926bc2077a
上级
8c99526d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
126 addition
and
22 deletion
+126
-22
zh-cn/application-dev/reference/apis/js-apis-appAccount.md
zh-cn/application-dev/reference/apis/js-apis-appAccount.md
+5
-13
zh-cn/application-dev/reference/apis/js-apis-osAccount.md
zh-cn/application-dev/reference/apis/js-apis-osAccount.md
+121
-9
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-appAccount.md
浏览文件 @
0b01b141
...
...
@@ -1114,8 +1114,6 @@ getAllAccounts(callback: AsyncCallback<Array<AppAccountInfo>>): void
获取所有可访问的应用帐号信息。使用callback异步回调。
**需要权限:**
ohos.permission.GET_ALL_APP_ACCOUNTS。
**系统能力:**
SystemCapability.Account.AppAccount
**参数:**
...
...
@@ -1153,8 +1151,6 @@ getAllAccounts(): Promise<Array<AppAccountInfo>>
获取所有可访问的应用帐号信息。使用Promise异步回调。
**需要权限:**
ohos.permission.GET_ALL_APP_ACCOUNTS。
**系统能力:**
SystemCapability.Account.AppAccount
**返回值:**
...
...
@@ -1190,8 +1186,6 @@ getAccountsByOwner(owner: string, callback: AsyncCallback<Array<AppAccount
根据应用帐号所有者获取调用方可访问的应用帐号列表。使用callback异步回调。
**需要权限:**
ohos.permission.GET_ALL_APP_ACCOUNTS。
**系统能力:**
SystemCapability.Account.AppAccount
**参数:**
...
...
@@ -1232,8 +1226,6 @@ getAccountsByOwner(owner: string): Promise<Array<AppAccountInfo>>
根据应用帐号所有者获取调用方可访问的应用帐号列表。使用Promise异步回调。
**需要权限:**
ohos.permission.GET_ALL_APP_ACCOUNTS。
**系统能力:**
SystemCapability.Account.AppAccount
**参数:**
...
...
@@ -1312,7 +1304,7 @@ on(type: 'accountChange', owners: Array<string>, callback: Callback<Arr
### off('accountChange')<sup>9+</sup>
off(type: 'accountChange', callback?: Callback
<Array
\<
AppAccountInfo
>
>
): void
off(type: 'accountChange', callback?: Callback
<
Array
<
AppAccountInfo
>>
): void
取消订阅帐号信息变更事件。
...
...
@@ -1323,7 +1315,7 @@ off(type: 'accountChange', callback?: Callback<Array\<AppAccountInfo>>): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------- | ---- | ------------ |
| type | 'accountChange' | 是 | 事件回调类型,支持的事件为'accountChange',当帐号所有者更新帐号信息时,触发该事件。 |
| callback | Callback
<Array
\<[
AppAccountInfo
](
#appaccountinfo
)
>
>
| 否 | 回调函数,返回信息发生变更的应用帐号列表。 |
| callback | Callback
<
Array
<
[AppAccountInfo](#appaccountinfo)
>>
| 否 | 回调函数,返回信息发生变更的应用帐号列表。 |
**错误码:**
...
...
@@ -1337,7 +1329,7 @@ off(type: 'accountChange', callback?: Callback<Array\<AppAccountInfo>>): void
```
js
let
appAccountManager
=
account_appAccount
.
createAppAccountManager
();
function
changeOnCallback
(
data
){
function
changeOnCallback
(
data
)
{
console
.
log
(
"
receive change data:
"
+
JSON
.
stringify
(
data
));
}
try
{
...
...
@@ -3790,7 +3782,7 @@ on(type: 'change', owners: Array<string>, callback: Callback<Array<A
### off('change')<sup>(deprecated)</sup>
off(type: 'change', callback?: Callback
<Array
\<
AppAccountInfo
>
>
): void
off(type: 'change', callback?: Callback
<
Array
<
AppAccountInfo
>>
): void
取消订阅帐号信息变更事件。
...
...
@@ -3805,7 +3797,7 @@ off(type: 'change', callback?: Callback<Array\<AppAccountInfo>>): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------- | ---- | ------------ |
| type | 'change' | 是 | 事件回调类型,支持的事件为'change',当帐号所有者更新帐号信息时,触发该事件。 |
| callback | Callback
<Array
\<[
AppAccountInfo
](
#appaccountinfo
)
>
>
| 否 | 回调函数,返回信息发生变更的应用帐号列表。 |
| callback | Callback
<
Array
<
[AppAccountInfo](#appaccountinfo)
>>
| 否 | 回调函数,返回信息发生变更的应用帐号列表。 |
**示例:**
...
...
zh-cn/application-dev/reference/apis/js-apis-osAccount.md
浏览文件 @
0b01b141
...
...
@@ -4323,13 +4323,13 @@ unregisterInputer(): void;
pinAuth
.
unregisterInputer
();
```
##
# InputerManager <sup>10
+</sup>
##
InputerManager <sup>9
+</sup>
凭据输入管理器。
### registerInputer<sup>
10
+</sup>
### registerInputer<sup>
9
+</sup>
registerInputer(authType: AuthType, inputer: IInputer): void;
static registerInputer(authType: AuthType, inputer: IInputer): void
注册凭据输入器。
...
...
@@ -4357,11 +4357,10 @@ registerInputer(authType: AuthType, inputer: IInputer): void;
**示例:**
```
js
let
inputerMgr
=
new
account_osAccount
.
InputerManager
();
let
authType
=
account_osAccount
.
AuthType
.
DOMAIN
;
let
password
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
]);
try
{
inputerMg
r
.
registerInputer
(
authType
,
{
account_osAccount
.
InputerManage
r
.
registerInputer
(
authType
,
{
onGetData
:
(
authSubType
,
callback
)
=>
{
callback
.
onSetData
(
authSubType
,
password
);
}
...
...
@@ -4372,9 +4371,9 @@ registerInputer(authType: AuthType, inputer: IInputer): void;
}
```
### unregisterInputer<sup>
10
+</sup>
### unregisterInputer<sup>
9
+</sup>
unregisterInputer(authType: AuthType): void;
static unregisterInputer(authType: AuthType): void
解注册凭据输入器。
...
...
@@ -4398,16 +4397,129 @@ unregisterInputer(authType: AuthType): void;
**示例:**
```
js
let
inputerMgr
=
new
account_osAccount
.
InputerManager
();
let
authType
=
account_osAccount
.
AuthType
.
DOMAIN
;
try
{
inputerMg
r
.
unregisterInputer
(
authType
);
account_osAccount
.
InputerManage
r
.
unregisterInputer
(
authType
);
console
.
log
(
'
unregisterInputer success.
'
);
}
catch
(
err
)
{
console
.
log
(
"
unregisterInputer err:
"
+
JSON
.
stringify
(
err
));
}
```
## DomainPlugin<sup>9+</sup>
域插件,提供域帐号认证功能。
**系统接口:**
此接口为系统接口。
### auth<sup>9+</sup>
auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUserAuthCallback): void
认证指定的域帐号。
**系统接口:**
此接口为系统接口。
**系统能力:**
SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | --------------------------------------- | ---- | --------------- |
| domainAccountInfo |
[
DomainAccountInfo
](
#domainaccountinfo8
)
| 是 | 指示域帐号信息。|
| credential | Uint8Array | 是 | 指示域帐号的凭据。|
| callback |
[
IUserAuthCallback
](
#iuserauthcallback8
)
| 是 | 指示认证结果回调。|
**示例:**
```
js
let
plugin
=
{
auth
:
(
domainInfo
,
credential
,
callback
)
=>
{
// mock authentication
callback
.
onResult
(
0
,
{});
}
}
account_osAccount
.
DomainAccountManager
.
registerPlugin
(
plugin
);
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
challenge
=
new
Uint8Array
([
0
]);
let
authType
=
account_osAccount
.
AuthType
.
PIN
;
let
authTrustLevel
=
account_osAccount
.
AuthTrustLevel
.
ATL1
;
try
{
userAuth
.
auth
(
challenge
,
authType
,
authTrustLevel
,
{
onResult
:
(
resultCode
,
authResult
)
=>
{
console
.
log
(
'
auth resultCode =
'
+
resultCode
);
console
.
log
(
'
auth authResult =
'
+
JSON
.
stringify
(
authResult
));
}
});
}
catch
(
err
)
{
console
.
log
(
'
auth exception =
'
+
JSON
.
stringify
(
err
));
}
```
## DomainAccountManager <sup>9+</sup>
域帐号管理器类。
### registerPlugin<sup>9+</sup>
static registerPlugin(plugin: DomainPlugin): void
注册域插件。
**系统接口:**
此接口为系统接口。
**系统能力:**
SystemCapability.Account.OsAccount
**需要权限:**
ohos.permission.MANAGE_LOCAL_ACCOUNTS
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------| ----------------------- | --- | -------------------------- |
| plugin |
[
DomainPlugin
](
#domainplugin9
)
| 是 | 指示域插件。 |
**错误码:**
| 错误码ID | 错误信息 |
| -------- | --------------------------- |
| 12300201 | The domain plugin has been registered. |
**示例:**
```
js
let
plugin
=
{
auth
:
(
domainInfo
,
credential
,
callback
)
=>
{
// mock authentication
callback
.
onResult
(
0
,
{});
}
}
try
{
account_osAccount
.
DomainAccountManager
.
registerPlugin
(
plugin
);
console
.
log
(
'
registerPlugin success.
'
);
}
catch
(
err
)
{
console
.
log
(
"
registerPlugin err:
"
+
JSON
.
stringify
(
err
));
}
```
### unregisterPlugin<sup>9+</sup>
static unregisterPlugin(): void
注销域插件。
**系统接口:**
此接口为系统接口。
**系统能力:**
SystemCapability.Account.OsAccount
**需要权限:**
ohos.permission.MANAGE_LOCAL_ACCOUNTS
**示例:**
```
js
try
{
account_osAccount
.
DomainAccountManager
.
unregisterPlugin
();
console
.
log
(
'
unregisterPlugin success.
'
);
}
catch
(
err
)
{
console
.
log
(
"
unregisterPlugin err:
"
+
JSON
.
stringify
(
err
));
}
```
## UserIdentityManager<sup>8+</sup>
获取用户身份管理类。
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录