Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
0a4ac2c2
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看板
未验证
提交
0a4ac2c2
编写于
5月 27, 2023
作者:
O
openharmony_ci
提交者:
Gitee
5月 27, 2023
浏览文件
操作
浏览文件
下载
差异文件
!18188 UserIAM V1_1 HDI 检视
Merge pull request !18188 from Tianshi Liu/tianshi_dev
上级
940bb5b9
7e47a55d
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
336 addition
and
174 deletion
+336
-174
zh-cn/device-dev/driver/driver-peripherals-face_auth-des.md
zh-cn/device-dev/driver/driver-peripherals-face_auth-des.md
+90
-39
zh-cn/device-dev/driver/driver-peripherals-fingerprint_auth-des.md
...ice-dev/driver/driver-peripherals-fingerprint_auth-des.md
+79
-38
zh-cn/device-dev/driver/driver-peripherals-pinauth-des.md
zh-cn/device-dev/driver/driver-peripherals-pinauth-des.md
+97
-53
zh-cn/device-dev/driver/driver-peripherals-user-auth-des.md
zh-cn/device-dev/driver/driver-peripherals-user-auth-des.md
+70
-44
未找到文件。
zh-cn/device-dev/driver/driver-peripherals-face_auth-des.md
浏览文件 @
0a4ac2c2
...
...
@@ -90,7 +90,7 @@ Face_auth驱动的主要工作是为上层用户认证框架和Face_auth服务
### 接口说明
注:以下接口列举的为IDL接口描述生成的对应C++语言函数接口,接口声明见idl文件(/drivers/interface/face_auth
/v1_0/
)。
注:以下接口列举的为IDL接口描述生成的对应C++语言函数接口,接口声明见idl文件(/drivers/interface/face_auth)。
在本文中,人脸凭据的录入、认证、识别和删除相关的HDI接口如表1所示,表2中的回调函数分别用于人脸执行器返回操作结果给框架和返回操作过程中的提示信息给上层应用。
...
...
@@ -98,23 +98,29 @@ Face_auth驱动的主要工作是为上层用户认证框架和Face_auth服务
| 接口名称 | 功能介绍 |
| ----------------------------------- | ---------------------------------- |
| GetExecutorList(std::vector
<sptr
<
IExecutor
>
>& executorList) | 获取执行器列表。 |
| GetExecutorList(std::vector
\<
sptr
\<
V1_0::IExecutor>>& executorList) | 获取V1_0版本执行器列表。 |
| GetExecutorListV1_1(std::vector
\<
sptr
\<
V1_1::IExecutor>>& executorList) | 获取V1_1版本执行器列表。 |
| GetExecutorInfo(ExecutorInfo& info) | 获取执行器信息,包括执行器类型、执行器角色、认证类型、安全等级、执行器公钥等信息,用于向用户认证框架注册执行器。 |
| GetTemplateInfo(uint64_t templateId, TemplateInfo& info) | 获取指定人脸模板ID的模板信息。 |
| OnRegisterFinish(const std::vector
<uint64_t>
& templateIdList,
<br/>
const std::vector
<uint8_t>
& frameworkPublicKey, const std::vector
<uint8_t>
& extraInfo) | 执行器注册成功后,获取用户认证框架的公钥信息;获取用户认证框架的人脸模板列表用于对账。 |
| Enroll(uint64_t scheduleId, const std::vector
<uint8_t>
& extraInfo,
<br/>
const sptr
<IExecutorCallback>
& callbackObj) | 录入人脸模板。 |
| Authenticate(uint64_t scheduleId, const std::vector
<uint64_t>
& templateIdList,
<br/>
const std::vector
<uint8_t>
& extraInfo, const sptr
<IExecutorCallback>
& callbackObj) | 认证人脸模板。 |
| Identify(uint64_t scheduleId, const std::vector
<uint8_t>
& extraInfo,
<br/>
const sptr
<IExecutorCallback>
& callbackObj) | 识别人脸模板。 |
| Delete(const std::vector
<uint64_t>
& templateIdList) | 删除人脸模板。 |
| OnRegisterFinish(const std::vector
\<
uint64_t>& templateIdList,
<br/>
const std::vector
\<
uint8_t>& frameworkPublicKey, const std::vector
\
<
uint8_t>& extraInfo) | 执行器注册成功后,获取用户认证框架的公钥信息;获取用户认证框架的人脸模板列表用于对账。 |
| Enroll(uint64_t scheduleId, const std::vector
\<
uint8_t>& extraInfo,
<br/>
const sptr
\
<
IExecutorCallback>& callbackObj) | 录入人脸模板。 |
| Authenticate(uint64_t scheduleId, const std::vector
\<
uint64_t>& templateIdList,
<br/>
const std::vector
\<
uint8_t>& extraInfo, const sptr
\
<
IExecutorCallback>& callbackObj) | 认证人脸模板。 |
| Identify(uint64_t scheduleId, const std::vector
\<
uint8_t>& extraInfo,
<br/>
const sptr
\
<
IExecutorCallback>& callbackObj) | 识别人脸模板。 |
| Delete(const std::vector
\
<
uint64_t>& templateIdList) | 删除人脸模板。 |
| Cancel(uint64_t scheduleId) | 通过scheduleId取消指定录入、认证、识别操作。 |
| SendCommand(int32_t commandId, const std::vector
<uint8_t>
& extraInfo,
<br/>
const sptr
<IExecutorCallback>
& callbackObj) | 人脸认证服务向Face_auth驱动传递参数的通用接口。 |
| SendCommand(int32_t commandId, const std::vector
\<
uint8_t>& extraInfo,
<br/>
const sptr
\<
IExecutorCallback>& callbackObj) | 人脸认证服务向Face_auth驱动传递参数的通用接口。 |
| SetBufferProducer(const sptr
\<
BufferProducerSequenceable> &bufferProducer) | 设置预览流缓冲区。 |
| GetProperty(const std::vector
\<
uint64_t>& templateIdList,
<br/>
const std::vector
\<
GetPropertyType>& propertyTypes, Property& property) | 获取执行器属性信息。 |
| SetCachedTemplates(const std::vector
\<
uint64_t> &templateIdList) | 设置需缓存模板列表。 |
| RegisterSaCommandCallback(const sptr
\<
ISaCommandCallback> &callbackObj) | 注册SA命令回调。 |
**表2**
回调函数介绍
| 接口名称 | 功能介绍 |
| ------------------------------------------------------------ | ------------------------ |
| IExecutorCallback::OnResult(int32_t code, const std::vector
<uint8_t>
& extraInfo) | 返回操作的最终结果。 |
| IExecutorCallback::OnTip(int32_t code, const std::vector
<uint8_t>
& extraInfo) | 返回操作的过程交互信息。 |
| IExecutorCallback::OnResult(int32_t code, const std::vector
\<
uint8_t>& extraInfo) | 返回操作的最终结果。 |
| IExecutorCallback::OnTip(int32_t code, const std::vector
\<
uint8_t>& extraInfo) | 返回操作的过程交互信息。 |
| ISaCommandCallback::OnSaCommands(const std::vector
\<
SaCommand>& commands) | 发送命令列表。 |
### 开发步骤
...
...
@@ -238,7 +244,7 @@ Face_auth驱动的主要工作是为上层用户认证框架和Face_auth服务
```
c++
// 执行器实现类
class
ExecutorImpl
:
public
IExecutor
{
class
ExecutorImpl
:
public
V1_1
::
IExecutor
{
public:
ExecutorImpl
(
struct
ExecutorInfo
executorInfo
);
virtual
~
ExecutorImpl
()
{}
...
...
@@ -263,7 +269,7 @@ Face_auth驱动的主要工作是为上层用户认证框架和Face_auth服务
}
// 获取执行器列表实现,创建执行器
int32_t
GetExecutorList
(
std
::
vector
<
sptr
<
IExecutor
>>&
executorList
)
int32_t
GetExecutorList
V1_1
(
std
::
vector
<
sptr
<
V1_1
::
IExecutor
>>&
executorList
)
{
IAM_LOGI
(
"interface mock start"
);
executorList
.
clear
();
...
...
@@ -281,10 +287,21 @@ Face_auth驱动的主要工作是为上层用户认证框架和Face_auth服务
IAM_LOGE
(
"executor is nullptr"
);
return
HDF_FAILURE
;
}
executorList
.
push_back
(
sptr
<
IExecutor
>
(
executor
));
executorList
.
push_back
(
sptr
<
V1_1
::
IExecutor
>
(
executor
));
IAM_LOGI
(
"interface mock success"
);
return
HDF_SUCCESS
;
}
// 获取V1_0执行器列表实现,使用V1_1版本执行器实现V1_0版本执行器的功能
int32_t
GetExecutorList
(
std
::
vector
<
sptr
<
V1_0
::
IExecutor
>>
&
executorList
)
{
std
::
vector
<
sptr
<
V1_1
::
IExecutor
>>
executorListV1_1
;
int32_t
result
=
GetExecutorListV1_1
(
executorListV1_1
);
for
(
auto
&
executor
:
executorListV1_1
)
{
executorList
.
push_back
(
executor
);
}
return
result
;
}
```
3.
实现执行器每个功能接口,详细代码参见
[
executor_impl.cpp
](
https://gitee.com/openharmony/drivers_peripheral/blob/master/face_auth/hdi_service/src/executor_impl.cpp
)
文件。
...
...
@@ -422,6 +439,40 @@ Face_auth驱动的主要工作是为上层用户认证框架和Face_auth服务
}
return
HDF_SUCCESS
;
}
// 实现设置预览流缓冲区接口
int32_t
ExecutorImpl
::
SetBufferProducer
(
const
sptr
<
BufferProducerSequenceable
>
&
bufferProducer
)
{
IAM_LOGI
(
"interface mock start set buffer producer %{public}s"
,
UserIam
::
Common
::
GetPointerNullStateString
(
bufferProducer
.
GetRefPtr
()).
c_str
());
return
HDF_SUCCESS
;
}
// 实现获取执行器属性接口
int32_t
ExecutorImpl
::
GetProperty
(
const
std
::
vector
<
uint64_t
>
&
templateIdList
,
const
std
::
vector
<
GetPropertyType
>
&
propertyTypes
,
Property
&
property
)
{
IAM_LOGI
(
"interface mock start"
);
property
=
{};
IAM_LOGI
(
"get property success"
);
return
HDF_SUCCESS
;
}
// 实现设置需缓存模板列表接口
int32_t
ExecutorImpl
::
SetCachedTemplates
(
const
std
::
vector
<
uint64_t
>
&
templateIdList
)
{
IAM_LOGI
(
"interface mock start"
);
IAM_LOGI
(
"set cached templates success"
);
return
HDF_SUCCESS
;
}
// 实现注册SA命令回调接口
int32_t
ExecutorImpl
::
RegisterSaCommandCallback
(
const
sptr
<
ISaCommandCallback
>
&
callbackObj
)
{
IAM_LOGI
(
"interface mock start"
);
IAM_LOGI
(
"register sa command callback success"
);
return
HDF_SUCCESS
;
}
```
4.
用户身份认证框架支持多driver,当增加driver或者修改driver信息,需要修改如下文件中serviceName2Config。
...
...
zh-cn/device-dev/driver/driver-peripherals-fingerprint_auth-des.md
浏览文件 @
0a4ac2c2
...
...
@@ -95,23 +95,27 @@ Fingerprint_auth驱动的主要工作是为上层用户认证框架和Fingerprin
| 接口名称 | 功能介绍 |
| -------------------------------- | ----------------------------------- |
| GetExecutorList(std::vector
<sptr
<
IExecutor
>
>& executorList) | 获取执行器列表。 |
| GetExecutorList(std::vector
\<
sptr
\<
V1_0::IExecutor>>& executorList) | 获取V1_0版本执行器列表。 |
| GetExecutorListV1_1(std::vector
\<
sptr
\<
V1_1::IExecutor>>& executorList) | 获取V1_1版本执行器列表。 |
| GetExecutorInfo(ExecutorInfo& info) | 获取执行器信息,包括执行器类型、执行器角色、认证类型、安全等级、执行器公钥等信息,用于向用户认证框架注册执行器。 |
| GetTemplateInfo(uint64_t templateId, TemplateInfo& info) | 获取指定模板ID的模板信息。 |
| OnRegisterFinish(const std::vector
<uint64_t>
& templateIdList,
<br/>
const std::vector
<uint8_t>
& frameworkPublicKey, const std::vector
<uint8_t>
& extraInfo) | 执行器注册成功后,获取用户认证框架的公钥信息;获取用户认证框架的模板列表用于对账。 |
| Enroll(uint64_t scheduleId, const std::vector
<uint8_t>
& extraInfo,
<br/>
const sptr
<IExecutorCallback>
& callbackObj) | 录入指纹模板。 |
| Authenticate(uint64_t scheduleId, const std::vector
<uint64_t>
& templateIdList,
<br/>
const std::vector
<uint8_t>
& extraInfo, const sptr
<IExecutorCallback>
& callbackObj) | 认证指纹模板。 |
| Identify(uint64_t scheduleId, const std::vector
<uint8_t>
& extraInfo,
<br/>
const sptr
<IExecutorCallback>
& callbackObj) | 识别指纹模板。 |
| Delete(const std::vector
<uint64_t>
& templateIdList) | 删除指纹模板。 |
| OnRegisterFinish(const std::vector
\<
uint64_t>& templateIdList,
<br/>
const std::vector
\<
uint8_t>& frameworkPublicKey, const std::vector
\
<
uint8_t>& extraInfo) | 执行器注册成功后,获取用户认证框架的公钥信息;获取用户认证框架的模板列表用于对账。 |
| Enroll(uint64_t scheduleId, const std::vector
\<
uint8_t>& extraInfo,
<br/>
const sptr
\
<
IExecutorCallback>& callbackObj) | 录入指纹模板。 |
| Authenticate(uint64_t scheduleId, const std::vector
\<
uint64_t>& templateIdList,
<br/>
const std::vector
\<
uint8_t>& extraInfo, const sptr
\
<
IExecutorCallback>& callbackObj) | 认证指纹模板。 |
| Identify(uint64_t scheduleId, const std::vector
\<
uint8_t>& extraInfo,
<br/>
const sptr
\
<
IExecutorCallback>& callbackObj) | 识别指纹模板。 |
| Delete(const std::vector
\
<
uint64_t>& templateIdList) | 删除指纹模板。 |
| Cancel(uint64_t scheduleId) | 通过scheduleId取消指定录入、认证、识别操作。 |
| SendCommand(int32_t commandId, const std::vector
<uint8_t>
& extraInfo,
<br/>
const sptr
<IExecutorCallback>
& callbackObj) | 指纹认证服务向Fingerprint_auth驱动传递参数的通用接口。 |
| SendCommand(int32_t commandId, const std::vector
\<
uint8_t>& extraInfo,
<br/>
const sptr
\<
IExecutorCallback>& callbackObj) | 指纹认证服务向Fingerprint_auth驱动传递参数的通用接口。 |
| GetProperty(const std::vector
\<
uint64_t>& templateIdList,
<br/>
const std::vector
\<
GetPropertyType>& propertyTypes, Property& property) | 获取执行器属性信息。 |
| SetCachedTemplates(const std::vector
\<
uint64_t> &templateIdList) | 设置需缓存模板列表。 |
| RegisterSaCommandCallback(const sptr
\<
ISaCommandCallback> &callbackObj) | 注册SA命令回调。 |
**表2**
回调函数介绍
| 接口名称 | 功能介绍 |
| ------------------------------------------------------------ | ------------------------ |
| IExecutorCallback::OnResult(int32_t code, const std::vector
<uint8_t>
& extraInfo) | 返回操作的最终结果。 |
| IExecutorCallback::OnTip(int32_t code, const std::vector
<uint8_t>
& extraInfo) | 返回操作的过程交互信息。 |
| IExecutorCallback::OnResult(int32_t code, const std::vector
\<
uint8_t>& extraInfo) | 返回操作的最终结果。 |
| IExecutorCallback::OnTip(int32_t code, const std::vector
\<
uint8_t>& extraInfo) | 返回操作的过程交互信息。 |
| ISaCommandCallback::OnSaCommands(const std::vector
\<
SaCommand>& commands) | 发送命令列表。 |
### 开发步骤
...
...
@@ -260,7 +264,7 @@ Fingerprint_auth驱动的主要工作是为上层用户认证框架和Fingerprin
}
// 获取执行器列表实现,创建执行器
int32_t
GetExecutorList
(
std
::
vector
<
sptr
<
IExecutor
>>&
executorList
)
int32_t
GetExecutorList
V1_1
(
std
::
vector
<
sptr
<
V1_1
::
IExecutor
>>&
executorList
)
{
IAM_LOGI
(
"interface mock start"
);
executorList
.
clear
();
...
...
@@ -278,10 +282,21 @@ Fingerprint_auth驱动的主要工作是为上层用户认证框架和Fingerprin
IAM_LOGE
(
"executor is nullptr"
);
return
HDF_FAILURE
;
}
executorList
.
push_back
(
sptr
<
IExecutor
>
(
executor
));
executorList
.
push_back
(
sptr
<
V1_1
::
IExecutor
>
(
executor
));
IAM_LOGI
(
"interface mock success"
);
return
HDF_SUCCESS
;
}
// 获取V1_0执行器列表实现,使用V1_1版本执行器实现V1_0版本执行器的功能
int32_t
GetExecutorList
(
std
::
vector
<
sptr
<
V1_0
::
IExecutor
>>
&
executorList
)
{
std
::
vector
<
sptr
<
V1_1
::
IExecutor
>>
executorListV1_1
;
int32_t
result
=
GetExecutorListV1_1
(
executorListV1_1
);
for
(
auto
&
executor
:
executorListV1_1
)
{
executorList
.
push_back
(
executor
);
}
return
result
;
}
```
3.
步骤1、2完成后基本实现了Fingerprint_auth驱动和Fingerprint_auth服务对接。接下来需实现执行器每个功能接口,来完成指纹认证基础能力。关键代码如下,详细代码请参见
[
executor_impl.cpp
](
https://gitee.com/openharmony/drivers_peripheral/blob/master/fingerprint_auth/hdi_service/src/executor_impl.cpp
)
文件。
...
...
@@ -419,6 +434,32 @@ Fingerprint_auth驱动的主要工作是为上层用户认证框架和Fingerprin
}
return
HDF_SUCCESS
;
}
// 实现获取执行器属性接口
int32_t
ExecutorImpl
::
GetProperty
(
const
std
::
vector
<
uint64_t
>
&
templateIdList
,
const
std
::
vector
<
GetPropertyType
>
&
propertyTypes
,
Property
&
property
)
{
IAM_LOGI
(
"interface mock start"
);
property
=
{};
IAM_LOGI
(
"get property success"
);
return
HDF_SUCCESS
;
}
// 实现设置需缓存模板列表接口
int32_t
ExecutorImpl
::
SetCachedTemplates
(
const
std
::
vector
<
uint64_t
>
&
templateIdList
)
{
IAM_LOGI
(
"interface mock start"
);
IAM_LOGI
(
"set cached templates success"
);
return
HDF_SUCCESS
;
}
// 实现注册SA命令回调接口
int32_t
ExecutorImpl
::
RegisterSaCommandCallback
(
const
sptr
<
ISaCommandCallback
>
&
callbackObj
)
{
IAM_LOGI
(
"interface mock start"
);
IAM_LOGI
(
"register sa command callback success"
);
return
HDF_SUCCESS
;
}
```
4.
用户身份认证框架支持多driver,当增加driver或者修改driver信息,需要修改如下文件中serviceName2Config。
...
...
zh-cn/device-dev/driver/driver-peripherals-pinauth-des.md
浏览文件 @
0a4ac2c2
...
...
@@ -81,30 +81,32 @@ Pin_auth驱动的主要工作是为上层用户认证框架和Pin_auth服务提
### 接口说明
注:以下接口列举的为IDL接口描述生成的对应C++语言函数接口,接口声明见idl文件(/drivers/interface/pin_auth
/v1_0/
)。
注:以下接口列举的为IDL接口描述生成的对应C++语言函数接口,接口声明见idl文件(/drivers/interface/pin_auth)。
在本文中,口令凭据的录入、认证和删除相关的HDI接口如表1所示,表2中的回调函数分别用于口令执行器返回操作结果给框架和获取用户输入的口令信息。
**表1**
接口功能介绍
| 接口名称 | 功能介绍 |
| ------------------------------- | ------------------------------------------- |
| GetExecutorList(std::vector
<sptr
<
IExecutor
>
>& executorList) | 获取
执行器列表。 |
| GetExecutor
Info(ExecutorInfo& info) | 获取执行器信息
。 |
| GetExecutorList(std::vector
\<
sptr
\<
V1_0::IExecutor>>& executorList) | 获取V1_0
执行器列表。 |
| GetExecutor
ListV1_1(std::vector
\<
sptr
\<
V1_1::IExecutor>>& executorList) | 获取V1_1版本执行器列表
。 |
| GetTemplateInfo(uint64_t templateId, TemplateInfo& info) | 获取指定templateId的模板信息。 |
| OnRegisterFinish(const std::vector
<uint64_t>
& templateIdList,
<br/>
const std::vector
<uint8_t>
& frameworkPublicKey,
<br/>
const std::vector
<uint8_t>
& extraInfo) | 执行器注册成功后,获取用户认证框架的公钥信息;获取用户认证框架的template 列表用于对账。 |
| OnSetData(uint64_t scheduleId, uint64_t authSubType,
<br/>
const std::vector
<uint8_t>
&data) | 回调函数,返回用户录入的口令子类型和录入的口令脱敏数据。 |
| Enroll(uint64_t scheduleId, const std::vector
<uint8_t>
& extraInfo,
<br/>
const sptr
<IExecutorCallback>
& callbackObj) | 录入pin码。 |
| Authenticate(uint64_t scheduleId, uint64_t templateId, const std::vector
<uint8_t>
& extraInfo, const sptr
<IExecutorCallback>
& callbackObj) | pin码认证。 |
| OnRegisterFinish(const std::vector
\<
uint64_t>& templateIdList,
<br/>
const std::vector
\<
uint8_t>& frameworkPublicKey,
<br/>
const std::vector
\
<
uint8_t>& extraInfo) | 执行器注册成功后,获取用户认证框架的公钥信息;获取用户认证框架的template 列表用于对账。 |
| OnSetData(uint64_t scheduleId, uint64_t authSubType,
<br/>
const std::vector
\
<
uint8_t> &data) | 回调函数,返回用户录入的口令子类型和录入的口令脱敏数据。 |
| Enroll(uint64_t scheduleId, const std::vector
\<
uint8_t>& extraInfo,
<br/>
const sptr
\
<
IExecutorCallback>& callbackObj) | 录入pin码。 |
| Authenticate(uint64_t scheduleId, uint64_t templateId, const std::vector
\<
uint8_t>& extraInfo, const sptr
\
<
IExecutorCallback>& callbackObj) | pin码认证。 |
| Delete(uint64_t templateId) | 删除pin码模板。 |
| Cancel(uint64_t scheduleId) | 通过scheduleId取消指定操作。 |
| SendCommand(int32_t commandId, const std::vector
<uint8_t>
& extraInfo,
<br/>
const sptr
<IExecutorCallback>
& callbackObj) | 预留接口。 |
| SendCommand(int32_t commandId, const std::vector
\<
uint8_t>& extraInfo,
<br/>
const sptr
\<
IExecutorCallback>& callbackObj) | 预留接口。 |
| GetProperty(const std::vector
\<
uint64_t>& templateIdList,
<br/>
const std::vector
\<
GetPropertyType>& propertyTypes, Property& property) | 获取执行器属性信息。 |
**表2**
回调函数介绍
| 接口名称 | 功能介绍 |
| ------------------------------------------------------------ | -------------------- |
| IExecutorCallback::OnResult(int32_t code, const std::vector
<uint8_t>
& extraInfo) | 返回操作的最终结果。 |
| IExecutorCallback::OnGetData(uint64_t scheduleId, const std::vector
<uint8_t>
& salt,
<br/>
uint64_t authSubType)| 返回获取pin码数据信息。 |
| IExecutorCallback::OnResult(int32_t code, const std::vector
\
<
uint8_t>& extraInfo) | 返回操作的最终结果。 |
| IExecutorCallback::OnGetData(uint64_t scheduleId, const std::vector
\
<
uint8_t>& salt,
<br/>
uint64_t authSubType)| 返回获取pin码数据信息。 |
### 开发步骤
...
...
@@ -237,7 +239,7 @@ Pin_auth驱动的主要工作是为上层用户认证框架和Pin_auth服务提
```
c++
// 执行器实现类
class
ExecutorImpl
:
public
IExecutor
,
public
NoCopyable
{
class
ExecutorImpl
:
public
V1_1
::
IExecutor
,
public
NoCopyable
{
public:
explicit
ExecutorImpl
(
std
::
shared_ptr
<
OHOS
::
UserIAM
::
PinAuth
::
PinAuth
>
pinHdi
);
virtual
~
ExecutorImpl
()
{}
...
...
@@ -254,6 +256,8 @@ Pin_auth驱动的主要工作是为上层用户认证框架和Pin_auth服务提
int32_t
Cancel
(
uint64_t
scheduleId
)
override
;
int32_t
SendCommand
(
int32_t
commandId
,
const
std
::
vector
<
uint8_t
>
&
extraInfo
,
const
sptr
<
IExecutorCallback
>
&
callbackObj
)
override
;
int32_t
GetProperty
(
const
std
::
vector
<
uint64_t
>
&
templateIdList
,
const
std
::
vector
<
GetPropertyType
>
&
propertyTypes
,
Property
&
property
)
override
;
private:
class
ScheduleMap
{
...
...
@@ -283,8 +287,8 @@ Pin_auth驱动的主要工作是为上层用户认证框架和Pin_auth服务提
ScheduleMap
scheduleMap_
;
};
// 获取执行器列表实现,创建执行器(仅作示例)
int32_t
PinAuthInterfaceService
::
GetExecutorList
(
std
::
vector
<
sptr
<
IExecutor
>>
&
executorList
)
// 获取
V1_1
执行器列表实现,创建执行器(仅作示例)
int32_t
PinAuthInterfaceService
::
GetExecutorList
V1_1
(
std
::
vector
<
sptr
<
V1_1
::
IExecutor
>>
&
executorList
)
{
IAM_LOGI
(
"start"
);
std
::
shared_ptr
<
OHOS
::
UserIAM
::
PinAuth
::
PinAuth
>
pinHdi
=
...
...
@@ -302,6 +306,17 @@ Pin_auth驱动的主要工作是为上层用户认证框架和Pin_auth服务提
IAM_LOGI
(
"end"
);
return
HDF_SUCCESS
;
}
// 获取V1_0执行器列表实现,使用V1_1版本执行器实现V1_0版本执行器的功能
int32_t
PinAuthInterfaceService
::
GetExecutorList
(
std
::
vector
<
sptr
<
V1_0
::
IExecutor
>>
&
executorList
)
{
std
::
vector
<
sptr
<
V1_1
::
IExecutor
>>
executorListV1_1
;
int32_t
result
=
GetExecutorListV1_1
(
executorListV1_1
);
for
(
auto
&
executor
:
executorListV1_1
)
{
executorList
.
push_back
(
executor
);
}
return
result
;
}
```
...
...
@@ -541,6 +556,35 @@ Pin_auth驱动的主要工作是为上层用户认证框架和Pin_auth服务提
static_cast
<
void
>
(
callbackObj
);
return
HDF_SUCCESS
;
}
// 获取执行器属性信息接口
int32_t
ExecutorImpl
::
GetProperty
(
const
std
::
vector
<
uint64_t
>
&
templateIdList
,
const
std
::
vector
<
GetPropertyType
>
&
propertyTypes
,
Property
&
property
)
{
IAM_LOGI
(
"start"
);
if
(
pinHdi_
==
nullptr
)
{
IAM_LOGE
(
"pinHdi_ is nullptr"
);
return
HDF_FAILURE
;
}
if
(
templateIdList
.
size
()
!=
1
)
{
IAM_LOGE
(
"templateIdList size is not 1"
);
return
HDF_FAILURE
;
}
uint64_t
templateId
=
templateIdList
[
0
];
OHOS
::
UserIam
::
PinAuth
::
PinCredentialInfo
infoRet
=
{};
int32_t
result
=
pinHdi_
->
QueryPinInfo
(
templateId
,
infoRet
);
if
(
result
!=
SUCCESS
)
{
IAM_LOGE
(
"Get TemplateInfo failed, fail code : %{public}d"
,
result
);
return
HDF_FAILURE
;
}
property
.
authSubType
=
infoRet
.
subType
;
property
.
remainAttempts
=
infoRet
.
remainTimes
;
property
.
lockoutDuration
=
infoRet
.
freezingTime
;
return
HDF_SUCCESS
;
}
```
...
...
zh-cn/device-dev/driver/driver-peripherals-user-auth-des.md
浏览文件 @
0a4ac2c2
...
...
@@ -117,26 +117,30 @@ User_auth驱动的主要工作是为User_auth服务提供稳定的用户凭据
| 接口名称 | 功能介绍 |
| --------------------------- | --------------------------- |
| Init() | 初始化缓存信息。 |
| AddExecutor(const ExecutorRegisterInfo& info, uint64_t& index, std::vector
<uint8_t>
& publicKey,
<br/>
std::vector
<uint64_t>
& templateIds) | 添加认证执行器,获得此认证能力。 |
| AddExecutor(const ExecutorRegisterInfo& info, uint64_t& index, std::vector
\<
uint8_t>& publicKey,
<br/>
std::vector
\
<
uint64_t>& templateIds) | 添加认证执行器,获得此认证能力。 |
| DeleteExecutor(uint64_t index) | 根据索引值index删除认证执行器。 |
| OpenSession(int32_t userId, std::vector
<uint8_t>
& challenge) | 开启认证凭据管理Session。 |
| OpenSession(int32_t userId, std::vector
\
<
uint8_t>& challenge) | 开启认证凭据管理Session。 |
| CloseSession(int32_t userId) | 关闭认证凭据管理Session。 |
| BeginEnrollment(int32_t userId, const std::vector
<uint8_t>
& authToken, const EnrollParam& param,
<br/>
ScheduleInfo& info) | 发起用户的认证凭据的录入,当录入类型为PIN码且当前用户已录入PIN码的情况下会更新PIN码
。 |
| UpdateEnrollmentResult(int32_t userId, const std::vector
<uint8_t>
& scheduleResult, uint64_t& credentialId,
<br/>
CredentialInfo& oldInfo) | 更新录入结果,完成此次录入。 |
| BeginEnrollment(int32_t userId, const std::vector
\<
uint8_t>& authToken, const EnrollParam& param,
<br/>
ScheduleInfo& info) | 发起用户的认证凭据的录入,当录入类型为PIN码且当前用户已录入PIN码的情况下会更新PIN码(V1_0版本)
。 |
| UpdateEnrollmentResult(int32_t userId, const std::vector
\
<
uint8_t>& scheduleResult, uint64_t& credentialId,
<br/>
CredentialInfo& oldInfo) | 更新录入结果,完成此次录入。 |
| CancelEnrollment(int32_t userId) | 取消此次录入。 |
| DeleteCredential(int32_t userId, uint64_t credentialId, const std::vector
<uint8_t>
& authToken,
<br/>
CredentialInfo& info) | 根据credentialId删除凭据信息。 |
| DeleteUser(int32_t userId, const std::vector
<uint8_t>
& authToken,
<br/>
std::vector
<CredentialInfo>
& deletedInfos) | 删除PIN码即在用户认证框架中删除用户。 |
| EnforceDeleteUser(int32_t userId, std::vector
<CredentialInfo>
& deletedInfos) | 强制删除用户,当系统内此用户被删除时强制调用。 |
| GetCredential(int32_t userId, AuthType authType, std::vector
<CredentialInfo>
& infos) | 查询用户某种认证类型下的凭据信息。 |
| GetSecureInfo(int32_t userId, uint64_t& secureUid, std::vector
<EnrolledInfo>
& infos) | 查询用户的安全用户Id和每种认证类型的录入标记Id。 |
| BeginAuthentication(uint64_t contextId, const AuthSolution& param,
<br/>
std::vector
<ScheduleInfo>
& scheduleInfos) | 发起认证,生成认证方案和调度信息
。 |
| UpdateAuthenticationResult(uint64_t contextId, const std::vector
<uint8_t>
& scheduleResult,
<br/>
AuthResultInfo& info) | 更新认证结果,进行此次认证方案结果的评估。 |
| DeleteCredential(int32_t userId, uint64_t credentialId, const std::vector
\
<
uint8_t>& authToken,
<br/>
CredentialInfo& info) | 根据credentialId删除凭据信息。 |
| DeleteUser(int32_t userId, const std::vector
\<
uint8_t>& authToken,
<br/>
std::vector
\
<
CredentialInfo>& deletedInfos) | 删除PIN码即在用户认证框架中删除用户。 |
| EnforceDeleteUser(int32_t userId, std::vector
\
<
CredentialInfo>& deletedInfos) | 强制删除用户,当系统内此用户被删除时强制调用。 |
| GetCredential(int32_t userId, AuthType authType, std::vector
\
<
CredentialInfo>& infos) | 查询用户某种认证类型下的凭据信息。 |
| GetSecureInfo(int32_t userId, uint64_t& secureUid, std::vector
\
<
EnrolledInfo>& infos) | 查询用户的安全用户Id和每种认证类型的录入标记Id。 |
| BeginAuthentication(uint64_t contextId, const AuthSolution& param,
<br/>
std::vector
\<
ScheduleInfo>& scheduleInfos) | 发起认证,生成认证方案和调度信息(V1_0版本)
。 |
| UpdateAuthenticationResult(uint64_t contextId, const std::vector
\
<
uint8_t>& scheduleResult,
<br/>
AuthResultInfo& info) | 更新认证结果,进行此次认证方案结果的评估。 |
| CancelAuthentication(uint64_t contextId) | 取消此次认证。 |
| BeginIdentification(uint64_t contextId, AuthType authType, const std::vector
<int8_t>
& challenge,
<br/>
uint32_t executorId, ScheduleInfo& scheduleInfo) | 发起识别,生成识别方案和调度信息
。 |
| UpdateIdentificationResult(uint64_t contextId, const std::vector
<uint8_t>
& scheduleResult,
<br/>
IdentifyResultInfo& info) | 更新识别结果,进行此次识别方案结果的评估。 |
| BeginIdentification(uint64_t contextId, AuthType authType, const std::vector
\<
int8_t>& challenge,
<br/>
uint32_t executorId, ScheduleInfo& scheduleInfo) | 发起识别,生成识别方案和调度信息(V1_0版本)
。 |
| UpdateIdentificationResult(uint64_t contextId, const std::vector
\
<
uint8_t>& scheduleResult,
<br/>
IdentifyResultInfo& info) | 更新识别结果,进行此次识别方案结果的评估。 |
| CancelIdentification(uint64_t contextId) | 取消此次识别。 |
| GetAuthTrustLevel(int32_t userId, AuthType authType, uint32_t& authTrustLevel) | 获取此用户当前认证类型的认证可信等级。 |
| GetValidSolution(int32_t userId, const std::vector
<AuthType>
& authTypes, uint32_t authTrustLevel,
<br/>
std::vector
<AuthType>
& validTypes) | 筛选此用户当前认证可信等级下可用的认证方式。 |
| GetValidSolution(int32_t userId, const std::vector
\<
AuthType>& authTypes, uint32_t authTrustLevel,
<br/>
std::vector
\<
AuthType>& validTypes) | 筛选此用户当前认证可信等级下可用的认证方式。 |
| BeginEnrollmentV1_1(int32_t userId, const std::vector
\<
uint8_t>& authToken, const EnrollParam& param, ScheduleInfoV1_1& info) | 发起用户的认证凭据的录入,当录入类型为PIN码且当前用户已录入PIN码的情况下会更新PIN码(V1_1版本)。 |
| BeginAuthenticationV1_1(uint64_t contextId, const AuthSolution& param, std::vector
\<
ScheduleInfoV1_1>& scheduleInfos) | 发起认证,生成认证方案和调度信息(V1_1版本)。 |
| BeginIdentificationV1_1(uint64_t contextId, AuthType authType,
const std::vector
\<
uint8_t>& challenge, uint32_t executorSensorHint, ScheduleInfoV1_1& scheduleInfo)| 发起识别,生成识别方案和调度信息(V1_1版本)。 |
### 开发步骤
...
...
@@ -302,9 +306,9 @@ User_auth驱动的主要工作是为User_auth服务提供稳定的用户凭据
return
ret
;
}
// 发起
认证,生成录入调度信息
int32_t
UserAuthInterfaceService
::
BeginEnrollment
(
int32_t
userId
,
const
std
::
vector
<
uint8_t
>&
authToken
,
const
EnrollParam
&
param
,
ScheduleInfo
&
info
)
// 发起
录入,生成录入调度信息(V1_1版本)
int32_t
UserAuthInterfaceService
::
BeginEnrollment
V1_1
(
int32_t
userId
,
const
std
::
vector
<
uint8_t
>&
authToken
,
const
EnrollParam
&
param
,
ScheduleInfo
V1_1
&
info
)
{
IAM_LOGI
(
"start"
);
GlobalLock
();
...
...
@@ -343,6 +347,17 @@ User_auth驱动的主要工作是为User_auth服务提供稳定的用户凭据
return
ret
;
}
// 发起录入,生成录入调度信息(V1_0版本),通过调用 V1_1 版本相应接口实现功能
int32_t
UserAuthInterfaceService
::
BeginEnrollment
(
int32_t
userId
,
const
std
::
vector
<
uint8_t
>
&
authToken
,
const
EnrollParam
&
param
,
ScheduleInfo
&
info
)
{
IAM_LOGI
(
"start"
);
ScheduleInfoV1_1
infoV1_1
;
int32_t
ret
=
BeginEnrollmentV1_1
(
userId
,
authToken
,
param
,
infoV1_1
);
CopyScheduleInfoV1_1ToV1_0
(
infoV1_1
,
info
);
return
ret
;
}
// 取消录入接口实现
int32_t
UserAuthInterfaceService
::
CancelEnrollment
(
int32_t
userId
)
{
...
...
@@ -407,8 +422,8 @@ User_auth驱动的主要工作是为User_auth服务提供稳定的用户凭据
}
// 发起认证,生成认证方案和调度信息
int32_t
UserAuthInterfaceService
::
BeginAuthentication
(
uint64_t
contextId
,
const
AuthSolution
&
param
,
std
::
vector
<
ScheduleInfo
>&
infos
)
int32_t
UserAuthInterfaceService
::
BeginAuthentication
V1_1
(
uint64_t
contextId
,
const
AuthSolution
&
param
,
std
::
vector
<
ScheduleInfo
V1_1
>&
infos
)
{
IAM_LOGI
(
"start"
);
if
(
param
.
challenge
.
size
()
!=
sizeof
(
uint64_t
))
{
...
...
@@ -436,7 +451,7 @@ User_auth驱动的主要工作是为User_auth服务提供稳定的用户凭据
return
ret
;
}
for
(
uint32_t
i
=
0
;
i
<
scheduleIdNum
;
i
++
)
{
ScheduleInfo
temp
;
ScheduleInfo
V1_1
temp
;
if
(
!
CopyScheduleInfo
(
schedulesGet
+
i
,
&
temp
))
{
infos
.
clear
();
ret
=
RESULT_GENERAL_ERROR
;
...
...
@@ -449,6 +464,17 @@ User_auth驱动的主要工作是为User_auth服务提供稳定的用户凭据
return
ret
;
}
// 发起认证,生成认证方案和调度信息(V1_0版本),通过调用 V1_1 版本相应接口实现功能
int32_t
UserAuthInterfaceService
::
BeginAuthentication
(
uint64_t
contextId
,
const
AuthSolution
&
param
,
std
::
vector
<
ScheduleInfo
>
&
infos
)
{
IAM_LOGI
(
"start"
);
std
::
vector
<
ScheduleInfoV1_1
>
infosV1_1
;
int32_t
ret
=
BeginAuthenticationV1_1
(
contextId
,
param
,
infosV1_1
);
CopyScheduleInfosV1_1ToV1_0
(
infosV1_1
,
infos
);
return
ret
;
}
// 更新认证结果,进行此次认证方案结果的评估
int32_t
UserAuthInterfaceService
::
UpdateAuthenticationResult
(
uint64_t
contextId
,
const
std
::
vector
<
uint8_t
>&
scheduleResult
,
AuthResultInfo
&
info
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录