Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
d6ce4c71
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
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看板
未验证
提交
d6ce4c71
编写于
3月 15, 2023
作者:
O
openharmony_ci
提交者:
Gitee
3月 15, 2023
浏览文件
操作
浏览文件
下载
差异文件
!16055 翻译完成:15406 添加js凭据管理接口文档
Merge pull request !16055 from wusongqing/TR15406V2
上级
67ea6c44
40c6c802
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
134 addition
and
6 deletion
+134
-6
en/application-dev/reference/apis/js-apis-device-manager.md
en/application-dev/reference/apis/js-apis-device-manager.md
+134
-6
未找到文件。
en/application-dev/reference/apis/js-apis-device-manager.md
浏览文件 @
d6ce4c71
...
@@ -131,12 +131,12 @@ Defines subscription information.
...
@@ -131,12 +131,12 @@ Defines subscription information.
| Name | Type | Mandatory | Description |
| Name | Type | Mandatory | Description |
| ------------- | --------------------------------- | ---- | ----------------- |
| ------------- | --------------------------------- | ---- | ----------------- |
| subscribeId | number | Yes | Subscription ID, used to identify a device discovery period.|
| subscribeId | number | Yes | Subscription ID, used to identify a device discovery period.|
| mode |
[
DiscoverMode
](
#discovermode
)
|
No
| Device discovery mode. |
| mode |
[
DiscoverMode
](
#discovermode
)
|
Yes
| Device discovery mode. |
| medium |
[
ExchangeMedium
](
#exchangemedium
)
|
No
| Medium used for device discovery. |
| medium |
[
ExchangeMedium
](
#exchangemedium
)
|
Yes
| Medium used for device discovery. |
| freq |
[
ExchangeFreq
](
#exchangefreq
)
|
No
| Frequency of device discovery. |
| freq |
[
ExchangeFreq
](
#exchangefreq
)
|
Yes
| Frequency of device discovery. |
| isSameAccount | boolean |
No
| Whether the same account is used on the discovered device. |
| isSameAccount | boolean |
Yes
| Whether the same account is used on the discovered device. |
| isWakeRemote | boolean |
No
| Whether to wake up the discovered device. |
| isWakeRemote | boolean |
Yes
| Whether to wake up the discovered device. |
| capability |
[
SubscribeCap
](
#subscribecap
)
|
No
| Discovery capability. |
| capability |
[
SubscribeCap
](
#subscribecap
)
|
Yes
| Discovery capability. |
## DiscoverMode
## DiscoverMode
...
@@ -874,6 +874,134 @@ Sets a user operation.
...
@@ -874,6 +874,134 @@ Sets a user operation.
}
}
```
```
### requestCredentialRegisterInfo<sup>10+</sup>
requestCredentialRegisterInfo(requestInfo: string, callback: AsyncCallback
<
{
registerInfo:
string
}
>
): void;
Obtains the registration information of the credential.
**Required permissions**
: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**
: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
| Name | Type | Mandatory | Description |
| ------------- | --------------- | ---- | ------------------- |
| requestInfo | string | Yes | Request credential information. |
| callback | AsyncCallback
<
{
registerInfo:
string
}
>
| Yes | Callback used to return the credential registration information.|
**Example**
```
js
let
credentialInfo
=
{
"
version
"
:
"
1.2.3
"
,
"
userId
"
:
"
123
"
}
try
{
dmClass
.
requestCredentialRegisterInfo
(
credentialInfo
,
(
data
)
=>
{
if
(
data
)
{
console
.
info
(
"
requestCredentialRegisterInfo result:
"
+
JSON
.
stringify
(
data
));
}
else
{
console
.
info
.
push
(
"
requestCredentialRegisterInfo result: data is null
"
);
}
});
}
catch
(
err
)
{
console
.
error
(
"
requestCredentialRegisterInfo err:
"
+
err
.
code
+
"
,
"
+
err
.
message
);
}
```
### importCredential<sup>10+</sup>
importCredential(credentialInfo: string, callback: AsyncCallback
<
{
resultInfo:
string
}
>
): void;
Imports credential information.
**Required permissions**
: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**
: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
| Name | Type | Mandatory | Description |
| ------------- | --------------- | ---- | ------------------- |
| credentialInfo| string | Yes | Credential information to import. |
| callback | AsyncCallback
<
{
resultInfo:
string
}
>
| Yes | Callback used to return the result.|
**Example**
```
js
let
credentialInfo
=
{
"
processType
"
:
1
,
"
authType
"
:
1
,
"
userId
"
:
"
123
"
,
"
deviceId
"
:
"
aaa
"
,
"
version
"
:
"
1.2.3
"
,
"
devicePk
"
:
"
0000
"
,
"
credentialData
"
:
[
{
"
credentialType
"
:
2
,
"
credentialId
"
:
"
102
"
,
"
serverPk
"
:
"
3059301306072A8648CE3D020106082A8648CE3D03
"
,
"
pkInfoSignature
"
:
"
30440220490BCB4F822004C9A76AB8D97F80041FC0E
"
,
"
pkInfo
"
:
""
,
"
authCode
"
:
""
,
"
peerDeviceId
"
:
""
}
]
}
try
{
dmClass
.
importCredential
(
credentialInfo
,
(
data
)
=>
{
if
(
data
)
{
console
.
info
(
"
importCredential result:
"
+
JSON
.
stringify
(
data
));
}
else
{
console
.
info
.
push
(
"
importCredential result: data is null
"
);
}
});
}
catch
(
err
)
{
console
.
error
(
"
importCredential err:
"
+
err
.
code
+
"
,
"
+
err
.
message
);
}
```
### deleteCredential<sup>10+</sup>
deleteCredential(queryInfo: string, callback: AsyncCallback
<
{
resultInfo:
string
}
>
): void;
Deletes credential information.
**Required permissions**
: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**
: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
| Name | Type | Mandatory | Description |
| ------------- | --------------- | ---- | ------------------- |
| queryInfo | string | Yes | Credential information to delete. |
| callback | AsyncCallback
<
{
resultInfo:
string
}
>
| Yes | Callback used to return the result.|
**Example**
```
js
let
queryInfo
=
{
"
processType
"
:
1
,
"
authType
"
:
1
,
"
userId
"
:
"
123
"
}
try
{
dmClass
.
deleteCredential
(
queryInfo
,
(
data
)
=>
{
if
(
data
)
{
console
.
info
(
"
deleteCredential result:
"
+
JSON
.
stringify
(
data
));
}
else
{
console
.
info
.
push
(
"
deleteCredential result: data is null
"
);
}
});
}
catch
(
err
)
{
console
.
error
(
"
deleteCredential err:
"
+
err
.
code
+
"
,
"
+
err
.
message
);
}
```
### on('uiStateChange')<sup>9+</sup>
### on('uiStateChange')<sup>9+</sup>
on(type: 'uiStateChange', callback: Callback
<
{ param: string}
>
): void;
on(type: 'uiStateChange', callback: Callback
<
{ param: string}
>
): void;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录