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 #include "constant_common.h" 16 #include "constant.h" 17 18 namespace OHOS { 19 namespace Security { 20 namespace AccessToken { 21 namespace { 22 static const std::string REPLACE_TARGET = "****"; 23 } // namespace 24 const std::string Constant::COMMAND_RESULT_SUCCESS = "success"; 25 const std::string Constant::COMMAND_RESULT_FAILED = "execute command failed"; 26 27 const int32_t Constant::SUCCESS; 28 const int32_t Constant::FAILURE; 29 const int32_t Constant::FAILURE_BUT_CAN_RETRY; 30 const int32_t Constant::INVALID_COMMAND; 31 const int32_t Constant::STATUS_CODE_BEFORE_RPC; 32 EncryptDevId(std::string deviceId)33std::string ConstantCommon::EncryptDevId(std::string deviceId) 34 { 35 std::string result = deviceId; 36 if (deviceId.size() > MINDEVICEIDLEN) { 37 result.replace(ENCRYPTBEGIN + ENCRYPTLEN, deviceId.size() - MINDEVICEIDLEN, REPLACE_TARGET); 38 } else { 39 result.replace(ENCRYPTBEGIN, deviceId.size(), REPLACE_TARGET); 40 } 41 return result; 42 } 43 GetLocalDeviceId()44std::string ConstantCommon::GetLocalDeviceId() 45 { 46 return "local:udid-001"; 47 } 48 } // namespace AccessToken 49 } // namespace Security 50 } // namespace OHOS 51