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 USERAUTH_ADAPTER_H 17 #define USERAUTH_ADAPTER_H 18 19 #include "useridm_info.h" 20 #include "useridm_interface.h" 21 22 namespace OHOS { 23 namespace UserIAM { 24 namespace UserIDM { 25 class UserIDMAdapter { 26 public: 27 static UserIDMAdapter &GetInstance(); 28 void OpenEditSession(int32_t userId, uint64_t& challenge); 29 void CloseEditSession(); 30 int32_t QueryCredential(int32_t userId, AuthType authType, std::vector<CredentialInfo>& credInfos); 31 int32_t GetSecureUid(int32_t userId, uint64_t& secureUid, std::vector<EnrolledInfo>& enrolledInfos); 32 int32_t InitSchedulation(std::vector<uint8_t> autoToken, int32_t userId, AuthType authType, 33 AuthSubType authSubType, uint64_t& sessionId); 34 int32_t DeleteCredential(int32_t userId, uint64_t credentialId, std::vector<uint8_t> authToken, 35 CredentialInfo& credInfo); 36 int32_t DeleteUser(int32_t userId, std::vector<uint8_t> authToken, std::vector<CredentialInfo>& credInfo); 37 int32_t DeleteUserEnforce(int32_t userId, std::vector<CredentialInfo>& credInfo); 38 int32_t AddCredential(std::vector<uint8_t>& enrollToken, uint64_t& credentialId); 39 int32_t UpdateCredential(std::vector<uint8_t> enrollToken, uint64_t &credentialId, 40 CredentialInfo &deletedCredential); 41 42 private: 43 UserIDMAdapter() = default; 44 ~UserIDMAdapter() = default; 45 }; 46 } // namespace UserIDM 47 } // namespace UserIam 48 } // namespace OHOS 49 #endif // USERAUTH_ADAPTER_H 50