• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 PIN_AUTH_EXECUTOR_CALLBACK_HDI
17 #define PIN_AUTH_EXECUTOR_CALLBACK_HDI
18 
19 #include <cstdint>
20 #include <vector>
21 
22 #include "nocopyable.h"
23 
24 #include "iam_executor_iexecute_callback.h"
25 #include "pin_auth_hdi.h"
26 #include "pin_auth_manager.h"
27 #include "pin_auth_executor_hdi.h"
28 
29 namespace OHOS {
30 namespace UserIam {
31 namespace PinAuth {
32 class PinAuthExecutorCallbackHdi : public IExecutorCallbackV1_1, public NoCopyable {
33 public:
34     explicit PinAuthExecutorCallbackHdi(std::shared_ptr<UserAuth::IExecuteCallback> frameworkCallback,
35         std::shared_ptr<PinAuthExecutorHdi> pinAuthExecutorHdi, uint32_t tokenId);
36     ~PinAuthExecutorCallbackHdi() override = default;
37     int32_t OnResult(int32_t code, const std::vector<uint8_t> &extraInfo) override;
38     int32_t OnGetData(uint64_t scheduleId, const std::vector<uint8_t> &salt, uint64_t authSubType) override;
39     int32_t OnGetDataV1_1(uint64_t scheduleId, const std::vector<uint8_t> &algoParameter, uint64_t authSubType,
40         uint32_t algoVersion) override;
41 
42 private:
43     std::shared_ptr<UserAuth::IExecuteCallback> frameworkCallback_;
44     std::shared_ptr<PinAuthExecutorHdi> pinAuthExecutorHdi_;
45     UserAuth::ResultCode ConvertResultCode(const int32_t in);
46     uint32_t tokenId_;
47 };
48 } // PinAuth
49 } // UserIam
50 } // OHOS
51 
52 #endif // PIN_AUTH_EXECUTOR_CALLBACK_HDI