Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
86e65fa2
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看板
未验证
提交
86e65fa2
编写于
12月 13, 2022
作者:
O
openharmony_ci
提交者:
Gitee
12月 13, 2022
浏览文件
操作
浏览文件
下载
差异文件
!12314 【账号】新增域账号认证方式
Merge pull request !12314 from 王一卉/domain_api
上级
c8596ecf
4817c383
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
116 addition
and
33 deletion
+116
-33
zh-cn/application-dev/reference/apis/js-apis-osAccount.md
zh-cn/application-dev/reference/apis/js-apis-osAccount.md
+116
-33
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-osAccount.md
浏览文件 @
86e65fa2
...
@@ -4243,7 +4243,7 @@ cancelAuth(contextID: Uint8Array): void;
...
@@ -4243,7 +4243,7 @@ cancelAuth(contextID: Uint8Array): void;
## PINAuth<sup>8+</sup>
## PINAuth<sup>8+</sup>
P
in码认证功能
基类。
P
IN码认证
基类。
**系统接口:**
此接口为系统接口。
**系统接口:**
此接口为系统接口。
...
@@ -4251,7 +4251,7 @@ Pin码认证功能基类。
...
@@ -4251,7 +4251,7 @@ Pin码认证功能基类。
constructor()
constructor()
创建P
in
码认证的实例。
创建P
IN
码认证的实例。
**系统接口:**
此接口为系统接口。
**系统接口:**
此接口为系统接口。
...
@@ -4280,17 +4280,12 @@ registerInputer(inputer: IInputer): void;
...
@@ -4280,17 +4280,12 @@ registerInputer(inputer: IInputer): void;
| ----------| ----------------------- | --- | -------------------------- |
| ----------| ----------------------- | --- | -------------------------- |
| inputer |
[
IInputer
](
#iinputer8
)
| 是 | PIN码输入器,用于获取PIN码。 |
| inputer |
[
IInputer
](
#iinputer8
)
| 是 | PIN码输入器,用于获取PIN码。 |
**返回值:**
| 类型 | 说明 |
| :------ | :-------------------------------------------- |
| boolean | 返回布尔值,true表示注册成功,false表示注册失败。 |
**错误码:**
**错误码:**
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| -------- | --------------------------- |
| -------- | --------------------------- |
| 12300001 | System service exception. |
| 12300001 | System service exception. |
| 12300102 | Invalid inputer. |
| 12300103 | Inputer already registered. |
| 12300103 | Inputer already registered. |
**示例:**
**示例:**
...
@@ -4299,8 +4294,8 @@ registerInputer(inputer: IInputer): void;
...
@@ -4299,8 +4294,8 @@ registerInputer(inputer: IInputer): void;
let
password
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
]);
let
password
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
]);
try
{
try
{
let
result
=
pinAuth
.
registerInputer
({
let
result
=
pinAuth
.
registerInputer
({
onGetData
:
(
pin
SubType
,
callback
)
=>
{
onGetData
:
(
auth
SubType
,
callback
)
=>
{
callback
.
onSetData
(
pin
SubType
,
password
);
callback
.
onSetData
(
auth
SubType
,
password
);
}
}
});
});
console
.
log
(
'
registerInputer result =
'
+
result
);
console
.
log
(
'
registerInputer result =
'
+
result
);
...
@@ -4327,6 +4322,91 @@ unregisterInputer(): void;
...
@@ -4327,6 +4322,91 @@ unregisterInputer(): void;
pinAuth
.
unregisterInputer
();
pinAuth
.
unregisterInputer
();
```
```
### InputerManager <sup>10+</sup>
凭据输入管理器。
### registerInputer<sup>10+</sup>
registerInputer(authType: AuthType, inputer: IInputer): void;
注册凭据输入器。
**系统接口:**
此接口为系统接口。
**系统能力:**
SystemCapability.Account.OsAccount
**需要权限:**
ohos.permission.ACCESS_USER_AUTH_INTERNAL 或 ohos.permission.MANAGE_USER_IDM
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------| ----------------------- | --- | -------------------------- |
| authType |
[
AuthType
](
#authtype8
)
| 是 | 认证类型。 |
| inputer |
[
IInputer
](
#iinputer8
)
| 是 | 凭据输入器,用于获取凭据。 |
**错误码:**
| 错误码ID | 错误信息 |
| -------- | --------------------------- |
| 12300001 | System service exception. |
| 12300102 | Invalid authType or inputer. |
| 12300103 | The credential inputer has been registered. |
| 12300106 | Unsupported authType. |
**示例:**
```
js
let
inputerMgr
=
new
account_osAccount
.
InputerManager
();
let
authType
=
account_osAccount
.
AuthType
.
DOMAIN
;
let
password
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
]);
try
{
InputerMgr
.
registerInputer
(
authType
,
{
onGetData
:
(
authSubType
,
callback
)
=>
{
callback
.
onSetData
(
authSubType
,
password
);
}
});
console
.
log
(
'
registerInputer success.
'
);
}
catch
(
e
)
{
console
.
log
(
'
registerInputer exception =
'
+
JSON
.
stringify
(
e
));
}
```
### unregisterInputer<sup>10+</sup>
unregisterInputer(authType: AuthType): void;
解注册凭据输入器。
**系统接口:**
此接口为系统接口。
**系统能力:**
SystemCapability.Account.OsAccount
**需要权限:**
ohos.permission.ACCESS_USER_AUTH_INTERNAL 或 ohos.permission.MANAGE_USER_IDM
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------| ----------------------- | --- | -------------------------- |
| authType |
[
AuthType
](
#authtype8
)
| 是 | 认证类型。 |
**错误码:**
| 错误码ID | 错误信息 |
| -------- | --------------------------- |
| 12300002 | Invalid authType. |
**示例:**
```
js
let
inputerMgr
=
new
account_osAccount
.
InputerManager
();
let
authType
=
account_osAccount
.
AuthType
.
DOMAIN
;
try
{
inputerMgr
.
unregisterInputer
(
authType
);
console
.
log
(
'
unregisterInputer success.
'
);
}
catch
(
err
)
{
console
.
log
(
"
unregisterInputer err:
"
+
JSON
.
stringify
(
err
));
}
```
## UserIdentityManager<sup>8+</sup>
## UserIdentityManager<sup>8+</sup>
获取用户身份管理类。
获取用户身份管理类。
...
@@ -4456,8 +4536,8 @@ addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
...
@@ -4456,8 +4536,8 @@ addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
let
password
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
,
0
]);
let
password
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
,
0
]);
let
pinAuth
=
new
account_osAccount
.
PINAuth
();
let
pinAuth
=
new
account_osAccount
.
PINAuth
();
pinAuth
.
registerInputer
({
pinAuth
.
registerInputer
({
onGetData
:
(
pin
SubType
,
callback
)
=>
{
onGetData
:
(
auth
SubType
,
callback
)
=>
{
callback
.
onSetData
(
pin
SubType
,
password
);
callback
.
onSetData
(
auth
SubType
,
password
);
}
}
});
});
let
credentialInfo
=
{
let
credentialInfo
=
{
...
@@ -4470,12 +4550,12 @@ addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
...
@@ -4470,12 +4550,12 @@ addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
try
{
try
{
userIDM
.
addCredential
(
credentialInfo
,
{
userIDM
.
addCredential
(
credentialInfo
,
{
onResult
:
(
result
,
extraInfo
)
=>
{
onResult
:
(
result
,
extraInfo
)
=>
{
console
.
log
(
'
update
Credential result =
'
+
result
);
console
.
log
(
'
add
Credential result =
'
+
result
);
console
.
log
(
'
update
Credential extraInfo =
'
+
extraInfo
);
console
.
log
(
'
add
Credential extraInfo =
'
+
extraInfo
);
}
}
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
update
Credential exception =
'
+
JSON
.
stringify
(
e
));
console
.
log
(
'
add
Credential exception =
'
+
JSON
.
stringify
(
e
));
}
}
});
});
```
```
...
@@ -4520,8 +4600,8 @@ updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
...
@@ -4520,8 +4600,8 @@ updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
token
:
null
token
:
null
};
};
pinAuth
.
registerInputer
({
pinAuth
.
registerInputer
({
onGetData
:
(
pin
SubType
,
callback
)
=>
{
onGetData
:
(
auth
SubType
,
callback
)
=>
{
callback
.
onSetData
(
pin
SubType
,
password
);
callback
.
onSetData
(
auth
SubType
,
password
);
}
}
});
});
userIDM
.
openSession
((
err
,
challenge
)
=>
{
userIDM
.
openSession
((
err
,
challenge
)
=>
{
...
@@ -4820,7 +4900,7 @@ getAuthInfo(authType?: AuthType): Promise<Array<EnrolledCredInfo>>;
...
@@ -4820,7 +4900,7 @@ getAuthInfo(authType?: AuthType): Promise<Array<EnrolledCredInfo>>;
### onSetData<sup>8+</sup>
### onSetData<sup>8+</sup>
onSetData: (
pin
SubType: AuthSubType, data: Uint8Array) => void;
onSetData: (
auth
SubType: AuthSubType, data: Uint8Array) => void;
**系统接口:**
此接口为系统接口。
**系统接口:**
此接口为系统接口。
...
@@ -4832,7 +4912,7 @@ onSetData: (pinSubType: AuthSubType, data: Uint8Array) => void;
...
@@ -4832,7 +4912,7 @@ onSetData: (pinSubType: AuthSubType, data: Uint8Array) => void;
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ---------------------------------------- | ---- | ----------------------------------------------- |
| ---------- | ---------------------------------------- | ---- | ----------------------------------------------- |
|
pin
SubType |
[
AuthSubType
](
#authsubtype8
)
| 是 | 用于认证的凭据子类型。 |
|
auth
SubType |
[
AuthSubType
](
#authsubtype8
)
| 是 | 用于认证的凭据子类型。 |
| data | Uint8Array | 是 | 要设置的数据是凭据,用来在认证、添加、修改凭据操作。 |
| data | Uint8Array | 是 | 要设置的数据是凭据,用来在认证、添加、修改凭据操作。 |
**示例:**
**示例:**
...
@@ -4840,11 +4920,11 @@ onSetData: (pinSubType: AuthSubType, data: Uint8Array) => void;
...
@@ -4840,11 +4920,11 @@ onSetData: (pinSubType: AuthSubType, data: Uint8Array) => void;
let
password
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
,
0
]);
let
password
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
,
0
]);
let
passwordNumber
=
new
Uint8Array
([
1
,
2
,
3
,
4
]);
let
passwordNumber
=
new
Uint8Array
([
1
,
2
,
3
,
4
]);
let
inputer
=
{
let
inputer
=
{
onGetData
:
(
pin
SubType
,
callback
)
=>
{
onGetData
:
(
auth
SubType
,
callback
)
=>
{
if
(
pin
SubType
==
account_osAccount
.
AuthSubType
.
PIN_NUMBER
)
{
if
(
auth
SubType
==
account_osAccount
.
AuthSubType
.
PIN_NUMBER
)
{
callback
.
onSetData
(
pin
SubType
,
passwordNumber
);
callback
.
onSetData
(
auth
SubType
,
passwordNumber
);
}
else
{
}
else
{
callback
.
onSetData
(
pin
SubType
,
password
);
callback
.
onSetData
(
auth
SubType
,
password
);
}
}
}
}
};
};
...
@@ -4852,13 +4932,13 @@ onSetData: (pinSubType: AuthSubType, data: Uint8Array) => void;
...
@@ -4852,13 +4932,13 @@ onSetData: (pinSubType: AuthSubType, data: Uint8Array) => void;
## IInputer<sup>8+</sup>
## IInputer<sup>8+</sup>
密码输入框
回调。
凭据输入器
回调。
**系统接口:**
此接口为系统接口。
**系统接口:**
此接口为系统接口。
### onGetData<sup>8+</sup>
### onGetData<sup>8+</sup>
onGetData: (
pin
SubType: AuthSubType, callback: IInputData) => void;
onGetData: (
auth
SubType: AuthSubType, callback: IInputData) => void;
通知获取数据。
通知获取数据。
...
@@ -4877,11 +4957,11 @@ onGetData: (pinSubType: AuthSubType, callback: IInputData) => void;
...
@@ -4877,11 +4957,11 @@ onGetData: (pinSubType: AuthSubType, callback: IInputData) => void;
let
password
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
,
0
]);
let
password
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
,
0
]);
let
passwordNumber
=
new
Uint8Array
([
1
,
2
,
3
,
4
]);
let
passwordNumber
=
new
Uint8Array
([
1
,
2
,
3
,
4
]);
let
inputer
=
{
let
inputer
=
{
onGetData
:
(
pin
SubType
,
callback
)
=>
{
onGetData
:
(
auth
SubType
,
callback
)
=>
{
if
(
pin
SubType
==
account_osAccount
.
AuthSubType
.
PIN_NUMBER
)
{
if
(
auth
SubType
==
account_osAccount
.
AuthSubType
.
PIN_NUMBER
)
{
callback
.
onSetData
(
pin
SubType
,
passwordNumber
);
callback
.
onSetData
(
auth
SubType
,
passwordNumber
);
}
else
{
}
else
{
callback
.
onSetData
(
pin
SubType
,
password
);
callback
.
onSetData
(
auth
SubType
,
password
);
}
}
}
}
};
};
...
@@ -5155,8 +5235,10 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
...
@@ -5155,8 +5235,10 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
| 名称 | 值 | 说明 |
| 名称 | 值 | 说明 |
| ----- | ----- | ---------------- |
| ----- | ----- | ---------------- |
| PIN | 1 | 指示PIN认证类型。 |
| PIN | 1 | 表示PIN认证类型。 |
| FACE | 2 | 指示脸部认证类型。|
| FACE | 2 | 表示脸部认证类型。|
| FINGERPRINT
<sup>
10+
</sup>
| 4 | 表示指纹认证类型。 |
| DOMAIN
<sup>
10+
</sup>
| 1024 | 表示域认证类型。|
## AuthSubType<sup>8+</sup>
## AuthSubType<sup>8+</sup>
...
@@ -5171,8 +5253,9 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
...
@@ -5171,8 +5253,9 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
| PIN_SIX | 10000 | 表示6位凭证。 |
| PIN_SIX | 10000 | 表示6位凭证。 |
| PIN_NUMBER | 10001 | 表示自定义数字凭证。 |
| PIN_NUMBER | 10001 | 表示自定义数字凭证。 |
| PIN_MIXED | 10002 | 表示自定义混合凭据。 |
| PIN_MIXED | 10002 | 表示自定义混合凭据。 |
| FACE_2D | 20000 | 指示2D 人脸凭证。 |
| FACE_2D | 20000 | 表示2D 人脸凭证。 |
| FACE_3D | 20001 | 指示3D 人脸凭证。 |
| FACE_3D | 20001 | 表示3D 人脸凭证。 |
| DOMAIN_MIXED
<sup>
10+
</sup>
| 10240001 | 表示域认证混合凭证。 |
## AuthTrustLevel<sup>8+</sup>
## AuthTrustLevel<sup>8+</sup>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录