• 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 /**
17  * @file user_auth_client_callback.h
18  *
19  * @brief Callback definitions returned by user auth client.
20  * @since 3.1
21  * @version 3.2
22  */
23 
24 #ifndef USER_AUTH_CLIENT_CALLBACK_H
25 #define USER_AUTH_CLIENT_CALLBACK_H
26 
27 #include "attributes.h"
28 #include "user_auth_client_defines.h"
29 
30 namespace OHOS {
31 namespace UserIam {
32 namespace UserAuth {
33 class AuthenticationCallback {
34 public:
35     /**
36      * @brief The callback return authenticate acquire information.
37      *
38      * @param module Module of current acquire info.
39      * @param acquireInfo Acquire info needed to be pass in.
40      * @param extraInfo Other related information about authentication.
41      */
42     virtual void OnAcquireInfo(int32_t module, uint32_t acquireInfo, const Attributes &extraInfo) = 0;
43 
44     /**
45      * @brief The callback return authenticate result.
46      *
47      * @param result The result success or error code{@link ResultCode}.
48      * @param extraInfo Other related information about authentication.
49      */
50     virtual void OnResult(int32_t result, const Attributes &extraInfo) = 0;
51 };
52 
53 class IdentificationCallback {
54 public:
55     /**
56      * @brief The callback return identification acquire information.
57      *
58      * @param module Module of current acquire info.
59      * @param acquireInfo Acquire info needed to be pass in.
60      * @param extraInfo Other related information about identification.
61      */
62     virtual void OnAcquireInfo(int32_t module, uint32_t acquireInfo, const Attributes &extraInfo) = 0;
63 
64     /**
65      * @brief The callback return identification result.
66      *
67      * @param result The result success or error code{@link ResultCode}.
68      * @param extraInfo Other related information about identification.
69      */
70     virtual void OnResult(int32_t result, const Attributes &extraInfo) = 0;
71 };
72 
73 class GetPropCallback {
74 public:
75     /**
76      * @brief The callback return get property result.
77      *
78      * @param result The result success or error code{@link ResultCode}.
79      * @param extraInfo Other related information about get property.
80      */
81     virtual void OnResult(int32_t result, const Attributes &extraInfo) = 0;
82 };
83 
84 class SetPropCallback {
85 public:
86     /**
87      * @brief The callback return set property result.
88      *
89      * @param result The result success or error code{@link ResultCode}.
90      * @param extraInfo Other related information about set property.
91      */
92     virtual void OnResult(int32_t result, const Attributes &extraInfo) = 0;
93 };
94 
95 class AuthSuccessEventListener {
96 public:
97     /**
98      * @brief Notify the event of authencation success.
99      *
100      * @param userId The id of user who initiates authentication.
101      * @param authType The authentication auth type{@link AuthType}.
102      * @param callerType The caller type who initiates authentication.
103      * @param callerName The caller name who initiates authentication.
104      */
105     virtual void OnNotifyAuthSuccessEvent(int32_t userId, AuthType authType, int32_t callerType,
106         const std::string &callerName) = 0;
107 };
108 
109 class PrepareRemoteAuthCallback {
110 public:
111     /**
112      * @brief The callback return prepare remote auth result.
113      *
114      * @param result The result success or error code{@link ResultCode}.
115      */
116     virtual void OnResult(int32_t result) = 0;
117 };
118 } // namespace UserAuth
119 } // namespace UserIam
120 } // namespace OHOS
121 #endif // USER_AUTH_CLIENT_CALLBACK_H