• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "include/security_manager_mock.h"
16 
17 namespace OHOS::DistributedKv {
SecurityManager()18 SecurityManager::SecurityManager() { }
19 
~SecurityManager()20 SecurityManager::~SecurityManager() { }
21 
SaveDBPassword(const std::string & name,const std::string & path,const DistributedDB::CipherPassword & key)22 bool SecurityManager::SaveDBPassword(
23     const std::string &name, const std::string &path, const DistributedDB::CipherPassword &key)
24 {
25     if (BSecurityManager::securityManager == nullptr) {
26         return false;
27     }
28     return BSecurityManager::securityManager->SaveDBPassword(name, path, key);
29 }
30 
GetInstance()31 SecurityManager &SecurityManager::GetInstance()
32 {
33     static SecurityManager instance;
34     return instance;
35 }
36 
GetDBPassword(const std::string & name,const std::string & path,bool needCreate)37 SecurityManager::DBPassword SecurityManager::GetDBPassword(
38     const std::string &name, const std::string &path, bool needCreate)
39 {
40     if (BSecurityManager::securityManager == nullptr) {
41         SecurityManager::DBPassword dbPassword;
42         return dbPassword;
43     }
44     return BSecurityManager::securityManager->GetDBPassword(name, path, needCreate);
45 }
46 
DelDBPassword(const std::string & name,const std::string & path)47 void SecurityManager::DelDBPassword(const std::string &name, const std::string &path)
48 {
49 }
50 } // namespace OHOS::DistributedKv