• 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 CALLBACK_H
17 #define CALLBACK_H
18 
19 #include <mutex>
20 #include <vector>
21 #include <string>
22 #include <iostream>
23 #include <securec.h>
24 #include "useridm_info.h"
25 #include "useridm_callback.h"
26 #include "napi/native_api.h"
27 #include "napi/native_common.h"
28 #include "useridentity_manager.h"
29 
30 namespace OHOS {
31 namespace UserIAM {
32 namespace UserIDM {
33 class IIdmCallback : public IDMCallback {
34 public:
35     explicit IIdmCallback(AsyncCallbackContext *asyncCallbackContext);
36     virtual ~IIdmCallback() = default;
37     AsyncCallbackContext* asyncCallbackContext_;
38     void OnResult(int32_t result, RequestResult extraInfo) override;
39     void OnAcquireInfo(int32_t module, int32_t acquire, RequestResult extraInfo) override;
40 private:
41     std::mutex mutex_;
42 };
43 
44 class GetInfoCallbackIDM : public GetInfoCallback {
45 public:
46     explicit GetInfoCallbackIDM(AsyncGetAuthInfo *asyncGetAuthInfo);
47     virtual ~GetInfoCallbackIDM() = default;
48     AsyncGetAuthInfo *asyncGetAuthInfo_;
49     void OnGetInfo(std::vector<CredentialInfo>& info) override;
50 };
51 
52 napi_value GetAuthInfoRet(napi_env env, AsyncGetAuthInfo *asyncGetAuthInfo);
53 } // namespace UserIDM
54 } // namespace UserIAM
55 } // namespace ohos
56 #endif // CALLBACK_H
57