1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/ascredentialidentitystoreerrordomain?language=objc)
pub static ASCredentialIdentityStoreErrorDomain: &'static NSErrorDomain;
}
/// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/ascredentialidentitystoreerrorcode?language=objc)
// NS_ERROR_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ASCredentialIdentityStoreErrorCode(pub NSInteger);
impl ASCredentialIdentityStoreErrorCode {
#[doc(alias = "ASCredentialIdentityStoreErrorCodeInternalError")]
pub const InternalError: Self = Self(0);
#[doc(alias = "ASCredentialIdentityStoreErrorCodeStoreDisabled")]
pub const StoreDisabled: Self = Self(1);
#[doc(alias = "ASCredentialIdentityStoreErrorCodeStoreBusy")]
pub const StoreBusy: Self = Self(2);
}
unsafe impl Encode for ASCredentialIdentityStoreErrorCode {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for ASCredentialIdentityStoreErrorCode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
/// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/ascredentialidentitytypes?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ASCredentialIdentityTypes(pub NSUInteger);
bitflags::bitflags! {
impl ASCredentialIdentityTypes: NSUInteger {
#[doc(alias = "ASCredentialIdentityTypesAll")]
const All = 0;
#[doc(alias = "ASCredentialIdentityTypesPassword")]
const Password = 1;
#[doc(alias = "ASCredentialIdentityTypesPasskey")]
const Passkey = 1<<1;
#[doc(alias = "ASCredentialIdentityTypesOneTimeCode")]
const OneTimeCode = 1<<2;
}
}
unsafe impl Encode for ASCredentialIdentityTypes {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for ASCredentialIdentityTypes {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/ascredentialidentitystore?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct ASCredentialIdentityStore;
);
extern_conformance!(
unsafe impl NSObjectProtocol for ASCredentialIdentityStore {}
);
impl ASCredentialIdentityStore {
extern_methods!(
#[unsafe(method(sharedStore))]
#[unsafe(method_family = none)]
pub unsafe fn sharedStore() -> Retained<ASCredentialIdentityStore>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(all(feature = "ASCredentialIdentityStoreState", feature = "block2"))]
/// Get the state of the credential identity store.
///
/// Parameter `completion`: completion handler to be called with the current state of the store.
///
/// Call this method to find out the current state of the store before attempting to call other store methods.
/// Use the provided ASCredentialIdentityStoreState to find out if the store is enabled and whether it supports incremental
/// updates.
#[unsafe(method(getCredentialIdentityStoreStateWithCompletion:))]
#[unsafe(method_family = none)]
pub unsafe fn getCredentialIdentityStoreStateWithCompletion(
&self,
completion: &block2::DynBlock<dyn Fn(NonNull<ASCredentialIdentityStoreState>)>,
);
#[cfg(all(
feature = "ASCredentialIdentity",
feature = "ASCredentialServiceIdentifier",
feature = "block2"
))]
/// List the currently saved credential identities.
///
/// Parameter `serviceIdentifier`: Specify a service identifier to get only credential identities for that service.
/// Pass nil to get credential identities for all services.
///
/// Parameter `credentialIdentityTypes`: Specify one or more types to get only credential identities of those types.
/// Pass ASCredentialIdentityTypesAll to get credential identities of all types.
///
/// Call this method to get a list of all credential identities saved in the store for your extension.
#[unsafe(method(getCredentialIdentitiesForService:credentialIdentityTypes:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn getCredentialIdentitiesForService_credentialIdentityTypes_completionHandler(
&self,
service_identifier: Option<&ASCredentialServiceIdentifier>,
credential_identity_types: ASCredentialIdentityTypes,
completion_handler: &block2::DynBlock<
dyn Fn(NonNull<NSArray<ProtocolObject<dyn ASCredentialIdentity>>>),
>,
);
#[cfg(all(feature = "ASPasswordCredentialIdentity", feature = "block2"))]
/// Save the given credential identities to the store.
///
/// Parameter `credentialIdentities`: array of ASPasswordCredentialIdentity objects to save to the store.
///
/// Parameter `completion`: optional completion handler to be called after adding the credential identities.
/// If the operation fails, an error with domain ASCredentialIdentityStoreErrorDomain will be provided
/// and none of the objects in credentialIdentities will be saved to the store.
///
/// If the store supports incremental updates, call this method to add new credential
/// identities since the last time the store was updated. Otherwise, call this method to pass all credential
/// identities.
/// If some credential identities in credentialIdentities already exist in the store, they will be replaced by
/// those from credentialIdentities.
#[deprecated]
#[unsafe(method(saveCredentialIdentities:completion:))]
#[unsafe(method_family = none)]
pub unsafe fn saveCredentialIdentities_completion(
&self,
credential_identities: &NSArray<ASPasswordCredentialIdentity>,
completion: Option<&block2::DynBlock<dyn Fn(Bool, *mut NSError)>>,
);
#[cfg(all(feature = "ASCredentialIdentity", feature = "block2"))]
/// Save the given credential identities to the store.
///
/// Parameter `credentialIdentities`: array of ASCredentialIdentity objects to save to the store.
///
/// Parameter `completion`: optional completion handler to be called after adding the credential identities.
/// If the operation fails, an error with domain ASCredentialIdentityStoreErrorDomain will be provided
/// and none of the objects in credentialIdentities will be saved to the store.
///
/// If the store supports incremental updates, call this method to add new credential
/// identities since the last time the store was updated. Otherwise, call this method to pass all credential
/// identities.
/// If some credential identities in credentialIdentities already exist in the store, they will be replaced by
/// those from credentialIdentities.
#[unsafe(method(saveCredentialIdentityEntries:completion:))]
#[unsafe(method_family = none)]
pub unsafe fn saveCredentialIdentityEntries_completion(
&self,
credential_identities: &NSArray<ProtocolObject<dyn ASCredentialIdentity>>,
completion: Option<&block2::DynBlock<dyn Fn(Bool, *mut NSError)>>,
);
#[cfg(all(feature = "ASPasswordCredentialIdentity", feature = "block2"))]
/// Remove the given credential identities from the store.
///
/// Parameter `credentialIdentities`: array of ASPasswordCredentialIdentity objects to remove from the store.
///
/// Parameter `completion`: optional completion handler to be called after removing the credential identities.
/// If the operation fails, an error with domain ASCredentialIdentityStoreErrorDomain will be provided
/// and none of the objects in credentialIdentities will be removed from the store.
///
/// Use this method only if the store supports incremental updates to remove previously added
/// credentials to the store.
#[deprecated]
#[unsafe(method(removeCredentialIdentities:completion:))]
#[unsafe(method_family = none)]
pub unsafe fn removeCredentialIdentities_completion(
&self,
credential_identities: &NSArray<ASPasswordCredentialIdentity>,
completion: Option<&block2::DynBlock<dyn Fn(Bool, *mut NSError)>>,
);
#[cfg(all(feature = "ASCredentialIdentity", feature = "block2"))]
/// Remove the given credential identities from the store.
///
/// Parameter `credentialIdentities`: array of ASCredentialIdentity objects to remove from the store.
///
/// Parameter `completion`: optional completion handler to be called after removing the credential identities.
/// If the operation fails, an error with domain ASCredentialIdentityStoreErrorDomain will be provided
/// and none of the objects in credentialIdentities will be removed from the store.
///
/// Use this method only if the store supports incremental updates to remove previously added
/// credentials to the store.
#[unsafe(method(removeCredentialIdentityEntries:completion:))]
#[unsafe(method_family = none)]
pub unsafe fn removeCredentialIdentityEntries_completion(
&self,
credential_identities: &NSArray<ProtocolObject<dyn ASCredentialIdentity>>,
completion: Option<&block2::DynBlock<dyn Fn(Bool, *mut NSError)>>,
);
#[cfg(feature = "block2")]
/// Remove all existing credential identities from the store.
///
/// Parameter `completion`: optional completion handler to be called after removing all existing credential identities.
/// If the operation fails, an error with domain ASCredentialIdentityStoreErrorDomain will be provided and none of
/// the existing credential identities will be removed from the store.
#[unsafe(method(removeAllCredentialIdentitiesWithCompletion:))]
#[unsafe(method_family = none)]
pub unsafe fn removeAllCredentialIdentitiesWithCompletion(
&self,
completion: Option<&block2::DynBlock<dyn Fn(Bool, *mut NSError)>>,
);
#[cfg(all(feature = "ASPasswordCredentialIdentity", feature = "block2"))]
/// Replace existing credential identities with new credential identities.
///
/// Parameter `newCredentialIdentities`: array of new credential identity objects to replace the old ones.
///
/// Parameter `completion`: an optional completion block to be called after the operation is finished.
///
/// This method will delete all existing credential identities that are persisted in the
/// store and replace them with the provided array of credential identities. If the operation fails, an
/// error with domain ASCredentialIdentityStoreErrorDomain will be provided and none of the new credential
/// identities will be saved.
#[deprecated]
#[unsafe(method(replaceCredentialIdentitiesWithIdentities:completion:))]
#[unsafe(method_family = none)]
pub unsafe fn replaceCredentialIdentitiesWithIdentities_completion(
&self,
new_credential_identities: &NSArray<ASPasswordCredentialIdentity>,
completion: Option<&block2::DynBlock<dyn Fn(Bool, *mut NSError)>>,
);
#[cfg(all(feature = "ASCredentialIdentity", feature = "block2"))]
/// Replace existing credential identities with new credential identities.
///
/// Parameter `newCredentialIdentities`: array of new credential identity objects to replace the old ones.
///
/// Parameter `completion`: an optional completion block to be called after the operation is finished.
///
/// This method will delete all existing credential identities that are persisted in the
/// store and replace them with the provided array of credential identities. If the operation fails, an
/// error with domain ASCredentialIdentityStoreErrorDomain will be provided and none of the new credential
/// identities will be saved.
#[unsafe(method(replaceCredentialIdentityEntries:completion:))]
#[unsafe(method_family = none)]
pub unsafe fn replaceCredentialIdentityEntries_completion(
&self,
new_credential_identities: &NSArray<ProtocolObject<dyn ASCredentialIdentity>>,
completion: Option<&block2::DynBlock<dyn Fn(Bool, *mut NSError)>>,
);
);
}
/// Methods declared on superclass `NSObject`.
impl ASCredentialIdentityStore {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}