1 /* 2 * Copyright (c) 2022-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 OS_ACCOUNT_INTERFACES_INNERKITS_ACCOUNT_IAM_NATIVE_INCLUDE_ACCOUNT_IAM_INFO_H 17 #define OS_ACCOUNT_INTERFACES_INNERKITS_ACCOUNT_IAM_NATIVE_INCLUDE_ACCOUNT_IAM_INFO_H 18 19 #include "attributes.h" 20 #include "iam_common_defines.h" 21 #ifdef HAS_PIN_AUTH_PART 22 #include "i_inputer.h" 23 #endif 24 #include "user_access_ctrl_client_callback.h" 25 #include "user_auth_client_callback.h" 26 #include "user_auth_client_defines.h" 27 #include "user_idm_client.h" 28 #include "user_idm_client_callback.h" 29 #include "user_idm_client_defines.h" 30 31 namespace OHOS { 32 namespace AccountSA { 33 #ifdef HAS_PIN_AUTH_PART 34 typedef UserIam::PinAuth::IInputer IInputer; 35 typedef UserIam::PinAuth::IInputerData IInputerData; 36 #endif 37 38 typedef UserIam::UserAuth::ResultCode ResultCode; 39 typedef UserIam::UserAuth::AuthType AuthType; 40 typedef UserIam::UserAuth::Attributes Attributes; 41 typedef UserIam::UserAuth::SecUserInfo SecUserInfo; 42 typedef UserIam::UserAuth::AuthTrustLevel AuthTrustLevel; 43 typedef UserIam::UserAuth::AuthenticationCallback AuthenticationCallback; 44 typedef UserIam::UserAuth::GetPropCallback GetPropCallback; 45 typedef UserIam::UserAuth::SetPropCallback SetPropCallback; 46 typedef UserIam::UserAuth::GetPropertyRequest GetPropertyRequest; 47 typedef UserIam::UserAuth::SetPropertyRequest SetPropertyRequest; 48 typedef UserIam::UserAuth::PropertyMode PropertyMode; 49 typedef UserIam::UserAuth::PinSubType PinSubType; 50 typedef UserIam::UserAuth::UserIdmClientCallback UserIdmClientCallback; 51 typedef UserIam::UserAuth::VerifyTokenCallback VerifyTokenCallback; 52 typedef UserIam::UserAuth::CredentialParameters CredentialParameters; 53 typedef UserIam::UserAuth::CredentialInfo CredentialInfo; 54 typedef UserIam::UserAuth::GetSecUserInfoCallback GetSecUserInfoCallback; 55 typedef UserIam::UserAuth::GetCredentialInfoCallback GetCredentialInfoCallback; 56 typedef UserIam::UserAuth::PrepareRemoteAuthCallback PrepareRemoteAuthCallback; 57 typedef UserIam::UserAuth::GetSecUserInfoCallback GetSecUserInfoCallback; 58 59 enum IAMAuthType { 60 DOMAIN = 1024, 61 TYPE_END, 62 }; 63 64 enum IAMAuthSubType { 65 DOMAIN_MIXED = 10240001 66 }; 67 68 enum IAMState { 69 IDLE = 0, 70 AFTER_OPEN_SESSION, 71 DURING_AUTHENTICATE, 72 DURING_ADD_CRED, 73 DURING_UPDATE_CRED, 74 DURING_DEL_CRED, 75 AFTER_ADD_CRED, 76 AFTER_UPDATE_CRED, 77 AFTER_DEL_CRED, 78 ROLL_BACK_DEL_CRED, 79 DURING_DEL_USER, 80 }; 81 82 struct CredentialItem { 83 int32_t type = 0; 84 std::vector<uint8_t> oldCredential; 85 std::vector<uint8_t> credential; 86 }; 87 88 enum AuthIntent : int32_t { 89 DEFAULT = 0, 90 UNLOCK = 1, 91 SILENT_AUTH = 2, 92 QUESTION_AUTH = 3, 93 }; 94 95 struct RemoteAuthParam { 96 std::optional<std::string> verifierNetworkId; 97 std::optional<std::string> collectorNetworkId; 98 std::optional<uint32_t> collectorTokenId; 99 }; 100 101 struct AuthParam { 102 int32_t userId = 0; 103 std::vector<uint8_t> challenge; 104 AuthType authType; 105 AuthTrustLevel authTrustLevel; 106 AuthIntent authIntent = AuthIntent::DEFAULT; 107 std::optional<RemoteAuthParam> remoteAuthParam; 108 }; 109 110 struct RemoteAuthOptions { 111 std::string verifierNetworkId; 112 std::string collectorNetworkId; 113 uint32_t collectorTokenId; 114 bool hasVerifierNetworkId = false; 115 bool hasCollectorNetworkId = false; 116 bool hasCollectorTokenId = false; 117 }; 118 119 struct AuthOptions { 120 int32_t accountId = -1; 121 AuthIntent authIntent = AuthIntent::DEFAULT; 122 RemoteAuthOptions remoteAuthOptions; 123 bool hasRemoteAuthOptions = false; 124 bool hasAccountId = false; 125 }; 126 } // namespace AccountSA 127 } // namespace OHOS 128 #endif // OS_ACCOUNT_INTERFACES_INNERKITS_ACCOUNT_IAM_NATIVE_INCLUDE_ACCOUNT_IAM_INFO_H 129