@@ -21,7 +21,7 @@ private struct ResolvedAccessControl {
2121/// The Swift bridge runs keychain queries on a dedicated queue, encodes consistent metadata, and
2222/// returns results that mirror the TypeScript types shipped in the package across iOS, macOS,
2323/// visionOS, and watchOS.
24- final class HybridSensitiveInfo : HybridSensitiveInfoSpec {
24+ public final class HybridSensitiveInfo : HybridSensitiveInfoSpec {
2525 private let workQueue = DispatchQueue ( label: " com.mcodex.sensitiveinfo.keychain " , qos: . userInitiated)
2626 private let encoder : JSONEncoder = {
2727 let encoder = JSONEncoder ( )
@@ -47,7 +47,7 @@ final class HybridSensitiveInfo: HybridSensitiveInfoSpec {
4747 /// Stores or replaces an item in the Keychain, returning metadata describing the applied
4848 /// security policy. If the requested hardware policy is unavailable (for example, simulators with
4949 /// no passcode), we fall back to a software-only accessibility to keep the call successful.
50- func setItem( request: SensitiveInfoSetRequest ) throws -> Promise < MutationResult > {
50+ public func setItem( request: SensitiveInfoSetRequest ) throws -> Promise < MutationResult > {
5151 Promise . parallel ( workQueue) { [ self ] in
5252 let service = normalizedService ( request. service)
5353 let resolved = try resolveAccessControl ( preferred: request. accessControl)
@@ -105,7 +105,7 @@ final class HybridSensitiveInfo: HybridSensitiveInfoSpec {
105105 }
106106
107107 /// Fetches a single item and optionally includes the plaintext value if the client requested it.
108- func getItem( request: SensitiveInfoGetRequest ) throws -> Promise < SensitiveInfoItem ? > {
108+ public func getItem( request: SensitiveInfoGetRequest ) throws -> Promise < Variant_NullType_SensitiveInfoItem > {
109109 Promise . parallel ( workQueue) { [ self ] in
110110 let service = normalizedService ( request. service)
111111 let includeValue = request. includeValue ?? true
@@ -123,15 +123,16 @@ final class HybridSensitiveInfo: HybridSensitiveInfoSpec {
123123 }
124124
125125 guard let raw = try copyMatching ( query: query, prompt: request. authenticationPrompt) as? NSDictionary else {
126- return nil
126+ return Variant_NullType_SensitiveInfoItem . first ( NullType . null )
127127 }
128128
129- return try makeItem ( from: raw, includeValue: includeValue)
129+ let item = try makeItem ( from: raw, includeValue: includeValue)
130+ return Variant_NullType_SensitiveInfoItem . second ( item)
130131 }
131132 }
132133
133134 /// Removes a specific key/service pair from the Keychain.
134- func deleteItem( request: SensitiveInfoDeleteRequest ) throws -> Promise < Bool > {
135+ public func deleteItem( request: SensitiveInfoDeleteRequest ) throws -> Promise < Bool > {
135136 Promise . parallel ( workQueue) { [ self ] in
136137 let service = normalizedService ( request. service)
137138 let query = makeBaseQuery (
@@ -154,7 +155,7 @@ final class HybridSensitiveInfo: HybridSensitiveInfoSpec {
154155 }
155156
156157 /// Checks for existence without allocating an item payload.
157- func hasItem( request: SensitiveInfoHasRequest ) throws -> Promise < Bool > {
158+ public func hasItem( request: SensitiveInfoHasRequest ) throws -> Promise < Bool > {
158159 Promise . parallel ( workQueue) { [ self ] in
159160 let service = normalizedService ( request. service)
160161 var query = makeBaseQuery (
@@ -176,7 +177,7 @@ final class HybridSensitiveInfo: HybridSensitiveInfoSpec {
176177 /// ```ts
177178 /// const items = await SensitiveInfo.getAllItems({ service: 'vault', includeValues: true })
178179 /// ```
179- func getAllItems( request: SensitiveInfoEnumerateRequest ? ) throws -> Promise < [ SensitiveInfoItem ] > {
180+ public func getAllItems( request: SensitiveInfoEnumerateRequest ? ) throws -> Promise < [ SensitiveInfoItem ] > {
180181 Promise . parallel ( workQueue) { [ self ] in
181182 let includeValues = request? . includeValues ?? false
182183 let service = normalizedService ( request? . service)
@@ -205,7 +206,7 @@ final class HybridSensitiveInfo: HybridSensitiveInfoSpec {
205206 }
206207
207208 /// Deletes all items for the requested service.
208- func clearService( request: SensitiveInfoOptions ? ) throws -> Promise < Void > {
209+ public func clearService( request: SensitiveInfoOptions ? ) throws -> Promise < Void > {
209210 Promise . parallel ( workQueue) { [ self ] in
210211 let service = normalizedService ( request? . service)
211212 let query = makeBaseQuery (
@@ -225,7 +226,7 @@ final class HybridSensitiveInfo: HybridSensitiveInfoSpec {
225226 }
226227 }
227228
228- func getSupportedSecurityLevels( ) throws -> Promise < SecurityAvailability > {
229+ public func getSupportedSecurityLevels( ) throws -> Promise < SecurityAvailability > {
229230 Promise . resolved ( withResult: resolveAvailability ( ) )
230231 }
231232
0 commit comments