1 /* 2 * Copyright (c) 2023 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_auth_common_defines.h 18 * 19 * @brief Some common defines in IAM. 20 * @since 3.1 21 * @version 3.2 22 */ 23 24 #ifndef USER_AUTH_COMMON_DEFINES_H 25 #define USER_AUTH_COMMON_DEFINES_H 26 27 #include <cstddef> 28 #include <cstdint> 29 30 #include <string> 31 #include <vector> 32 33 #include "iam_common_defines.h" 34 35 namespace OHOS { 36 namespace UserIam { 37 namespace UserAuth { 38 39 const std::string NOTICE_VERSION_STR = "1"; 40 const std::string CMD_NOTIFY_AUTH_START = "CMD_NOTIFY_AUTH_START"; 41 42 /** 43 * @brief Notice type for user authentication. 44 */ 45 enum NoticeType : int32_t { 46 /** notice from widget. */ 47 WIDGET_NOTICE = 1, 48 }; 49 50 /** 51 * @brief Window mode type for user authentication widget. 52 */ 53 enum WindowModeType : int32_t { 54 /** Window mode type is dialog box. */ 55 DIALOG_BOX = 1, 56 /** Window mode type is full screen. */ 57 FULLSCREEN = 2, 58 /** Window mode type is not set */ 59 UNKNOWN_WINDOW_MODE = 3, 60 }; 61 /** 62 * @brief Auth parameter. 63 */ 64 struct AuthParam { 65 /** challenge value */ 66 std::vector<uint8_t> challenge; 67 /** Credential type for authentication. */ 68 std::vector<AuthType> authType; 69 /** Trust level of authentication result. */ 70 AuthTrustLevel authTrustLevel; 71 }; 72 73 /** 74 * @brief Auth widget parameter. 75 */ 76 struct WidgetParam { 77 /** Title of widget. */ 78 std::string title; 79 /** The description text of navigation button. */ 80 std::string navigationButtonText; 81 /** Full screen or not. */ 82 WindowModeType windowMode; 83 }; 84 } // namespace UserAuth 85 } // namespace UserIam 86 } // namespace OHOS 87 #endif // USER_AUTH_COMMON_DEFINES_H 88