• 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 OS_ACCOUNT_INTERFACES_INNERKITS_ACCOUNT_IAM_NATIVE_INCLUDE_IACCOUNT_IAM_H
17 #define OS_ACCOUNT_INTERFACES_INNERKITS_ACCOUNT_IAM_NATIVE_INCLUDE_IACCOUNT_IAM_H
18 
19 #include "account_iam_info.h"
20 #include "iaccount_iam_callback.h"
21 #include "iremote_broker.h"
22 #include "iremote_object.h"
23 
24 namespace OHOS {
25 namespace AccountSA {
26 class IAccountIAM : public IRemoteBroker {
27 public:
28     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.accountfwk.IAccountIAM");
29 
30     virtual int32_t OpenSession(int32_t userId, std::vector<uint8_t> &challenge) = 0;
31     virtual int32_t CloseSession(int32_t userId) = 0;
32     virtual void AddCredential(
33         int32_t userId, const CredentialParameters &credInfo, const sptr<IIDMCallback> &callback) = 0;
34     virtual void UpdateCredential(int32_t userId, const CredentialParameters &credInfo,
35         const sptr<IIDMCallback> &callback) = 0;
36     virtual int32_t Cancel(int32_t userId) = 0;
37     virtual void DelCred(int32_t userId, uint64_t credentialId, const std::vector<uint8_t> &authToken,
38         const sptr<IIDMCallback> &callback) = 0;
39     virtual void DelUser(
40         int32_t userId, const std::vector<uint8_t> &authToken, const sptr<IIDMCallback> &callback) = 0;
41     virtual int32_t GetCredentialInfo(
42         int32_t userId, AuthType authType, const sptr<IGetCredInfoCallback> &callback) = 0;
43     virtual uint64_t AuthUser(int32_t userId, const std::vector<uint8_t> &challenge, AuthType authType,
44         AuthTrustLevel authTrustLevel, const sptr<IIDMCallback> &callback) = 0;
45     virtual int32_t CancelAuth(uint64_t contextId) = 0;
46     virtual int32_t GetAvailableStatus(AuthType authType, AuthTrustLevel authTrustLevel, int32_t &status) = 0;
47     virtual void GetProperty(
48         int32_t userId, const GetPropertyRequest &request, const sptr<IGetSetPropCallback> &callback) = 0;
49     virtual void SetProperty(
50         int32_t userId, const SetPropertyRequest &request, const sptr<IGetSetPropCallback> &callback) = 0;
51     virtual IAMState GetAccountState(int32_t userId) = 0;
52 
53     enum class Message {
54         OPEN_SESSION,
55         CLOSE_SESSION,
56         ADD_CREDENTIAL,
57         UPDATE_CREDENTIAL,
58         CANCEL,
59         DEL_CRED,
60         DEL_USER,
61         GET_CREDENTIAL_INFO,
62         AUTH_USER,
63         CANCEL_AUTH,
64         GET_AVAILABLE_STATUS,
65         GET_PROPERTY,
66         SET_PROPERTY,
67         GET_ACCOUNT_STATE
68     };
69 };
70 }  // namespace AccountSA
71 }  // namespace OHOS
72 #endif  // OS_ACCOUNT_INTERFACES_INNERKITS_ACCOUNT_IAM_NATIVE_INCLUDE_IACCOUNT_IAM_H
73