1 /* 2 * Copyright (c) 2022-2023 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_interface_ipc_interface_code.h" 28 #include "widget_callback_interface.h" 29 30 namespace OHOS { 31 namespace UserIam { 32 namespace UserAuth { 33 class UserAuthInterface : public IRemoteBroker { 34 public: 35 virtual int32_t GetAvailableStatus(int32_t apiVersion, AuthType authType, AuthTrustLevel authTrustLevel) = 0; 36 37 virtual void GetProperty(int32_t userId, AuthType authType, 38 const std::vector<Attributes::AttributeKey> &keys, sptr<GetExecutorPropertyCallbackInterface> &callback) = 0; 39 40 virtual void SetProperty(int32_t userId, AuthType authType, const Attributes &attributes, 41 sptr<SetExecutorPropertyCallbackInterface> &callback) = 0; 42 43 virtual uint64_t AuthUser(int32_t userId, const std::vector<uint8_t> &challenge, AuthType authType, 44 AuthTrustLevel authTrustLevel, sptr<UserAuthCallbackInterface> &callback) = 0; 45 46 virtual uint64_t Auth(int32_t apiVersion, const std::vector<uint8_t> &challenge, AuthType authType, 47 AuthTrustLevel authTrustLevel, sptr<UserAuthCallbackInterface> &callback) = 0; 48 49 virtual uint64_t AuthWidget(int32_t apiVersion, const AuthParam &authParam, 50 const WidgetParam &widgetParam, sptr<UserAuthCallbackInterface> &callback) = 0; 51 52 virtual uint64_t Identify(const std::vector<uint8_t> &challenge, AuthType authType, 53 sptr<UserAuthCallbackInterface> &callback) = 0; 54 55 virtual int32_t CancelAuthOrIdentify(uint64_t contextId) = 0; 56 57 virtual int32_t GetVersion(int32_t &version) = 0; 58 59 virtual int32_t Notice(NoticeType noticeType, const std::string &eventData) = 0; 60 61 virtual int32_t RegisterWidgetCallback(int32_t version, sptr<WidgetCallbackInterface> &callback) = 0; 62 63 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.UserIam.UserAuth.IUserAuth"); 64 }; 65 } // namespace UserAuth 66 } // namespace UserIam 67 } // namespace OHOS 68 #endif // USER_AUTH_INTERFACE_H