Signed-off-by: im-chenchen <huangteng10@huawei.com>
This commit is contained in:
im-chenchen 2024-04-23 17:16:36 +08:00
parent 087bd4fa9c
commit db107bcac4
4 changed files with 15 additions and 8 deletions

View File

@ -53,8 +53,6 @@ ResultCode EnrollCommand::SendRequest()
bool getExtraInfoRet = attributes_->GetUint8ArrayValue(Attributes::ATTR_EXTRA_INFO, extraInfo);
IF_FALSE_LOGE_AND_RETURN_VAL(getExtraInfoRet == true, ResultCode::GENERAL_ERROR);
IAM_LOGI("extraInfo len: %{public}u", extraInfo.size());
IamHitraceHelper traceHelper("hdi Enroll");
ResultCode ret = hdi->Enroll(scheduleId_, (EnrollParam) { tokenId, extraInfo }, shared_from_this());
IAM_LOGI("%{public}s enroll result %{public}d", GetDescription(), ret);

View File

@ -126,11 +126,6 @@ public:
ATTR_CREDENTIAL_DIGEST,
/** Credential count, the value type is uint16_t. */
ATTR_CREDENTIAL_COUNT,
/**
* Private attrs.
* User TYPE, the value type is int32_t.
*/
ATTR_USER_TYPE = 300009,
};
/**

View File

@ -38,6 +38,7 @@ using HdiExecutorSendMsg = OHOS::HDI::UserAuth::V2_0::ExecutorSendMsg;
using HdiAuthResultInfo = OHOS::HDI::UserAuth::V2_0::AuthResultInfo;
using HdiIdentifyResultInfo = OHOS::HDI::UserAuth::V2_0::IdentifyResultInfo;
using HdiEnrollParam = OHOS::HDI::UserAuth::V2_0::EnrollParam;
using HdiUserType = OHOS::HDI::UserAuth::V2_0::UserType;
using HdiCredentialInfo = OHOS::HDI::UserAuth::V2_0::CredentialInfo;
using HdiEnrolledInfo = OHOS::HDI::UserAuth::V2_0::EnrolledInfo;
using HdiEnrollResultInfo = OHOS::HDI::UserAuth::V2_0::EnrollResultInfo;

View File

@ -24,6 +24,8 @@
#include "tokenid_kit.h"
#ifdef HAS_OS_ACCOUNT_PART
#include "os_account_manager.h"
#include "os_account_info.h"
#include "user_auth_hdi.h"
#endif // HAS_OS_ACCOUNT_PART
#define LOG_TAG "USER_AUTH_SA"
@ -120,6 +122,17 @@ int32_t IpcCommon::GetAllUserId(std::vector<int32_t> &userIds)
return SUCCESS;
}
static HdiUserType MapOsAccountTypeToUserType(AccountSA::OsAccountType osAccountType, int32_t userId)
{
if (osAccountType == AccountSA::OsAccountType::PRIVATE) {
return HdiUserType::PRIVATE;
} else if (userId == 100) {
return HdiUserType::MAIN;
} else {
return HdiUserType::SUB;
}
}
int32_t IpcCommon::GetUserTypeByUserId(int32_t userId, int32_t &userType)
{
#ifdef HAS_OS_ACCOUNT_PART
@ -129,7 +142,7 @@ int32_t IpcCommon::GetUserTypeByUserId(int32_t userId, int32_t &userType)
IAM_LOGE("failed to get osAccountType for userId %d, error code: %d", userId, ret);
return TYPE_NOT_SUPPORT;
}
userType = static_cast<int32_t>(osAccountType);
userType = static_cast<int32_t>(MapOsAccountTypeToUserType(osAccountType, userId));
IAM_LOGI("userType:%{public}d", userType);
#else
const int32_t DEFAULT_OS_ACCOUNT_TYPE = 0;