• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2025 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 STORAGE_MANAGER_CILENT_H
17 #define STORAGE_MANAGER_CILENT_H
18 
19 #include "storage_manager_proxy.h"
20 #include "iuece_activation_callback.h"
21 
22 namespace OHOS {
23 namespace StorageManager {
24 class StorageManagerClient {
25 public:
26     static int32_t PrepareAddUser(uint32_t userId, uint32_t flags);
27     static int32_t RemoveUser(uint32_t userId, uint32_t flags);
28     static int32_t GenerateUserKeys(uint32_t userId, uint32_t flags);
29     static int32_t DeleteUserKeys(uint32_t userId);
30     static int32_t UpdateUserAuth(uint32_t userId, uint64_t secureUid,
31                                   const std::vector<uint8_t> &token,
32                                   const std::vector<uint8_t> &oldSecret,
33                                   const std::vector<uint8_t> &newSecret);
34     static int32_t UpdateUseAuthWithRecoveryKey(const std::vector<uint8_t> &authToken,
35                                                 const std::vector<uint8_t> &newSecret,
36                                                 uint64_t secureUid,
37                                                 uint32_t userId,
38                                                 const std::vector<std::vector<uint8_t>> &plainText);
39     static int32_t ActiveUserKey(uint32_t userId,
40                                  const std::vector<uint8_t> &token,
41                                  const std::vector<uint8_t> &secret);
42     static int32_t InactiveUserKey(uint32_t userId);
43     static int32_t UpdateKeyContext(uint32_t userId, bool needRemoveTmpKey = false);
44     static int32_t LockUserScreen(uint32_t userId);
45     static int32_t UnlockUserScreen(uint32_t userId,
46                                     const std::vector<uint8_t> &token,
47                                     const std::vector<uint8_t> &secret);
48     static int32_t GetLockScreenStatus(uint32_t userId, bool &lockScreenStatus);
49     static int32_t MountDfsDocs(int32_t userId, const std::string &relativePath,
50         const std::string &networkId, const std::string &deviceId);
51     static int32_t UMountDfsDocs(int32_t userId, const std::string &relativePath,
52         const std::string &networkId, const std::string &deviceId);
53     static int32_t GetFileEncryptStatus(uint32_t userId, bool &isEncrypted, bool needCheckDirMount = false);
54     static int32_t GetUserNeedActiveStatus(uint32_t userId, bool &needActive);
55     static int32_t RegisterUeceActivationCallback(const sptr<StorageManager::IUeceActivationCallback> &ueceCallback);
56     static int32_t UnregisterUeceActivationCallback();
57 private:
58     static sptr<IStorageManager> GetStorageManagerProxy(void);
59 };
60 }
61 }
62 #endif
63