• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 SUDO_IAM_H
17 #define SUDO_IAM_H
18 #include <condition_variable>
19 #include <mutex>
20 #include "account_iam_client.h"
21 #include "account_iam_info.h"
22 #include "account_iam_client_callback.h"
23 #include "i_inputer.h"
24 
25 extern std::condition_variable g_condVarForAuth;
26 extern bool g_authFinish;
27 extern std::mutex g_mutexForAuth;
28 
29 namespace OHOS {
30 namespace UserIam {
31 namespace PinAuth {
32 
33 class SudoIInputer : public IInputer {
34 public:
35     virtual ~SudoIInputer();
36     void OnGetData(int32_t authSubType, std::vector<uint8_t> challenge,
37                                 std::shared_ptr<IInputerData> inputerData) override;
38     void SetPasswd(char *pwd, int len);
39 private:
40     std::vector<uint8_t> passwd_;
41 };
42 
43 } //PinAuth
44 } //UserIam
45 
46 namespace AccountSA {
47 
48 class SudoIDMCallback : public IDMCallback {
49 public:
50     virtual ~SudoIDMCallback() = default;
51     SudoIDMCallback();
52     void OnAcquireInfo(int32_t module, uint32_t acquireInfo, const Attributes &extraInfo) override;
53     void OnResult(int32_t result, const Attributes &extraInfo) override;
54     bool GetVerifyResult(void);
55 private:
56     bool verifyResult_;
57 };
58 } // AccountSA
59 } //OHOS
60 #endif //SUDO_IAM_H
61