1 /*
2  * Copyright (c) 2024 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 PIN_AUTH_COLLECTOR_HDI_H
17 #define PIN_AUTH_COLLECTOR_HDI_H
18 
19 #include <cstdint>
20 #include <map>
21 #include <vector>
22 
23 #include "iam_executor_framework_types.h"
24 #include "iam_executor_iauth_executor_hdi.h"
25 #include "iam_executor_iexecute_callback.h"
26 #include "nocopyable.h"
27 #include "pin_auth_hdi.h"
28 
29 namespace OHOS {
30 namespace UserIam {
31 namespace PinAuth {
32 class PinAuthCollectorHdi : public std::enable_shared_from_this<PinAuthCollectorHdi>,
33     public UserAuth::IAuthExecutorHdi, public NoCopyable {
34 public:
35     explicit PinAuthCollectorHdi(const sptr<ICollector> &collectorProxy);
36     ~PinAuthCollectorHdi() override = default;
37 
38     UserAuth::ResultCode GetExecutorInfo(UserAuth::ExecutorInfo &info) override;
39     UserAuth::ResultCode OnRegisterFinish(const std::vector<uint64_t> &templateIdList,
40         const std::vector<uint8_t> &frameworkPublicKey, const std::vector<uint8_t> &extraInfo) override;
41     UserAuth::ResultCode Cancel(uint64_t scheduleId) override;
42     UserAuth::ResultCode SendMessage(uint64_t scheduleId, int32_t srcRole, const std::vector<uint8_t> &msg) override;
43     UserAuth::ResultCode Collect(uint64_t scheduleId, const UserAuth::CollectParam &param,
44         const std::shared_ptr<UserAuth::IExecuteCallback> &callbackObj) override;
45     UserAuth::ResultCode OnSetData(uint64_t scheduleId, uint64_t authSubType, const std::vector<uint8_t> &data,
46         int32_t errorCode);
47 
48 private:
49     sptr<ICollector> collectorProxy_ { nullptr };
50 };
51 } // namespace PinAuth
52 } // namespace UserIam
53 } // namespace OHOS
54 
55 #endif // PIN_AUTH_COLLECTOR_HDI_H