• 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 USER_IDM_CALLBACK_INTERFACE_H
17 #define USER_IDM_CALLBACK_INTERFACE_H
18 
19 #include <optional>
20 
21 #include "iremote_broker.h"
22 
23 #include "attributes.h"
24 #include "iam_common_defines.h"
25 #include "iam_callback_interface.h"
26 
27 namespace OHOS {
28 namespace UserIam {
29 namespace UserAuth {
30 class IdmGetCredInfoCallbackInterface : public IRemoteBroker {
31 public:
32     enum {
33         ON_GET_INFO = 0,
34     };
35     class CredentialInfo {
36     public:
37         virtual ~CredentialInfo() = default;
38         virtual uint64_t GetCredentialId() const = 0;
39         virtual int32_t GetUserId() const = 0;
40         virtual uint64_t GetExecutorIndex() const = 0;
41         virtual uint64_t GetTemplateId() const = 0;
42         virtual AuthType GetAuthType() const = 0;
43         virtual uint32_t GetExecutorSensorHint() const = 0;
44         virtual uint32_t GetExecutorMatcher() const = 0;
45     };
46     /*
47      * return all registered credential information.
48      */
49     virtual void OnCredentialInfos(const std::vector<std::shared_ptr<CredentialInfo>> infoList,
50         const std::optional<PinSubType> pinSubType) = 0;
51 
52     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.useridm.IGetInfoCallback");
53 };
54 
55 class IdmGetSecureUserInfoCallbackInterface : public IRemoteBroker {
56 public:
57     enum {
58         ON_GET_SEC_INFO = 0,
59     };
60     class EnrolledInfo {
61     public:
62         virtual ~EnrolledInfo() = default;
63         virtual AuthType GetAuthType() const = 0;
64         virtual int32_t GetUserId() const = 0;
65         virtual uint64_t GetEnrolledId() const = 0;
66     };
67 
68     class SecureUserInfo {
69     public:
70         virtual ~SecureUserInfo() = default;
71         virtual int32_t GetUserId() const = 0;
72         virtual PinSubType GetPinSubType() const = 0;
73         virtual uint64_t GetSecUserId() const = 0;
74         virtual std::vector<std::shared_ptr<EnrolledInfo>> GetEnrolledInfo() const = 0;
75     };
76     /*
77      * return all registered security information.
78      */
79     virtual void OnSecureUserInfo(const std::shared_ptr<SecureUserInfo> info) = 0;
80 
81     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.useridm.IGetSecInfoCallback");
82 };
83 
84 class IdmCallbackInterface : public IamCallbackInterface {
85 public:
86     enum {
87         IDM_CALLBACK_ON_RESULT = 0,
88         IDM_CALLBACK_ON_ACQUIRE_INFO,
89     };
90 
91     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.useridm.IIDMCallback");
92 };
93 } // namespace UserAuth
94 } // namespace UserIam
95 } // namespace OHOS
96 #endif // USER_IDM_CALLBACK_INTERFACE_H