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 UPDATE_REMOTE_HAP_TOKEN_COMMAND_H
17 #define UPDATE_REMOTE_HAP_TOKEN_COMMAND_H
18 
19 #include <string>
20 
21 #include "access_token.h"
22 #include "base_remote_command.h"
23 #include "hap_token_info.h"
24 
25 namespace OHOS {
26 namespace Security {
27 namespace AccessToken {
28 /**
29  * Command which used to get all native token info from other device.
30  */
31 class UpdateRemoteHapTokenCommand : public BaseRemoteCommand {
32 public:
33     void Prepare() override;
34 
35     void Execute() override;
36 
37     void Finish() override;
38 
39     std::string ToJsonPayload() override;
40 
41     explicit UpdateRemoteHapTokenCommand(const std::string &json);
42     UpdateRemoteHapTokenCommand(const std::string &srcDeviceId, const std::string &dstDeviceId,
43         const HapTokenInfoForSync& tokenInfo);
44     virtual ~UpdateRemoteHapTokenCommand() override = default;
45 
46 private:
47     /**
48      * The command name. Should be equal to class name.
49      */
50     const std::string COMMAND_NAME = "UpdateRemoteHapTokenCommand";
51     HapTokenInfoForSync updateTokenInfo_;
52 };
53 }  // namespace AccessToken
54 }  // namespace Security
55 }  // namespace OHOS
56 #endif
57