• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2023 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 PUBLISH_EVENT_ADAPTER_H
17 #define PUBLISH_EVENT_ADAPTER_H
18 
19 #include <mutex>
20 #include <string>
21 #include "user_idm_client_defines.h"
22 
23 namespace OHOS {
24 namespace UserIam {
25 namespace UserAuth {
26 class PublishEventAdapter {
27 public:
28     static PublishEventAdapter &GetInstance();
29     void PublishDeletedEvent(int32_t userId);
30     void PublishCreatedEvent(int32_t userId, uint64_t scheduleId);
31     void PublishUpdatedEvent(int32_t userId, uint64_t scheduleId);
32     void PublishCredentialUpdatedEvent(int32_t userId, int32_t authType, uint32_t credentialCount);
33     void CachePinUpdateParam(int32_t userId, uint64_t scheduleId, const CredChangeEventInfo &changeInfo);
34     void CachePinUpdateParam(bool reEnrollFlag);
35     void ClearPinUpdateCacheInfo();
36 
37 private:
38     PublishEventAdapter() = default;
39     ~PublishEventAdapter() = default;
40 
41     std::mutex mutex_;
42     int32_t userId_ {0};
43     uint64_t scheduleId_ {0};
44     CredChangeEventInfo credChangeEventInfo_ = {};
45     bool reEnrollFlag_ {false};
46 };
47 } // namespace UserAuth
48 } // namespace UserIam
49 } // namespace OHOS
50 #endif //PUBLISH_EVENT_ADAPTER_H