1 /*
2  * Copyright (c) 2022-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 
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 "accountmgr_service_ipc_interface_code.h"
20 #include "account_iam_info.h"
21 #include "iaccount_iam_callback.h"
22 #include "iremote_broker.h"
23 #include "iremote_object.h"
24 
25 namespace OHOS {
26 namespace AccountSA {
27 class IAccountIAM : public IRemoteBroker {
28 public:
29     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.accountfwk.IAccountIAM");
30 
31     virtual int32_t OpenSession(int32_t userId, std::vector<uint8_t> &challenge) = 0;
32     virtual int32_t CloseSession(int32_t userId) = 0;
33     virtual void AddCredential(
34         int32_t userId, const CredentialParameters &credInfo, const sptr<IIDMCallback> &callback) = 0;
35     virtual void UpdateCredential(int32_t userId, const CredentialParameters &credInfo,
36         const sptr<IIDMCallback> &callback) = 0;
37     virtual int32_t Cancel(int32_t userId) = 0;
38     virtual void DelCred(int32_t userId, uint64_t credentialId, const std::vector<uint8_t> &authToken,
39         const sptr<IIDMCallback> &callback) = 0;
40     virtual void DelUser(
41         int32_t userId, const std::vector<uint8_t> &authToken, const sptr<IIDMCallback> &callback) = 0;
42     virtual int32_t GetCredentialInfo(
43         int32_t userId, AuthType authType, const sptr<IGetCredInfoCallback> &callback) = 0;
44     virtual int32_t PrepareRemoteAuth(
45         const std::string &remoteNetworkId, const sptr<IPreRemoteAuthCallback> &callback) = 0;
46     virtual int32_t AuthUser(AuthParam &authParam, const sptr<IIDMCallback> &callback, uint64_t &contextId) = 0;
47     virtual int32_t CancelAuth(uint64_t contextId) = 0;
48     virtual int32_t GetAvailableStatus(AuthType authType, AuthTrustLevel authTrustLevel, int32_t &status) = 0;
49     virtual void GetProperty(
50         int32_t userId, const GetPropertyRequest &request, const sptr<IGetSetPropCallback> &callback) = 0;
51     virtual void GetPropertyByCredentialId(uint64_t credentialId,
52         std::vector<Attributes::AttributeKey> &keys, const sptr<IGetSetPropCallback> &callback) = 0;
53     virtual void SetProperty(
54         int32_t userId, const SetPropertyRequest &request, const sptr<IGetSetPropCallback> &callback) = 0;
55     virtual void GetEnrolledId(
56         int32_t accountId, AuthType authType, const sptr<IGetEnrolledIdCallback> &callback) = 0;
57     virtual IAMState GetAccountState(int32_t userId) = 0;
58 };
59 }  // namespace AccountSA
60 }  // namespace OHOS
61 #endif  // OS_ACCOUNT_INTERFACES_INNERKITS_ACCOUNT_IAM_NATIVE_INCLUDE_IACCOUNT_IAM_H
62