objc2_local_authentication/generated/LARightStore.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 /// Persistent storage for
12 /// `LARight`instances.
13 ///
14 /// See also [Apple's documentation](https://developer.apple.com/documentation/localauthentication/larightstore?language=objc)
15 #[unsafe(super(NSObject))]
16 #[derive(Debug, PartialEq, Eq, Hash)]
17 pub struct LARightStore;
18);
19
20extern_conformance!(
21 unsafe impl NSObjectProtocol for LARightStore {}
22);
23
24impl LARightStore {
25 extern_methods!(
26 /// Shared instance of
27 /// `LARightStore.`
28 #[unsafe(method(sharedStore))]
29 #[unsafe(method_family = none)]
30 pub unsafe fn sharedStore() -> Retained<LARightStore>;
31
32 #[cfg(all(feature = "LAPersistedRight", feature = "LARight", feature = "block2"))]
33 /// Fetches a right stored under the given identifier.
34 ///
35 /// Parameter `identifier`: Identifier associated with a previously stored right.
36 ///
37 /// Parameter `handler`: Completion handler with the fetched right or an error on failure.
38 ///
39 /// # Safety
40 ///
41 /// `handler` block must be sendable.
42 #[unsafe(method(rightForIdentifier:completion:))]
43 #[unsafe(method_family = none)]
44 pub unsafe fn rightForIdentifier_completion(
45 &self,
46 identifier: &NSString,
47 handler: &block2::DynBlock<dyn Fn(*mut LAPersistedRight, *mut NSError)>,
48 );
49
50 #[cfg(all(feature = "LAPersistedRight", feature = "LARight", feature = "block2"))]
51 /// Persists a right for later usage.
52 ///
53 /// Parameter `right`: `LARight`instance to store.
54 ///
55 /// Parameter `identifier`: Identifier to be associated with the right. Useful for later retrieval.
56 ///
57 /// Parameter `handler`: Completion handler with the persisted right or an error on failure.
58 ///
59 /// # Safety
60 ///
61 /// `handler` block must be sendable.
62 #[unsafe(method(saveRight:identifier:completion:))]
63 #[unsafe(method_family = none)]
64 pub unsafe fn saveRight_identifier_completion(
65 &self,
66 right: &LARight,
67 identifier: &NSString,
68 handler: &block2::DynBlock<dyn Fn(*mut LAPersistedRight, *mut NSError)>,
69 );
70
71 #[cfg(all(feature = "LAPersistedRight", feature = "LARight", feature = "block2"))]
72 /// Persists a right for later usage.
73 ///
74 /// Parameter `right`: `LARight`instance to store.
75 ///
76 /// Parameter `identifier`: Identifier to be associated with the right. Useful for later retrieval.
77 ///
78 /// Parameter `secret`: Secret data to be associated with the provided right.
79 ///
80 /// Parameter `handler`: Completion handler with the persisted right or an error on failure.
81 ///
82 /// # Safety
83 ///
84 /// `handler` block must be sendable.
85 #[unsafe(method(saveRight:identifier:secret:completion:))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn saveRight_identifier_secret_completion(
88 &self,
89 right: &LARight,
90 identifier: &NSString,
91 secret: &NSData,
92 handler: &block2::DynBlock<dyn Fn(*mut LAPersistedRight, *mut NSError)>,
93 );
94
95 #[cfg(all(feature = "LAPersistedRight", feature = "LARight", feature = "block2"))]
96 /// Removes a right from the persistent storage along with its associated resources.
97 ///
98 /// Parameter `right`: `LAPersistedRight`instance to remove.
99 ///
100 /// Parameter `handler`: Completion handler with an error on failure.
101 ///
102 /// # Safety
103 ///
104 /// `handler` block must be sendable.
105 #[unsafe(method(removeRight:completion:))]
106 #[unsafe(method_family = none)]
107 pub unsafe fn removeRight_completion(
108 &self,
109 right: &LAPersistedRight,
110 handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
111 );
112
113 #[cfg(feature = "block2")]
114 /// Removes right with provided identifier from persistant storage.
115 ///
116 /// Parameter `identifier`: Identifier of
117 /// `LAPersistedRight`instance to remove.
118 ///
119 /// Parameter `handler`: Completion handler with an error on failure.
120 ///
121 /// # Safety
122 ///
123 /// `handler` block must be sendable.
124 #[unsafe(method(removeRightForIdentifier:completion:))]
125 #[unsafe(method_family = none)]
126 pub unsafe fn removeRightForIdentifier_completion(
127 &self,
128 identifier: &NSString,
129 handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
130 );
131
132 #[cfg(feature = "block2")]
133 /// Removes all rights stored by the client
134 ///
135 /// Parameter `handler`: Completion handler with an error on failure.
136 ///
137 /// # Safety
138 ///
139 /// `handler` block must be sendable.
140 #[unsafe(method(removeAllRightsWithCompletion:))]
141 #[unsafe(method_family = none)]
142 pub unsafe fn removeAllRightsWithCompletion(
143 &self,
144 handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
145 );
146
147 /// Clients should rely on the
148 /// `shared`instance instead
149 #[unsafe(method(new))]
150 #[unsafe(method_family = new)]
151 pub unsafe fn new() -> Retained<Self>;
152
153 /// Clients should rely on the
154 /// `shared`instance instead
155 #[unsafe(method(init))]
156 #[unsafe(method_family = init)]
157 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
158 );
159}