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 #[unsafe(method(rightForIdentifier:completion:))]
39 #[unsafe(method_family = none)]
40 pub unsafe fn rightForIdentifier_completion(
41 &self,
42 identifier: &NSString,
43 handler: &block2::DynBlock<dyn Fn(*mut LAPersistedRight, *mut NSError)>,
44 );
45
46 #[cfg(all(feature = "LAPersistedRight", feature = "LARight", feature = "block2"))]
47 /// Persists a right for later usage.
48 ///
49 /// Parameter `right`: `LARight`instance to store.
50 ///
51 /// Parameter `identifier`: Identifier to be associated with the right. Useful for later retrieval.
52 ///
53 /// Parameter `handler`: Completion handler with the persisted right or an error on failure.
54 #[unsafe(method(saveRight:identifier:completion:))]
55 #[unsafe(method_family = none)]
56 pub unsafe fn saveRight_identifier_completion(
57 &self,
58 right: &LARight,
59 identifier: &NSString,
60 handler: &block2::DynBlock<dyn Fn(*mut LAPersistedRight, *mut NSError)>,
61 );
62
63 #[cfg(all(feature = "LAPersistedRight", feature = "LARight", feature = "block2"))]
64 /// Persists a right for later usage.
65 ///
66 /// Parameter `right`: `LARight`instance to store.
67 ///
68 /// Parameter `identifier`: Identifier to be associated with the right. Useful for later retrieval.
69 ///
70 /// Parameter `secret`: Secret data to be associated with the provided right.
71 ///
72 /// Parameter `handler`: Completion handler with the persisted right or an error on failure.
73 #[unsafe(method(saveRight:identifier:secret:completion:))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn saveRight_identifier_secret_completion(
76 &self,
77 right: &LARight,
78 identifier: &NSString,
79 secret: &NSData,
80 handler: &block2::DynBlock<dyn Fn(*mut LAPersistedRight, *mut NSError)>,
81 );
82
83 #[cfg(all(feature = "LAPersistedRight", feature = "LARight", feature = "block2"))]
84 /// Removes a right from the persistent storage along with its associated resources.
85 ///
86 /// Parameter `right`: `LAPersistedRight`instance to remove.
87 ///
88 /// Parameter `handler`: Completion handler with an error on failure.
89 #[unsafe(method(removeRight:completion:))]
90 #[unsafe(method_family = none)]
91 pub unsafe fn removeRight_completion(
92 &self,
93 right: &LAPersistedRight,
94 handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
95 );
96
97 #[cfg(feature = "block2")]
98 /// Removes right with provided identifier from persistant storage.
99 ///
100 /// Parameter `identifier`: Identifier of
101 /// `LAPersistedRight`instance to remove.
102 ///
103 /// Parameter `handler`: Completion handler with an error on failure.
104 #[unsafe(method(removeRightForIdentifier:completion:))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn removeRightForIdentifier_completion(
107 &self,
108 identifier: &NSString,
109 handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
110 );
111
112 #[cfg(feature = "block2")]
113 /// Removes all rights stored by the client
114 ///
115 /// Parameter `handler`: Completion handler with an error on failure.
116 #[unsafe(method(removeAllRightsWithCompletion:))]
117 #[unsafe(method_family = none)]
118 pub unsafe fn removeAllRightsWithCompletion(
119 &self,
120 handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
121 );
122
123 /// Clients should rely on the
124 /// `shared`instance instead
125 #[unsafe(method(new))]
126 #[unsafe(method_family = new)]
127 pub unsafe fn new() -> Retained<Self>;
128
129 /// Clients should rely on the
130 /// `shared`instance instead
131 #[unsafe(method(init))]
132 #[unsafe(method_family = init)]
133 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
134 );
135}