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 USER_AUTH_INTERFACE_H 17 #define USER_AUTH_INTERFACE_H 18 19 #include <cstdint> 20 #include <optional> 21 22 #include "iremote_broker.h" 23 #include "refbase.h" 24 25 #include "attributes.h" 26 #include "user_auth_callback_interface.h" 27 #include "user_auth_client_callback.h" 28 #include "user_auth_interface_ipc_interface_code.h" 29 #include "widget_callback_interface.h" 30 31 namespace OHOS { 32 namespace UserIam { 33 namespace UserAuth { 34 class UserAuthInterface : public IRemoteBroker { 35 public: 36 virtual int32_t GetAvailableStatus(int32_t apiVersion, int32_t userId, AuthType authType, 37 AuthTrustLevel authTrustLevel) = 0; 38 39 virtual int32_t GetAvailableStatus(int32_t apiVersion, AuthType authType, AuthTrustLevel authTrustLevel) = 0; 40 41 virtual void GetProperty(int32_t userId, AuthType authType, 42 const std::vector<Attributes::AttributeKey> &keys, sptr<GetExecutorPropertyCallbackInterface> &callback) = 0; 43 44 virtual void SetProperty(int32_t userId, AuthType authType, const Attributes &attributes, 45 sptr<SetExecutorPropertyCallbackInterface> &callback) = 0; 46 47 virtual uint64_t AuthUser(AuthParamInner ¶m, std::optional<RemoteAuthParam> &remoteAuthParam, 48 sptr<UserAuthCallbackInterface> &callback) = 0; 49 50 virtual uint64_t Auth(int32_t apiVersion, const std::vector<uint8_t> &challenge, AuthType authType, 51 AuthTrustLevel authTrustLevel, sptr<UserAuthCallbackInterface> &callback) = 0; 52 53 virtual uint64_t AuthWidget(int32_t apiVersion, const AuthParamInner &authParam, 54 const WidgetParam &widgetParam, sptr<UserAuthCallbackInterface> &callback) = 0; 55 56 virtual uint64_t Identify(const std::vector<uint8_t> &challenge, AuthType authType, 57 sptr<UserAuthCallbackInterface> &callback) = 0; 58 59 virtual int32_t CancelAuthOrIdentify(uint64_t contextId) = 0; 60 61 virtual int32_t GetVersion(int32_t &version) = 0; 62 63 virtual int32_t Notice(NoticeType noticeType, const std::string &eventData) = 0; 64 65 virtual int32_t RegisterWidgetCallback(int32_t version, sptr<WidgetCallbackInterface> &callback) = 0; 66 67 virtual int32_t GetEnrolledState(int32_t apiVersion, AuthType authType, EnrolledState &enrolledState) = 0; 68 69 virtual int32_t RegistUserAuthSuccessEventListener(const std::vector<AuthType> &authType, 70 const sptr<AuthEventListenerInterface> &listener) = 0; 71 72 virtual int32_t UnRegistUserAuthSuccessEventListener( 73 const sptr<AuthEventListenerInterface> &listener) = 0; 74 75 virtual int32_t SetGlobalConfigParam(const GlobalConfigParam ¶m) = 0; 76 77 virtual int32_t PrepareRemoteAuth(const std::string &networkId, sptr<UserAuthCallbackInterface> &callback) = 0; 78 79 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.UserIam.UserAuth.IUserAuth"); 80 }; 81 } // namespace UserAuth 82 } // namespace UserIam 83 } // namespace OHOS 84 #endif // USER_AUTH_INTERFACE_H