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_AUTH_ASYNC_PROXY_H 17 #define USER_AUTH_ASYNC_PROXY_H 18 19 #include <iremote_proxy.h> 20 21 #include "user_auth_callback_interface.h" 22 #include "user_idm_callback_interface.h" 23 24 namespace OHOS { 25 namespace UserIam { 26 namespace UserAuth { 27 class IdmCallbackProxy : public IRemoteProxy<IdmCallbackInterface>, public NoCopyable { 28 public: IdmCallbackProxy(const sptr<IRemoteObject> & object)29 explicit IdmCallbackProxy(const sptr<IRemoteObject> &object) : IRemoteProxy<IdmCallbackInterface>(object) 30 { 31 } 32 ~IdmCallbackProxy() override = default; 33 void OnResult(int32_t result, const Attributes &extraInfo) override; 34 void OnAcquireInfo(int32_t module, int32_t acquireInfo, const Attributes &extraInfo) override; 35 36 private: 37 bool SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply); 38 static inline BrokerDelegator<IdmCallbackProxy> delegator_; 39 }; 40 41 class IdmGetCredentialInfoProxy : public IRemoteProxy<IdmGetCredInfoCallbackInterface>, public NoCopyable { 42 public: IdmGetCredentialInfoProxy(const sptr<IRemoteObject> & object)43 explicit IdmGetCredentialInfoProxy(const sptr<IRemoteObject> &object) 44 : IRemoteProxy<IdmGetCredInfoCallbackInterface>(object) 45 { 46 } 47 ~IdmGetCredentialInfoProxy() override = default; 48 void OnCredentialInfos(const std::vector<CredentialInfo> &credInfoList) override; 49 50 private: 51 bool SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply); 52 static inline BrokerDelegator<IdmGetCredentialInfoProxy> delegator_; 53 }; 54 55 class IdmGetSecureUserInfoProxy : public IRemoteProxy<IdmGetSecureUserInfoCallbackInterface>, public NoCopyable { 56 public: IdmGetSecureUserInfoProxy(const sptr<IRemoteObject> & object)57 explicit IdmGetSecureUserInfoProxy(const sptr<IRemoteObject> &object) 58 : IRemoteProxy<IdmGetSecureUserInfoCallbackInterface>(object) 59 { 60 } 61 ~IdmGetSecureUserInfoProxy() override = default; 62 void OnSecureUserInfo(const SecUserInfo &secUserInfo) override; 63 64 private: 65 static inline BrokerDelegator<IdmGetSecureUserInfoProxy> delegator_; 66 bool SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply); 67 ResultCode WriteSecureUserInfo(MessageParcel &data, const SecUserInfo &secUserInfo); 68 }; 69 } // namespace UserAuth 70 } // namespace UserIam 71 } // namespace OHOS 72 #endif // USER_AUTH_ASYNC_PROXY_H 73