• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef USER_AUTH_HDI
17 #define USER_AUTH_HDI
18 
19 #include "accesstoken_kit.h"
20 #include "v4_0/iuser_auth_interface.h"
21 #include "v4_0/message_callback_stub.h"
22 #include "v4_0/user_auth_types.h"
23 #include "v4_0/user_auth_interface_service.h"
24 
25 namespace OHOS {
26 namespace UserIam {
27 namespace UserAuth {
28 enum HdiCallerType : int32_t {
29     HDI_CALLER_TYPE_INVALID = -1,
30     HDI_CALLER_TYPE_HAP = 0,
31     HDI_CALLER_TYPE_NATIVE,
32 };
33 
ConvertATokenTypeToCallerType(int32_t in)34 static inline HdiCallerType ConvertATokenTypeToCallerType(int32_t in)
35 {
36     static const std::map<int32_t, HdiCallerType> data = {
37         {Security::AccessToken::TOKEN_INVALID, HdiCallerType::HDI_CALLER_TYPE_INVALID},
38         {Security::AccessToken::TOKEN_HAP, HdiCallerType::HDI_CALLER_TYPE_HAP},
39         {Security::AccessToken::TOKEN_NATIVE, HdiCallerType::HDI_CALLER_TYPE_NATIVE},
40     };
41     auto it = data.find(in);
42     if (it == data.end()) {
43         return HDI_CALLER_TYPE_INVALID;
44     }
45     return it->second;
46 }
47 
48 using IUserAuthInterface = OHOS::HDI::UserAuth::V4_0::IUserAuthInterface;
49 using HdiAuthType = OHOS::HDI::UserAuth::V4_0::AuthType;
50 using HdiExecutorRole = OHOS::HDI::UserAuth::V4_0::ExecutorRole;
51 using HdiExecutorSecureLevel = OHOS::HDI::UserAuth::V4_0::ExecutorSecureLevel;
52 using HdiPinSubType = OHOS::HDI::UserAuth::V4_0::PinSubType;
53 using HdiScheduleMode = OHOS::HDI::UserAuth::V4_0::ScheduleMode;
54 using HdiExecutorRegisterInfo = OHOS::HDI::UserAuth::V4_0::ExecutorRegisterInfo;
55 using HdiExecutorInfo = OHOS::HDI::UserAuth::V4_0::ExecutorInfo;
56 using HdiScheduleInfo = OHOS::HDI::UserAuth::V4_0::ScheduleInfo;
57 using HdiAuthParam = OHOS::HDI::UserAuth::V4_0::AuthParam;
58 using HdiExecutorSendMsg = OHOS::HDI::UserAuth::V4_0::ExecutorSendMsg;
59 using HdiAuthResultInfo = OHOS::HDI::UserAuth::V4_0::AuthResultInfo;
60 using HdiIdentifyResultInfo = OHOS::HDI::UserAuth::V4_0::IdentifyResultInfo;
61 using HdiEnrollParam = OHOS::HDI::UserAuth::V4_0::EnrollParam;
62 using HdiUserType = OHOS::HDI::UserAuth::V4_0::UserType;
63 using HdiCredentialInfo = OHOS::HDI::UserAuth::V4_0::CredentialInfo;
64 using HdiEnrolledInfo = OHOS::HDI::UserAuth::V4_0::EnrolledInfo;
65 using HdiEnrollResultInfo = OHOS::HDI::UserAuth::V4_0::EnrollResultInfo;
66 using HdiEnrolledState = OHOS::HDI::UserAuth::V4_0::EnrolledState;
67 using HdiReuseUnlockInfo = OHOS::HDI::UserAuth::V4_0::ReuseUnlockInfo;
68 using HdiReuseUnlockParam = OHOS::HDI::UserAuth::V4_0::ReuseUnlockParam;
69 using HdiIMessageCallback = OHOS::HDI::UserAuth::V4_0::IMessageCallback;
70 using UserInfo = OHOS::HDI::UserAuth::V4_0::UserInfo;
71 using ExtUserInfo = OHOS::HDI::UserAuth::V4_0::ExtUserInfo;
72 using HdiGlobalConfigType = OHOS::HDI::UserAuth::V4_0::GlobalConfigType;
73 using HdiGlobalConfigValue = OHOS::HDI::UserAuth::V4_0::GlobalConfigValue;
74 using HdiGlobalConfigParam = OHOS::HDI::UserAuth::V4_0::GlobalConfigParam;
75 using HdiUserAuthTokenPlain = OHOS::HDI::UserAuth::V4_0::UserAuthTokenPlain;
76 using HdiCredentialOperateType = OHOS::HDI::UserAuth::V4_0::CredentialOperateType;
77 using HdiCredentialOperateResult = OHOS::HDI::UserAuth::V4_0::CredentialOperateResult;
78 } // namespace UserAuth
79 } // namespace UserIam
80 } // namespace OHOS
81 
82 #endif // USER_AUTH_HDI