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 #ifndef IAM_COMMON_DEFINES_H 17 #define IAM_COMMON_DEFINES_H 18 19 namespace OHOS { 20 namespace UserIam { 21 namespace UserAuth { 22 constexpr size_t MAX_CHALLENG_LEN = 32; 23 24 enum AuthType : int32_t { 25 ALL = 0, 26 PIN = 1, 27 FACE = 2, 28 FINGERPRINT = 4, 29 }; 30 31 enum PinSubType : int32_t { 32 PIN_SIX = 10000, 33 PIN_NUMBER = 10001, 34 PIN_MIXED = 10002, 35 PIN_MAX, 36 }; 37 38 enum ExecutorRole : int32_t { 39 SCHEDULER = 0, 40 COLLECTOR = 1, 41 VERIFIER = 2, 42 ALL_IN_ONE = 3, 43 }; 44 45 enum ExecutorSecureLevel : int32_t { 46 ESL0 = 0, 47 ESL1 = 1, 48 ESL2 = 2, 49 ESL3 = 3, 50 }; 51 52 enum AuthTrustLevel : uint32_t { 53 ATL1 = 10000, 54 ATL2 = 20000, 55 ATL3 = 30000, 56 ATL4 = 40000, 57 }; 58 59 enum ScheduleMode : int32_t { 60 ENROLL = 0, 61 AUTH = 1, 62 IDENTIFY = 2, 63 }; 64 65 enum PropertyMode : uint32_t { 66 PROPERTY_INIT_ALGORITHM = 1, 67 PROPERTY_MODE_DEL = 2, 68 PROPERTY_MODE_GET = 3, 69 PROPERTY_MODE_SET = 4, 70 PROPERTY_MODE_FREEZE = 5, 71 PROPERTY_MODE_UNFREEZE = 6, 72 }; 73 74 enum ResultCode : int32_t { 75 SUCCESS = 0, 76 FAIL = 1, 77 GENERAL_ERROR = 2, 78 CANCELED = 3, 79 TIMEOUT = 4, 80 TYPE_NOT_SUPPORT = 5, 81 TRUST_LEVEL_NOT_SUPPORT = 6, 82 BUSY = 7, 83 INVALID_PARAMETERS = 8, 84 LOCKED = 9, 85 NOT_ENROLLED = 10, 86 HARDWARE_NOT_SUPPORTED = 11, 87 SYSTEM_ERROR_CODE_BEGIN = 1000, // error code for system 88 IPC_ERROR = 1001, 89 INVALID_CONTEXT_ID = 1002, 90 READ_PARCEL_ERROR = 1003, 91 WRITE_PARCEL_ERROR = 1004, 92 CHECK_PERMISSION_FAILED = 1005, 93 INVALID_HDI_INTERFACE = 1006, 94 VENDOR_ERROR_CODE_BEGIN = 10000, // error code for vendor 95 }; 96 } // namespace UserAuth 97 } // namespace UserIam 98 } // namespace OHOS 99 #endif // IAM_COMMON_DEFINES_H 100