• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 USER_IDM_CLIENT_H
17 #define USER_IDM_CLIENT_H
18 
19 #include <memory>
20 #include <optional>
21 #include <vector>
22 
23 #include "iam_common_defines.h"
24 #include "user_idm_client_callback.h"
25 #include "user_idm_client_defines.h"
26 
27 namespace OHOS {
28 namespace UserIam {
29 namespace UserAuth {
30 class UserIdmClient {
31 public:
32     static UserIdmClient &GetInstance();
33     virtual ~UserIdmClient() = default;
34 
35     virtual std::vector<uint8_t> OpenSession(int32_t userId) = 0;
36     virtual void CloseSession(int32_t userId) = 0;
37 
38     virtual void AddCredential(int32_t userId, const CredentialParameters &para,
39         const std::shared_ptr<UserIdmClientCallback> &callback) = 0;
40     virtual void UpdateCredential(int32_t userId, const CredentialParameters &para,
41         const std::shared_ptr<UserIdmClientCallback> &callback) = 0;
42     virtual int32_t Cancel(int32_t userId) = 0;
43 
44     virtual void DeleteCredential(int32_t userId, uint64_t credentialId, const std::vector<uint8_t> &authToken,
45         const std::shared_ptr<UserIdmClientCallback> &callback) = 0;
46 
47     virtual void DeleteUser(int32_t userId, const std::vector<uint8_t> &authToken,
48         const std::shared_ptr<UserIdmClientCallback> &callback) = 0;
49     virtual int32_t EraseUser(int32_t userId, const std::shared_ptr<UserIdmClientCallback> &callback) = 0;
50 
51     virtual int32_t GetCredentialInfo(int32_t userId, AuthType authType,
52         const std::shared_ptr<GetCredentialInfoCallback> &callback) = 0;
53     virtual int32_t GetSecUserInfo(int32_t userId, const std::shared_ptr<GetSecUserInfoCallback> &callback) = 0;
54 };
55 } // namespace UserAuth
56 } // namespace UserIam
57 } // namespace OHOS
58 #endif // USER_IDM_CLIENT_H