1 /* 2 * Copyright (c) 2025 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 RISK_EVENT_MANAGER_H 17 #define RISK_EVENT_MANAGER_H 18 19 #include <vector> 20 21 #include "attributes.h" 22 #include "iam_common_defines.h" 23 24 namespace OHOS { 25 namespace UserIam { 26 namespace UserAuth { 27 class RiskEventManager { 28 public: 29 static RiskEventManager &GetInstance(); 30 31 void HandleStrongAuthEvent(int32_t userId); 32 void SyncRiskEvents(); 33 void OnScreenLock(); 34 35 #ifndef IAM_TEST_ENABLE 36 private: 37 #endif 38 enum EventType : uint32_t { 39 UNKNOWN = 0, 40 SCREENLOCK_STRONG_AUTH = 1 41 }; 42 43 RiskEventManager() = default; 44 ~RiskEventManager() = default; 45 46 void SetRiskEventPropertyForAuthType(int32_t userId, const AuthType authType, 47 EventType event); 48 ResultCode GetTemplateIdList(int32_t userId, const AuthType authType, 49 std::vector<uint64_t> &templateIds); 50 ResultCode GetStrongAuthExtraInfo(int32_t userId, const AuthType authType, 51 std::vector<uint8_t> &extraInfo); 52 bool IsScreenLockStrongAuth(int32_t userId); 53 ResultCode SetAttributes(int32_t userId, const AuthType authType, 54 EventType event, Attributes &attributes); 55 }; 56 } // namespace UserAuth 57 } // namespace UserIam 58 } // namespace OHOS 59 #endif // RISK_EVENT_MANAGER_H