1 /* 2 * Copyright (c) 2022 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 /** 17 * @file user_idm_client_defines.h 18 * 19 * @brief Type definitions used by idm client. 20 * @since 3.1 21 * @version 3.2 22 */ 23 24 #ifndef USER_IDM_CLIENT_DEFINES_H 25 #define USER_IDM_CLIENT_DEFINES_H 26 27 #include <optional> 28 #include <vector> 29 30 #include "iam_common_defines.h" 31 32 namespace OHOS { 33 namespace UserIam { 34 namespace UserAuth { 35 /** 36 * @brief User credential infomation returned. 37 */ 38 struct CredentialInfo { 39 /* Auth type supported by executor. */ 40 AuthType authType {0}; 41 /* Auth subtype of PIN. */ 42 std::optional<PinSubType> pinType {}; 43 /* User credentialId is generated by idm to associate userId and templateId. */ 44 uint64_t credentialId {0}; 45 /* User templateId is generated by executor to represent user characteristics. */ 46 uint64_t templateId {0}; 47 }; 48 49 /** 50 * @brief Define credential enrollment information. 51 */ 52 struct EnrolledInfo { 53 /** Auth type supported by executor. */ 54 AuthType authType {0}; 55 /** Enrolled ID. */ 56 uint64_t enrolledId {0}; 57 }; 58 59 /** 60 * @brief Define security user information. 61 */ 62 struct SecUserInfo { 63 /** Security user ID. */ 64 uint64_t secureUid {0}; 65 /** The user credential enrollment infomation. */ 66 std::vector<EnrolledInfo> enrolledInfo {}; 67 }; 68 69 /** 70 * @brief Parameters needed to set about user credential information. 71 */ 72 struct CredentialParameters { 73 /** Auth type supported by executor. */ 74 AuthType authType {0}; 75 /** Auth subtype of PIN. */ 76 std::optional<PinSubType> pinType {}; 77 /** Auth token. */ 78 std::vector<uint8_t> token {}; 79 }; 80 } // namespace UserAuth 81 } // namespace UserIam 82 } // namespace OHOS 83 84 #endif // USER_IDM_CLIENT_DEFINES_H