objc2_authentication_services/generated/ASCredentialProviderViewController.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(target_os = "macos")]
7use objc2_app_kit::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12#[cfg(target_os = "macos")]
13extern_conformance!(
14 unsafe impl NSCoding for ASCredentialProviderViewController {}
15);
16
17#[cfg(target_os = "macos")]
18extern_conformance!(
19 unsafe impl NSEditor for ASCredentialProviderViewController {}
20);
21
22#[cfg(target_os = "macos")]
23extern_conformance!(
24 unsafe impl NSObjectProtocol for ASCredentialProviderViewController {}
25);
26
27#[cfg(target_os = "macos")]
28extern_conformance!(
29 unsafe impl NSSeguePerforming for ASCredentialProviderViewController {}
30);
31
32#[cfg(target_os = "macos")]
33extern_conformance!(
34 unsafe impl NSUserInterfaceItemIdentification for ASCredentialProviderViewController {}
35);
36
37#[cfg(target_os = "macos")]
38impl ASCredentialProviderViewController {
39 extern_methods!(
40 #[cfg(feature = "ASCredentialProviderExtensionContext")]
41 #[unsafe(method(extensionContext))]
42 #[unsafe(method_family = none)]
43 pub unsafe fn extensionContext(&self) -> Retained<ASCredentialProviderExtensionContext>;
44
45 #[cfg(feature = "ASCredentialServiceIdentifier")]
46 /// Prepare the view controller to show a list of credentials.
47 ///
48 /// Parameter `serviceIdentifiers`: the array of service identifiers.
49 ///
50 /// This method is called by the system to prepare the extension's view controller to present the list of credentials.
51 /// A service identifier array is passed which can be used to filter or prioritize the credentials that closely match each service.
52 /// The service identifier array could have zero or more items. If there are more than one item in the array, items with lower indexes
53 /// represent more specific identifiers for which a credential is being requested. For example, the array could contain identifiers
54 /// [m.example.com, example.com] with the first item representing the more specifc service that requires a credential.
55 /// If the array of service identifiers is empty, it is expected that the credential list should still show credentials that the user can pick from.
56 #[unsafe(method(prepareCredentialListForServiceIdentifiers:))]
57 #[unsafe(method_family = none)]
58 pub unsafe fn prepareCredentialListForServiceIdentifiers(
59 &self,
60 service_identifiers: &NSArray<ASCredentialServiceIdentifier>,
61 );
62
63 #[cfg(all(
64 feature = "ASCredentialServiceIdentifier",
65 feature = "ASPasskeyCredentialRequestParameters"
66 ))]
67 /// Prepare the view controller to show a list of passkey and password credentials.
68 ///
69 /// Parameter `serviceIdentifiers`: the array of service identifiers.
70 ///
71 /// Parameter `requestParameters`: the parameters of the active passkey request.
72 ///
73 /// This method is called by the system to prepare the extension's view controller to present the list of credentials.
74 /// A service identifier array is passed which can be used to filter or prioritize the credentials that closely match each service.
75 /// The service identifier array could have zero or more items. If there is more than one item in the array, items with lower indexes
76 /// represent more specific identifiers for which a credential is being requested. For example, the array could contain identifiers
77 /// [m.example.com, example.com] with the first item representing the more specifc service that requires a credential.
78 /// If the array of service identifiers is empty, it is expected that the credential list should still show credentials that the user can pick from.
79 /// If a passkey credential is selected, the extension should use the requestParameters object to complete the request using the selected
80 /// passkey credential.
81 #[unsafe(method(prepareCredentialListForServiceIdentifiers:requestParameters:))]
82 #[unsafe(method_family = none)]
83 pub unsafe fn prepareCredentialListForServiceIdentifiers_requestParameters(
84 &self,
85 service_identifiers: &NSArray<ASCredentialServiceIdentifier>,
86 request_parameters: &ASPasskeyCredentialRequestParameters,
87 );
88
89 #[cfg(feature = "ASCredentialServiceIdentifier")]
90 /// Prepare the view controller to show a list of one time code credentials.
91 ///
92 /// Parameter `serviceIdentifiers`: the array of service identifiers.
93 ///
94 /// This method is called by the system to prepare the extension's view controller to present the list of credentials.
95 /// A service identifier array is passed which can be used to filter or prioritize the credentials that closely match each service.
96 /// The service identifier array could have zero or more items. If there is more than one item in the array, items with lower indexes
97 /// represent more specific identifiers for which a credential is being requested. For example, the array could contain identifiers
98 /// [m.example.com, example.com] with the first item representing the more specifc service that requires a credential.
99 /// If the array of service identifiers is empty, it is expected that the credential list should still show credentials that the user can pick from.
100 #[unsafe(method(prepareOneTimeCodeCredentialListForServiceIdentifiers:))]
101 #[unsafe(method_family = none)]
102 pub unsafe fn prepareOneTimeCodeCredentialListForServiceIdentifiers(
103 &self,
104 service_identifiers: &NSArray<ASCredentialServiceIdentifier>,
105 );
106
107 #[cfg(feature = "ASPasswordCredentialIdentity")]
108 /// Attempt to provide the user-requested credential without any user interaction.
109 ///
110 /// Parameter `credentialIdentity`: the credential identity for which a credential should be provided.
111 ///
112 /// After the user selects a credential identity, the system may ask your extension to provide the credential without showing any
113 /// user interface if possible to enhance the user experience. If your extension can accomplish this (for example, the user’s passwords database is
114 /// still unlocked from a recent interaction), call -[ASCredentialProviderExtensionContext completeRequestWithSelectedCredential:completionHandler:]
115 /// to provide the credential.
116 /// If an error occurs, call -[ASCredentialProviderExtensionContext cancelRequestWithError:] and pass an error with domain
117 /// ASExtensionErrorDomain and an appropriate error code from ASExtensionErrorCode. For example, if your extension requires user interaction
118 /// because the passwords database needs to be unlocked, pass an error with code ASExtensionErrorCodeUserInteractionRequired.
119 ///
120 /// Note: When this method is called, your extension's view controller is not present on the screen. Do not attempt or expect to show any user
121 /// interface in this method.
122 #[deprecated]
123 #[unsafe(method(provideCredentialWithoutUserInteractionForIdentity:))]
124 #[unsafe(method_family = none)]
125 pub unsafe fn provideCredentialWithoutUserInteractionForIdentity(
126 &self,
127 credential_identity: &ASPasswordCredentialIdentity,
128 );
129
130 #[cfg(feature = "ASCredentialRequest")]
131 /// Attempt to provide the user-requested credential without any user interaction.
132 ///
133 /// After the user selects a credential identity, the system will create a credential request, the contents of
134 /// which will depend on whether the credential to use is a password or passkey. The request type will match
135 /// the type of credential that was requested. Refer to `ASPasswordCredentialRequest`,
136 /// `ASPasskeyCredentialRequest`, and `ASOneTimeCodeCredentialRequest` for details.
137 ///
138 /// The system may ask your extension to provide the credential without showing any user interface if possible
139 /// to enhance the user experience. If your extension can accomplish this (for example, the user’s passwords
140 /// database is still unlocked from a recent interaction), call `-[ASCredentialProviderExtensionContext completeRequestWithSelectedCredential:completionHandler:]`
141 /// for password credentials, `-[ASCredentialProviderExtensionContext completeAssertionRequestWithSelectedPasskeyCredential:completionHandler:]` for passkey credentials,
142 /// or `-[ASCredentialProviderExtensionContext completeOneTimeCodeRequestWithSelectedCredential:completionHandler:]` for one time code credentials.
143 /// If an error occurs, call `-[ASCredentialProviderExtensionContext cancelRequestWithError:]`
144 /// and pass an error with domain `ASExtensionErrorDomain` and an appropriate error code from
145 /// `ASExtensionErrorCode`. For example, if your extension requires user interaction because the
146 /// passwords database needs to be unlocked, pass an error with code `ASExtensionErrorCodeUserInteractionRequired`.
147 ///
148 /// In order for your extension to be presented in the list of options for passkey assertion requests, your
149 /// extension needs to specify a true value for the Information Property List key `ProvidesPasskeys`
150 /// under the `ASCredentialProviderExtensionCapabilities` dictionary.
151 ///
152 /// Info.plist
153 /// ├─ NSExtension
154 /// ├─ NSExtensionAttributes
155 /// ├─ ASCredentialProviderExtensionCapabilities
156 /// ├─ ProvidesPasskeys => true
157 ///
158 /// Similarly, your extension needs to specify a true value for the Information Property List key `ProvidesOneTimeCodes`
159 /// under the `ASCredentialProviderExtensionCapabilities` dictionary in order to be presented in
160 /// the list of options for one time code requests.
161 ///
162 /// - Note: When this method is called, your extension's view controller is not present on the screen. Do not
163 /// attempt or expect to show any user interface in this method.
164 ///
165 /// - Parameter credentialRequest: The credential request for which a credential should be provided.
166 #[unsafe(method(provideCredentialWithoutUserInteractionForRequest:))]
167 #[unsafe(method_family = none)]
168 pub unsafe fn provideCredentialWithoutUserInteractionForRequest(
169 &self,
170 credential_request: &ProtocolObject<dyn ASCredentialRequest>,
171 );
172
173 #[cfg(feature = "ASPasswordCredentialIdentity")]
174 /// Prepare the view controller to show user interface for providing the user-requested credential.
175 ///
176 /// Parameter `credentialIdentity`: the credential identity for which a credential should be provided.
177 ///
178 /// The system calls this method when your extension cannot provide the requested credential without user interaction.
179 /// Set up the view controller for any user interaction required to provide the requested credential only. The user interaction should
180 /// be limited in nature to operations required for providing the requested credential. An example is showing an authentication UI to
181 /// unlock the user's passwords database.
182 /// Call -[ASCredentialProviderExtensionContext completeRequestWithSelectedCredential:completionHandler:] to provide the credential.
183 /// If an error occurs, call -[ASCredentialProviderExtensionContext cancelRequestWithError:] and pass an error with domain
184 /// ASExtensionErrorDomain and an appropriate error code from ASExtensionErrorCode. For example, if the credential identity cannot
185 /// be found in the database, pass an error with code ASExtensionErrorCodeCredentialIdentityNotFound.
186 #[deprecated]
187 #[unsafe(method(prepareInterfaceToProvideCredentialForIdentity:))]
188 #[unsafe(method_family = none)]
189 pub unsafe fn prepareInterfaceToProvideCredentialForIdentity(
190 &self,
191 credential_identity: &ASPasswordCredentialIdentity,
192 );
193
194 #[cfg(feature = "ASCredentialRequest")]
195 /// Prepare the view controller to show user interface for providing the user-requested credential.
196 ///
197 /// Parameter `credentialRequest`: the credential request for which a credential should be provided.
198 ///
199 /// The system calls this method when your extension cannot provide the requested credential without user interaction.
200 /// Set up the view controller for any user interaction required to provide the requested credential only. The user interaction should
201 /// be limited in nature to operations required for providing the requested credential. An example is showing an authentication UI to
202 /// unlock the user's passwords database.
203 /// Call -[ASCredentialProviderExtensionContext completeRequestWithSelectedCredential:completionHandler:] for password credentials or
204 /// -[ASCredentialProviderExtensionContext completeAssertionRequestWithSelectedPasskeyCredential:completionHandler:] for passkey credentials.
205 /// If an error occurs, call -[ASCredentialProviderExtensionContext cancelRequestWithError:] and pass an error with domain
206 /// ASExtensionErrorDomain and an appropriate error code from ASExtensionErrorCode. For example, if the credential identity cannot
207 /// be found in the database, pass an error with code ASExtensionErrorCodeCredentialIdentityNotFound.
208 #[unsafe(method(prepareInterfaceToProvideCredentialForRequest:))]
209 #[unsafe(method_family = none)]
210 pub unsafe fn prepareInterfaceToProvideCredentialForRequest(
211 &self,
212 credential_request: &ProtocolObject<dyn ASCredentialRequest>,
213 );
214
215 /// Prepare the view controller to show user interface when the user enables your extension.
216 ///
217 /// The system calls this method after your extension is enabled by the user in Settings. You can
218 /// use this method to give the user a chance to configure the extension or to provide credential identities
219 /// to the system. After the configuration is done, call -[ASCredentialProviderExtensionContext completeExtensionConfigurationRequest].
220 ///
221 /// Note: This method only gets called if your extension supports this functionality by specifying
222 /// "ASCredentialProviderExtensionShowsConfigurationUI": YES in its extension attributes.
223 #[unsafe(method(prepareInterfaceForExtensionConfiguration))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn prepareInterfaceForExtensionConfiguration(&self);
226
227 #[cfg(feature = "ASCredentialRequest")]
228 /// Prepare UI to register a passkey for the specified relying party.
229 ///
230 /// The system calls this method when the user selects your extension to use for creating a passkey. In order
231 /// for your extension to be presented in the list of options for passkey registration requests, your extension
232 /// needs to specify a true value for the Information Property List key `ProvidesPasskeys` under the
233 /// `ASCredentialProviderExtensionCapabilities` dictionary.
234 ///
235 /// Info.plist
236 /// ├─ NSExtension
237 /// ├─ NSExtensionAttributes
238 /// ├─ ASCredentialProviderExtensionCapabilities
239 /// ├─ ProvidesPasskeys => true
240 ///
241 /// This method will present your extension's UI for user authentication before creating the passkey. Once the
242 /// passkey is created, your extension should call `-[ASCredentialProviderExtensionContext completeRegistrationRequestWithSelectedPasskeyCredential:completionHandler:]`
243 /// with the newly created ASPasskeyCredential object. If an error occurs, call
244 /// `-[ASCredentialProviderExtensionContext cancelRequestWithError:]` and pass an
245 /// error with domain `ASExtensionErrorDomain` and an appropriate error code from `ASExtensionErrorCode`.
246 ///
247 /// - Parameter registrationRequest: The passkey registration request parameters needed to
248 /// register a new passkey.
249 #[unsafe(method(prepareInterfaceForPasskeyRegistration:))]
250 #[unsafe(method_family = none)]
251 pub unsafe fn prepareInterfaceForPasskeyRegistration(
252 &self,
253 registration_request: &ProtocolObject<dyn ASCredentialRequest>,
254 );
255
256 #[cfg(feature = "ASPasskeyCredentialRequest")]
257 /// Perform a conditional passkey registration, if possible.
258 ///
259 /// This method will be called for handling conditional passkey registration requests. A conditional passkey registration request allows
260 /// your extension to opportunistically register passkeys in the background, if and only if you believe the user is in a good state to do
261 /// so. Your extension decides can decide what conditions make sense for whether to fulfill or reject this request. For example, an
262 /// extension may decide to register a passkey only if all of the following conditions are met:
263 /// - The user's vault is currently unlocked.
264 /// - The user name for the registration request matches that for an existing saved password.
265 /// - The matching saved password was filled recently.
266 /// - The user does not already have a passkey for this account.
267 ///
268 /// Fulfilling this request should not remove a user's saved password for this account, but it may mean that the passkey will be
269 /// preferred over the password in future AutoFill invocations, if both are supported.
270 ///
271 /// Your extension should complete this request by calling `-[ASCredentialProviderExtensionContext completeRegistrationRequestWithSelectedPasskeyCredential:completionHandler:]`
272 /// or`-[ASCredentialProviderExtensionContext cancelRequestWithError:]`, like for standard registration requests.
273 /// However, this request is not allowed to show UI and `ASExtensionErrorCodeUserInteractionRequired` will be treated
274 /// like any other error. The intent of this API is to provide a method of performing a background registration only where easy and
275 /// convenient, so no blocking UI or error should ever be shown.
276 ///
277 /// To indicate support for this feature, add `SupportsConditionalPasskeyRegistration` under the
278 /// `ASCredentialProviderExtensionCapabilities` dictionary.
279 ///
280 /// Info.plist
281 /// ├─ NSExtension
282 /// ├─ NSExtensionAttributes
283 /// ├─ ASCredentialProviderExtensionCapabilities
284 /// ├─ SupportsConditionalPasskeyRegistration => true
285 #[unsafe(method(performPasskeyRegistrationWithoutUserInteractionIfPossible:))]
286 #[unsafe(method_family = none)]
287 pub unsafe fn performPasskeyRegistrationWithoutUserInteractionIfPossible(
288 &self,
289 registration_request: &ASPasskeyCredentialRequest,
290 );
291
292 /// Receive report when a relying party indicates that a passkey's user name was updated.
293 ///
294 /// This method will be called for handling passkey updates when a relying party reports an update using the `ASCredentialUpdater` API.
295 /// This update should be handled in the background, so no blocking UI or error should ever be shown.
296 ///
297 /// - Parameter relyingParty: Relying party (website) that the crendential is saved for.
298 /// - Parameter userHandle: User identifier.
299 /// - Parameter newName: The new user name for the credential.
300 ///
301 /// To indicate support for this feature, add `SupportsCredentialUpdate` under the
302 /// `ASCredentialProviderExtensionCapabilities` dictionary.
303 ///
304 /// Info.plist
305 /// ├─ NSExtension
306 /// ├─ NSExtensionAttributes
307 /// ├─ ASCredentialProviderExtensionCapabilities
308 /// ├─ SupportsCredentialUpdate => true
309 #[unsafe(method(reportPublicKeyCredentialUpdateForRelyingParty:userHandle:newName:))]
310 #[unsafe(method_family = none)]
311 pub unsafe fn reportPublicKeyCredentialUpdateForRelyingParty_userHandle_newName(
312 &self,
313 relying_party: &NSString,
314 user_handle: &NSData,
315 new_name: &NSString,
316 );
317
318 /// Receive report when a relying party indicates an invalid passkey credential.
319 ///
320 /// This method will be called for handling passkey updates when a relying party reports the credential is no longer valid using the `ASCredentialUpdater` API.
321 /// You may hide or remove this credential.
322 /// This update should be handled in the background, so no blocking UI or error should ever be shown.
323 ///
324 /// - Parameter relyingParty: Relying party (website) that the crendential is saved for.
325 /// - Parameter credentialID: An identifier that uniquely identifies the passkey.
326 ///
327 /// To indicate support for this feature, add `SupportsCredentialUpdate` under the
328 /// `ASCredentialProviderExtensionCapabilities` dictionary.
329 ///
330 /// Info.plist
331 /// ├─ NSExtension
332 /// ├─ NSExtensionAttributes
333 /// ├─ ASCredentialProviderExtensionCapabilities
334 /// ├─ SupportsCredentialUpdate => true
335 #[unsafe(method(reportUnknownPublicKeyCredentialForRelyingParty:credentialID:))]
336 #[unsafe(method_family = none)]
337 pub unsafe fn reportUnknownPublicKeyCredentialForRelyingParty_credentialID(
338 &self,
339 relying_party: &NSString,
340 credential_id: &NSData,
341 );
342
343 /// Receive report when relying party sends a snapshot of all the accepted credentials for an account.
344 ///
345 /// This method will be called for handling passkey updates when a relying party sends a list of accepted credentials using the `ASCredentialUpdater` API.
346 /// You may hide or remove any credential not present in the accepted credentials list.
347 /// This update should be handled in the background, so no blocking UI or error should ever be shown.
348 ///
349 /// - Parameter relyingParty: Relying party (website) that the crendential is saved for.
350 /// - Parameter userHandle: User identifier.
351 /// - Parameter acceptedCredentialIDs: An array of identifiers that uniquely identifies the accepted credentials.
352 ///
353 /// To indicate support for this feature, add `SupportsCredentialUpdate` under the
354 /// `ASCredentialProviderExtensionCapabilities` dictionary.
355 ///
356 /// Info.plist
357 /// ├─ NSExtension
358 /// ├─ NSExtensionAttributes
359 /// ├─ ASCredentialProviderExtensionCapabilities
360 /// ├─ SupportsCredentialUpdate => true
361 #[unsafe(method(reportAllAcceptedPublicKeyCredentialsForRelyingParty:userHandle:acceptedCredentialIDs:))]
362 #[unsafe(method_family = none)]
363 pub unsafe fn reportAllAcceptedPublicKeyCredentialsForRelyingParty_userHandle_acceptedCredentialIDs(
364 &self,
365 relying_party: &NSString,
366 user_handle: &NSData,
367 accepted_credential_i_ds: &NSArray<NSData>,
368 );
369
370 /// Receive report when relying party indicates a password credential is no longer needed for a given user name.
371 ///
372 /// This method will be called for handling password credential updates when a relying party indicates a password is no longer needed using the `ASCredentialUpdater` API.
373 /// You may hide or remove the credential.
374 /// This update should be handled in the background, so no blocking UI or error should ever be shown.
375 ///
376 /// - Parameter domain: The website domain that the credential is saved for.
377 /// - Parameter userName: The account user name.
378 ///
379 /// To indicate support for this feature, add `SupportsCredentialUpdate` under the
380 /// `ASCredentialProviderExtensionCapabilities` dictionary.
381 ///
382 /// Info.plist
383 /// ├─ NSExtension
384 /// ├─ NSExtensionAttributes
385 /// ├─ ASCredentialProviderExtensionCapabilities
386 /// ├─ SupportsCredentialUpdate => true
387 #[unsafe(method(reportUnusedPasswordCredentialForDomain:userName:))]
388 #[unsafe(method_family = none)]
389 pub unsafe fn reportUnusedPasswordCredentialForDomain_userName(
390 &self,
391 domain: &NSString,
392 user_name: &NSString,
393 );
394 );
395}
396
397/// Methods declared on superclass `NSViewController`.
398#[cfg(target_os = "macos")]
399impl ASCredentialProviderViewController {
400 extern_methods!(
401 #[unsafe(method(initWithNibName:bundle:))]
402 #[unsafe(method_family = init)]
403 pub unsafe fn initWithNibName_bundle(
404 this: Allocated<Self>,
405 nib_name_or_nil: Option<&NSNibName>,
406 nib_bundle_or_nil: Option<&NSBundle>,
407 ) -> Retained<Self>;
408
409 /// # Safety
410 ///
411 /// `coder` possibly has further requirements.
412 #[unsafe(method(initWithCoder:))]
413 #[unsafe(method_family = init)]
414 pub unsafe fn initWithCoder(
415 this: Allocated<Self>,
416 coder: &NSCoder,
417 ) -> Option<Retained<Self>>;
418 );
419}
420
421/// Methods declared on superclass `NSResponder`.
422#[cfg(target_os = "macos")]
423impl ASCredentialProviderViewController {
424 extern_methods!(
425 #[unsafe(method(init))]
426 #[unsafe(method_family = init)]
427 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
428 );
429}
430
431/// Methods declared on superclass `NSObject`.
432#[cfg(target_os = "macos")]
433impl ASCredentialProviderViewController {
434 extern_methods!(
435 #[unsafe(method(new))]
436 #[unsafe(method_family = new)]
437 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
438 );
439}