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 REMOTE_COMMAND_FACTORY_H
17 #define REMOTE_COMMAND_FACTORY_H
18 
19 #include <memory>
20 #include <string>
21 #include <vector>
22 
23 #include "access_token.h"
24 #include "delete_remote_token_command.h"
25 #include "hap_token_info.h"
26 #include "sync_remote_hap_token_command.h"
27 #include "update_remote_hap_token_command.h"
28 
29 namespace OHOS {
30 namespace Security {
31 namespace AccessToken {
32 class RemoteCommandFactory {
33 public:
34     static RemoteCommandFactory &GetInstance();
35 
36     std::shared_ptr<SyncRemoteHapTokenCommand> NewSyncRemoteHapTokenCommand(const std::string &srcDeviceId,
37         const std::string &dstDeviceId, AccessTokenID tokenID);
38 
39     std::shared_ptr<DeleteRemoteTokenCommand> NewDeleteRemoteTokenCommand(const std::string &srcDeviceId,
40         const std::string &dstDeviceId, AccessTokenID tokenID);
41 
42     std::shared_ptr<UpdateRemoteHapTokenCommand> NewUpdateRemoteHapTokenCommand(const std::string &srcDeviceId,
43         const std::string &dstDeviceId, const HapTokenInfoForSync& tokenInfo);
44 
45     std::shared_ptr<BaseRemoteCommand> NewRemoteCommandFromJson(
46         const std::string &commandName, const std::string &commandJsonString);
47 
48 private:
49     const std::string TAG = "RemoteCommandFactory";
50 };
51 }  // namespace AccessToken
52 }  // namespace Security
53 }  // namespace OHOS
54 #endif  // REMOTE_COMMAND_FACTORY_H
55