blob: 3c3b0c24cf56d089ba4d401e15b98df04049a3f2 [file] [log] [blame]
Zachary Iqbal1f700742018-04-24 23:42:21 -07001/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.biometrics.face@1.0;
18
19import IBiometricsFaceClientCallback;
20
21// TODO(b/78538290): Update comments with state machine transitions when ready.
22// TODO(b/78537981): Update comments with callback interaction contract.
23// TODO(b/79496983): Update comments with status returns fully enumerated.
24/**
25 * The HAL interface for biometric face authentication.
26 */
27interface IBiometricsFace {
28
29 /**
30 * Sets the current client callback.
31 *
32 * Registers a user function that must receive notifications from the HAL.
33 * There is usually only one client (FaceService). This call must block
34 * if the HAL state machine is in busy state until the HAL leaves the
35 * busy state.
36 *
37 * All callback methods pass a deviceId to differentiate callback
38 * invocations in the case where multiple sensors exist.
39 *
40 * @param clientCallback The client defined callback to register.
41 * @return result, with its "value" parameter representing a "deviceId",
42 * which must be unique for a given sensor.
43 */
44 @callflow(next={"setActiveUser"})
45 @entry
46 setCallback(IBiometricsFaceClientCallback clientCallback)
47 generates (OptionalUint64 result);
48
49 /**
50 * Sets the active user, which all subsequent HAL operations are applied to.
51 *
52 * HAL service implementors must ensure that operations are restricted to
53 * the given user. Clients must not call any part of this interface, except
54 * for setCallback(), without first having set an active user. The
55 * implementation is responsible for cancelling the current operation and
56 * returning to the idle state. Calling this method with the same userId
57 * should have no effect on the state machine.
58 *
59 * @param userId A non-negative user identifier that must be unique and
60 * persistent for a given user.
61 * @param storePath filesystem path to the template storage directory.
62 */
63 @callflow(next={"authenticate", "preEnroll", "enumerate", "remove"})
64 setActiveUser(int32_t userId, string storePath) generates (Status status);
65
66 /**
67 * Begins a pre-enrollment request.
68 *
69 * Generates a unique and cryptographically secure random token used to
70 * indicate the start of an enrollment transaction. preEnroll() and
71 * postEnroll() specify a pin/pattern/password cleared time window where
72 * enrollment is allowed.
73 *
74 * preEnroll() generates a challenge which must then be wrapped by the
75 * gatekeeper after verifying a successful strong authentication attempt,
76 * which generates a Hardware Authentication Token. The challenge prevents
77 * spoofing and replay attacks and ensures that we only update a user’s face
78 * template if the operation was preceded by some kind of strong credential
79 * confirmation (e.g. device password).
80 *
81 * @return result, with its "value" parameter representing a "challenge": a
82 * unique and cryptographically secure random token.
83 */
84 @callflow(next={"enroll", "postEnroll"})
85 preEnroll() generates (OptionalUint64 result);
86
87 /**
88 * Enrolls a user's face.
89 *
90 * Note that this interface permits implementations where multiple faces can
91 * be enrolled for a single user. However, allowing multiple faces to be
92 * enrolled can be a severe security vulnerability and hence, most
93 * implementations must ensure that only a single face be enrolled at a
94 * given time. Multi-enrollment must only be used where there is a clear
95 * necessity for a shared use case, e.g. TVs or cars.
96 *
97 * Note that the Hardware Authentication Token must still be valid after
98 * this call, and must be explicitly invalidated by a call to postEnroll().
99 * This allows clients to immediately reattempt enrollment (for example, if
100 * a user wasn’t satisfied with their enrollment) without having to go
101 * through another strong authentication flow.
102 *
103 * This method triggers the IBiometricsFaceClientCallback#onEnrollResult()
104 * method.
105 *
106 * @param hat A valid Hardware Authentication Token, generated as a result
107 * of a preEnroll() challenge being wrapped by the gatekeeper after a
108 * sucessful strong authentication request.
109 * @param timeoutSec A timeout in seconds, after which this enrollment
110 * attempt is cancelled. Note that the client still needs to
111 * call postEnroll() to terminate the enrollment session.
Kevin Chyn57acf972018-08-31 15:10:03 -0700112 * @param requireAttention When set to true, requires user attention (e.g.
113 * eyes open and looking at the device) for enrollment to complete, as
114 * well as subsequent authentication. This is expected to be enabled by
115 * default to improve security and decrease falsing (unintentional face
116 * detection). This feature can be disabled at the user's request
117 * during enrollment, e.g. for accessibility reasons. When enabled,
118 * the FaceAcquiredInfo#POOR_GAZE message must be sent when the user's
119 * attention has not been established. The UI should inform the user
120 * to look at the device.
Zachary Iqbal1f700742018-04-24 23:42:21 -0700121 * @return status The status of this method call.
122 */
123 @callflow(next={"cancel", "enroll", "postEnroll", "remove"})
Kevin Chyn57acf972018-08-31 15:10:03 -0700124 enroll(vec<uint8_t> hat, uint32_t timeoutSec, bool requireAttention)
125 generates (Status status);
Zachary Iqbal1f700742018-04-24 23:42:21 -0700126
127 /**
128 * Finishes the enrollment session and invalidates the challenge generated
129 * by preEnroll().
130 *
131 * Clients must call this method once enrollment is complete, and the user's
132 * face template no longer needs to be updated.
133 *
134 * @return status The status of this method call.
135 */
136 @callflow(next={"authenticate", "setActiveUser", "enumerate", "remove"})
137 postEnroll() generates (Status status);
138
139 /**
140 * Returns an identifier associated with the current face set.
141 *
142 * The authenticator ID must change whenever a new face is enrolled. The
143 * authenticator ID must not be changed when a face is deleted. The
144 * authenticator ID must be an entropy-encoded random number which all
145 * current templates are tied to. The authenticator ID must be immutable
146 * outside of an active enrollment window to prevent replay attacks.
147 *
148 * @return result, with its value parameter representing an
149 * "authenticatorId": an identifier associated to the user's current
150 * face enrollment.
151 */
152 @callflow(next={"authenticate"})
153 getAuthenticatorId() generates (OptionalUint64 result);
154
155 /**
156 * Cancels a pending enrollment or authentication request.
157 *
158 * @return status The status of this method call.
159 */
160 @callflow(next={"authenticate", "enroll", "enumerate", "remove",
161 "setActiveUser"})
162 cancel() generates (Status status);
163
164 /**
165 * Enumerates all face templates associated with the active user.
166 *
167 * The onEnumerate() callback method is invoked once for each face template
168 * found.
169 *
170 * @return status The status of this method call.
171 */
172 @callflow(next={"remove", "enroll", "authenticate", "setActiveUser"})
173 enumerate() generates (Status status);
174
175 /**
176 * Removes a face template or all face templates associated with the active
177 * user.
178 *
179 * This method triggers the IBiometricsFaceClientCallback#onRemoved() method.
180 *
181 * @param faceId The id correpsonding to the face to be removed; or 0 if all
182 * faces are to be removed.
183 * @return status The status of this method call.
184 */
185 @callflow(next={"enumerate", "authenticate", "cancel", "getAuthenticatorId",
186 "setActiveUser"})
187 remove(uint32_t faceId) generates (Status status);
188
189 /**
190 * Authenticates the active user.
191 *
192 * An optional operationId can be specified as a token from the transaction
193 * being authorized.
194 *
195 * @param operationId A non-zero operation id associated with a crypto
196 * object instance; or 0 if not being used.
197 * @return status The status of this method call.
198 */
199 @callflow(next={"cancel", "preEnroll", "remove"})
200 authenticate(uint64_t operationId) generates (Status status);
201};