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_CALLBACK_SERVICE_H
17 #define USER_IDM_CALLBACK_SERVICE_H
18 
19 #include "user_idm_callback_stub.h"
20 
21 #include "iam_hitrace_helper.h"
22 #include "user_idm_client_callback.h"
23 
24 namespace OHOS {
25 namespace UserIam {
26 namespace UserAuth {
27 class IdmCallbackService : public IdmCallbackStub {
28 public:
29     explicit IdmCallbackService(const std::shared_ptr<UserIdmClientCallback> &impl);
30     ~IdmCallbackService() override;
31     void OnResult(int32_t result, const Attributes &extraInfo) override;
32     void OnAcquireInfo(int32_t module, int32_t acquireInfo, const Attributes &extraInfo) override;
33 
34 private:
35     std::shared_ptr<UserIdmClientCallback> idmClientCallback_ {nullptr};
36     std::shared_ptr<UserIam::UserAuth::IamHitraceHelper> iamHitraceHelper_ {nullptr};
37 };
38 
39 class IdmGetCredInfoCallbackService : public IdmGetCredInfoCallbackStub {
40 public:
41     explicit IdmGetCredInfoCallbackService(const std::shared_ptr<GetCredentialInfoCallback> &impl);
42     ~IdmGetCredInfoCallbackService() override;
43     void OnCredentialInfos(const std::vector<CredentialInfo> &credInfoList) override;
44 
45 private:
46     std::shared_ptr<GetCredentialInfoCallback> getCredInfoCallback_ {nullptr};
47 };
48 
49 class IdmGetSecureUserInfoCallbackService : public IdmGetSecureUserInfoCallbackStub {
50 public:
51     explicit IdmGetSecureUserInfoCallbackService(const std::shared_ptr<GetSecUserInfoCallback> &impl);
52     ~IdmGetSecureUserInfoCallbackService() override;
53     void OnSecureUserInfo(const SecUserInfo &secUserInfo) override;
54 
55 private:
56     std::shared_ptr<GetSecUserInfoCallback> getSecInfoCallback_ {nullptr};
57 };
58 } // namespace UserAuth
59 } // namespace UserIam
60 } // namespace OHOS
61 #endif // USER_IDM_CALLBACK_SERVICE_H