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 USER_IDM_PROXY_H 17 #define USER_IDM_PROXY_H 18 19 #include "iremote_proxy.h" 20 #include "message_parcel.h" 21 #include "nocopyable.h" 22 #include "user_idm_interface.h" 23 24 namespace OHOS { 25 namespace UserIam { 26 namespace UserAuth { 27 class UserIdmProxy : public IRemoteProxy<UserIdmInterface>, public NoCopyable { 28 public: 29 explicit UserIdmProxy(const sptr<IRemoteObject> &object); 30 ~UserIdmProxy() override = default; 31 int32_t OpenSession(int32_t userId, std::vector<uint8_t> &challenge) override; 32 void CloseSession(int32_t userId) override; 33 int32_t GetCredentialInfo(int32_t userId, AuthType authType, 34 const sptr<IdmGetCredInfoCallbackInterface> &callback) override; 35 int32_t GetSecInfo(int32_t userId, const sptr<IdmGetSecureUserInfoCallbackInterface> &callback) override; 36 void AddCredential(int32_t userId, const CredentialPara &credPara, 37 const sptr<IdmCallbackInterface> &callback, bool isUpdate) override; 38 void UpdateCredential(int32_t userId, const CredentialPara &credPara, 39 const sptr<IdmCallbackInterface> &callback) override; 40 int32_t Cancel(int32_t userId) override; 41 int32_t EnforceDelUser(int32_t userId, const sptr<IdmCallbackInterface> &callback) override; 42 void DelUser(int32_t userId, const std::vector<uint8_t> authToken, 43 const sptr<IdmCallbackInterface> &callback) override; 44 void DelCredential(int32_t userId, uint64_t credentialId, 45 const std::vector<uint8_t> &authToken, const sptr<IdmCallbackInterface> &callback) override; 46 void ClearRedundancyCredential(const sptr<IdmCallbackInterface> &callback) override; 47 private: 48 static inline BrokerDelegator<UserIdmProxy> delegator_; 49 bool SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply); 50 }; 51 } // namespace UserAuth 52 } // namespace UserIam 53 } // namespace OHOS 54 #endif // USER_IDM_PROXY_H