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}
293
294/// Methods declared on superclass `NSViewController`.
295#[cfg(target_os = "macos")]
296impl ASCredentialProviderViewController {
297 extern_methods!(
298 #[unsafe(method(initWithNibName:bundle:))]
299 #[unsafe(method_family = init)]
300 pub unsafe fn initWithNibName_bundle(
301 this: Allocated<Self>,
302 nib_name_or_nil: Option<&NSNibName>,
303 nib_bundle_or_nil: Option<&NSBundle>,
304 ) -> Retained<Self>;
305
306 #[unsafe(method(initWithCoder:))]
307 #[unsafe(method_family = init)]
308 pub unsafe fn initWithCoder(
309 this: Allocated<Self>,
310 coder: &NSCoder,
311 ) -> Option<Retained<Self>>;
312 );
313}
314
315/// Methods declared on superclass `NSResponder`.
316#[cfg(target_os = "macos")]
317impl ASCredentialProviderViewController {
318 extern_methods!(
319 #[unsafe(method(init))]
320 #[unsafe(method_family = init)]
321 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
322 );
323}
324
325/// Methods declared on superclass `NSObject`.
326#[cfg(target_os = "macos")]
327impl ASCredentialProviderViewController {
328 extern_methods!(
329 #[unsafe(method(new))]
330 #[unsafe(method_family = new)]
331 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
332 );
333}