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 ACCESSTOKEN_SYNC_KIT_INTERFACE_H 17 #define ACCESSTOKEN_SYNC_KIT_INTERFACE_H 18 19 #include <string> 20 21 #include "access_token.h" 22 #include "hap_token_info.h" 23 24 namespace OHOS { 25 namespace Security { 26 namespace AccessToken { 27 enum TokenSyncError { 28 TOKEN_SYNC_SUCCESS = 0, 29 TOKEN_SYNC_IPC_ERROR, 30 TOKEN_SYNC_PARAMS_INVALID, 31 TOKEN_SYNC_REMOTE_DEVICE_INVALID, 32 TOKEN_SYNC_COMMAND_EXECUTE_FAILED, 33 TOKEN_SYNC_OPENSOURCE_DEVICE, 34 }; 35 36 class TokenSyncKitInterface { 37 public: TokenSyncKitInterface()38 TokenSyncKitInterface() {}; ~TokenSyncKitInterface()39 virtual ~TokenSyncKitInterface() {}; 40 virtual int32_t GetRemoteHapTokenInfo(const std::string& deviceID, AccessTokenID tokenID) const = 0; 41 virtual int32_t DeleteRemoteHapTokenInfo(AccessTokenID tokenID) const = 0; 42 virtual int32_t UpdateRemoteHapTokenInfo(const HapTokenInfoForSync& tokenInfo) const = 0; 43 }; 44 } // namespace AccessToken 45 } // namespace Security 46 } // namespace OHOS 47 #endif // ACCESSTOKEN_SYNC_KIT_INTERFACE_H