feat(android): implement private Rust storage runtime (#90)
Dependency security audit / rustsec (push) Failing after 23s
Dependency security audit / rustsec (push) Failing after 23s
This commit is contained in:
1 parent
180851087b
commit
874c8139a4
36 files changed
+2848
-39
No files matched your search
@@ -2524,6 +2524,189 @@ public func FfiConverterTypeMobileOnboardingOperation_lower(_ value: MobileOnboa
|
||||
|
||||
|
||||
|
||||
public protocol MobilePrivateRuntimeProtocol: AnyObject, Sendable {
|
||||
|
||||
func activate() throws
|
||||
|
||||
func authentication(backend: MobileSecretBackend, clock: MobileClock) throws -> MobileAuthentication
|
||||
|
||||
func clearDisposableCache() throws
|
||||
|
||||
func layout() -> MobilePrivateStorageLayout
|
||||
|
||||
func shell() -> MobileShell
|
||||
|
||||
func status() -> MobilePrivateStorageStatus
|
||||
|
||||
func verifySecureStorage(backend: MobileSecretBackend) throws
|
||||
|
||||
}
|
||||
open class MobilePrivateRuntime: MobilePrivateRuntimeProtocol, @unchecked Sendable {
|
||||
fileprivate let handle: UInt64
|
||||
|
||||
/// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly.
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public struct NoHandle {
|
||||
public init() {}
|
||||
}
|
||||
|
||||
// TODO: We'd like this to be `private` but for Swifty reasons,
|
||||
// we can't implement `FfiConverter` without making this `required` and we can't
|
||||
// make it `required` without making it `public`.
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
required public init(unsafeFromHandle handle: UInt64) {
|
||||
self.handle = handle
|
||||
}
|
||||
|
||||
// This constructor can be used to instantiate a fake object.
|
||||
// - Parameter noHandle: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
||||
//
|
||||
// - Warning:
|
||||
// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing handle the FFI lower functions will crash.
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public init(noHandle: NoHandle) {
|
||||
self.handle = 0
|
||||
}
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public func uniffiCloneHandle() -> UInt64 {
|
||||
return try! rustCall { uniffi_ironstorage_mobile_fn_clone_mobileprivateruntime(self.handle, $0) }
|
||||
}
|
||||
// No primary constructor declared for this class.
|
||||
|
||||
deinit {
|
||||
if handle == 0 {
|
||||
// Mock objects have handle=0 don't try to free them
|
||||
return
|
||||
}
|
||||
|
||||
try! rustCall { uniffi_ironstorage_mobile_fn_free_mobileprivateruntime(handle, $0) }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
open func activate()throws {try rustCallWithError(FfiConverterTypeMobilePrivateStorageFfiError_lift) {
|
||||
uniffiCallStatus in
|
||||
uniffi_ironstorage_mobile_fn_method_mobileprivateruntime_activate(
|
||||
self.uniffiCloneHandle(),uniffiCallStatus
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
open func authentication(backend: MobileSecretBackend, clock: MobileClock)throws -> MobileAuthentication {
|
||||
return try FfiConverterTypeMobileAuthentication_lift(try rustCallWithError(FfiConverterTypeMobileAuthenticationFfiError_lift) {
|
||||
uniffiCallStatus in
|
||||
uniffi_ironstorage_mobile_fn_method_mobileprivateruntime_authentication(
|
||||
self.uniffiCloneHandle(),
|
||||
FfiConverterTypeMobileSecretBackend_lower(backend),
|
||||
FfiConverterTypeMobileClock_lower(clock),uniffiCallStatus
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
open func clearDisposableCache()throws {try rustCallWithError(FfiConverterTypeMobilePrivateStorageFfiError_lift) {
|
||||
uniffiCallStatus in
|
||||
uniffi_ironstorage_mobile_fn_method_mobileprivateruntime_clear_disposable_cache(
|
||||
self.uniffiCloneHandle(),uniffiCallStatus
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
open func layout() -> MobilePrivateStorageLayout {
|
||||
return try! FfiConverterTypeMobilePrivateStorageLayout_lift(try! rustCall() {
|
||||
uniffiCallStatus in
|
||||
uniffi_ironstorage_mobile_fn_method_mobileprivateruntime_layout(
|
||||
self.uniffiCloneHandle(),uniffiCallStatus
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
open func shell() -> MobileShell {
|
||||
return try! FfiConverterTypeMobileShell_lift(try! rustCall() {
|
||||
uniffiCallStatus in
|
||||
uniffi_ironstorage_mobile_fn_method_mobileprivateruntime_shell(
|
||||
self.uniffiCloneHandle(),uniffiCallStatus
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
open func status() -> MobilePrivateStorageStatus {
|
||||
return try! FfiConverterTypeMobilePrivateStorageStatus_lift(try! rustCall() {
|
||||
uniffiCallStatus in
|
||||
uniffi_ironstorage_mobile_fn_method_mobileprivateruntime_status(
|
||||
self.uniffiCloneHandle(),uniffiCallStatus
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
open func verifySecureStorage(backend: MobileSecretBackend)throws {try rustCallWithError(FfiConverterTypeMobilePrivateStorageFfiError_lift) {
|
||||
uniffiCallStatus in
|
||||
uniffi_ironstorage_mobile_fn_method_mobileprivateruntime_verify_secure_storage(
|
||||
self.uniffiCloneHandle(),
|
||||
FfiConverterTypeMobileSecretBackend_lower(backend),uniffiCallStatus
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public struct FfiConverterTypeMobilePrivateRuntime: FfiConverter {
|
||||
typealias FfiType = UInt64
|
||||
typealias SwiftType = MobilePrivateRuntime
|
||||
|
||||
public static func lift(_ handle: UInt64) throws -> MobilePrivateRuntime {
|
||||
return MobilePrivateRuntime(unsafeFromHandle: handle)
|
||||
}
|
||||
|
||||
public static func lower(_ value: MobilePrivateRuntime) -> UInt64 {
|
||||
return value.uniffiCloneHandle()
|
||||
}
|
||||
|
||||
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MobilePrivateRuntime {
|
||||
let handle: UInt64 = try readInt(&buf)
|
||||
return try lift(handle)
|
||||
}
|
||||
|
||||
public static func write(_ value: MobilePrivateRuntime, into buf: inout [UInt8]) {
|
||||
writeInt(&buf, lower(value))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public func FfiConverterTypeMobilePrivateRuntime_lift(_ handle: UInt64) throws -> MobilePrivateRuntime {
|
||||
return try FfiConverterTypeMobilePrivateRuntime.lift(handle)
|
||||
}
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public func FfiConverterTypeMobilePrivateRuntime_lower(_ value: MobilePrivateRuntime) -> UInt64 {
|
||||
return FfiConverterTypeMobilePrivateRuntime.lower(value)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Receives storage-encoded opaque bytes; cannot select accounts, leases or protection.
|
||||
*/
|
||||
@@ -5519,6 +5702,208 @@ public func FfiConverterTypeMobilePreferences_lower(_ value: MobilePreferences)
|
||||
}
|
||||
|
||||
|
||||
public struct MobilePrivateDirectories: Equatable, Hashable {
|
||||
public var files: String
|
||||
public var noBackup: String
|
||||
public var cache: String
|
||||
|
||||
// Default memberwise initializers are never public by default, so we
|
||||
// declare one manually.
|
||||
public init(files: String, noBackup: String, cache: String) {
|
||||
self.files = files
|
||||
self.noBackup = noBackup
|
||||
self.cache = cache
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if compiler(>=6)
|
||||
extension MobilePrivateDirectories: Sendable {}
|
||||
#endif
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public struct FfiConverterTypeMobilePrivateDirectories: FfiConverterRustBuffer {
|
||||
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MobilePrivateDirectories {
|
||||
return
|
||||
try MobilePrivateDirectories(
|
||||
files: FfiConverterString.read(from: &buf),
|
||||
noBackup: FfiConverterString.read(from: &buf),
|
||||
cache: FfiConverterString.read(from: &buf)
|
||||
)
|
||||
}
|
||||
|
||||
public static func write(_ value: MobilePrivateDirectories, into buf: inout [UInt8]) {
|
||||
FfiConverterString.write(value.files, into: &buf)
|
||||
FfiConverterString.write(value.noBackup, into: &buf)
|
||||
FfiConverterString.write(value.cache, into: &buf)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public func FfiConverterTypeMobilePrivateDirectories_lift(_ buf: RustBuffer) throws -> MobilePrivateDirectories {
|
||||
return try FfiConverterTypeMobilePrivateDirectories.lift(buf)
|
||||
}
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public func FfiConverterTypeMobilePrivateDirectories_lower(_ value: MobilePrivateDirectories) -> RustBuffer {
|
||||
return FfiConverterTypeMobilePrivateDirectories.lower(value)
|
||||
}
|
||||
|
||||
|
||||
public struct MobilePrivateStorageLayout: Equatable, Hashable {
|
||||
public var data: String
|
||||
public var configuration: String
|
||||
public var vault: String
|
||||
public var keys: String
|
||||
public var catalog: String
|
||||
public var scratch: String
|
||||
public var cache: String
|
||||
|
||||
// Default memberwise initializers are never public by default, so we
|
||||
// declare one manually.
|
||||
public init(data: String, configuration: String, vault: String, keys: String, catalog: String, scratch: String, cache: String) {
|
||||
self.data = data
|
||||
self.configuration = configuration
|
||||
self.vault = vault
|
||||
self.keys = keys
|
||||
self.catalog = catalog
|
||||
self.scratch = scratch
|
||||
self.cache = cache
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if compiler(>=6)
|
||||
extension MobilePrivateStorageLayout: Sendable {}
|
||||
#endif
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public struct FfiConverterTypeMobilePrivateStorageLayout: FfiConverterRustBuffer {
|
||||
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MobilePrivateStorageLayout {
|
||||
return
|
||||
try MobilePrivateStorageLayout(
|
||||
data: FfiConverterString.read(from: &buf),
|
||||
configuration: FfiConverterString.read(from: &buf),
|
||||
vault: FfiConverterString.read(from: &buf),
|
||||
keys: FfiConverterString.read(from: &buf),
|
||||
catalog: FfiConverterString.read(from: &buf),
|
||||
scratch: FfiConverterString.read(from: &buf),
|
||||
cache: FfiConverterString.read(from: &buf)
|
||||
)
|
||||
}
|
||||
|
||||
public static func write(_ value: MobilePrivateStorageLayout, into buf: inout [UInt8]) {
|
||||
FfiConverterString.write(value.data, into: &buf)
|
||||
FfiConverterString.write(value.configuration, into: &buf)
|
||||
FfiConverterString.write(value.vault, into: &buf)
|
||||
FfiConverterString.write(value.keys, into: &buf)
|
||||
FfiConverterString.write(value.catalog, into: &buf)
|
||||
FfiConverterString.write(value.scratch, into: &buf)
|
||||
FfiConverterString.write(value.cache, into: &buf)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public func FfiConverterTypeMobilePrivateStorageLayout_lift(_ buf: RustBuffer) throws -> MobilePrivateStorageLayout {
|
||||
return try FfiConverterTypeMobilePrivateStorageLayout.lift(buf)
|
||||
}
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public func FfiConverterTypeMobilePrivateStorageLayout_lower(_ value: MobilePrivateStorageLayout) -> RustBuffer {
|
||||
return FfiConverterTypeMobilePrivateStorageLayout.lower(value)
|
||||
}
|
||||
|
||||
|
||||
public struct MobilePrivateStorageStatus: Equatable, Hashable {
|
||||
public var version: UInt32
|
||||
public var configured: Bool
|
||||
public var recoveredTemporaryFiles: Bool
|
||||
public var recoveredCatalog: Bool
|
||||
public var secureBindingPresent: Bool
|
||||
public var recovery: MobilePrivateStorageErrorKind?
|
||||
|
||||
// Default memberwise initializers are never public by default, so we
|
||||
// declare one manually.
|
||||
public init(version: UInt32, configured: Bool, recoveredTemporaryFiles: Bool, recoveredCatalog: Bool, secureBindingPresent: Bool, recovery: MobilePrivateStorageErrorKind?) {
|
||||
self.version = version
|
||||
self.configured = configured
|
||||
self.recoveredTemporaryFiles = recoveredTemporaryFiles
|
||||
self.recoveredCatalog = recoveredCatalog
|
||||
self.secureBindingPresent = secureBindingPresent
|
||||
self.recovery = recovery
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if compiler(>=6)
|
||||
extension MobilePrivateStorageStatus: Sendable {}
|
||||
#endif
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public struct FfiConverterTypeMobilePrivateStorageStatus: FfiConverterRustBuffer {
|
||||
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MobilePrivateStorageStatus {
|
||||
return
|
||||
try MobilePrivateStorageStatus(
|
||||
version: FfiConverterUInt32.read(from: &buf),
|
||||
configured: FfiConverterBool.read(from: &buf),
|
||||
recoveredTemporaryFiles: FfiConverterBool.read(from: &buf),
|
||||
recoveredCatalog: FfiConverterBool.read(from: &buf),
|
||||
secureBindingPresent: FfiConverterBool.read(from: &buf),
|
||||
recovery: FfiConverterOptionTypeMobilePrivateStorageErrorKind.read(from: &buf)
|
||||
)
|
||||
}
|
||||
|
||||
public static func write(_ value: MobilePrivateStorageStatus, into buf: inout [UInt8]) {
|
||||
FfiConverterUInt32.write(value.version, into: &buf)
|
||||
FfiConverterBool.write(value.configured, into: &buf)
|
||||
FfiConverterBool.write(value.recoveredTemporaryFiles, into: &buf)
|
||||
FfiConverterBool.write(value.recoveredCatalog, into: &buf)
|
||||
FfiConverterBool.write(value.secureBindingPresent, into: &buf)
|
||||
FfiConverterOptionTypeMobilePrivateStorageErrorKind.write(value.recovery, into: &buf)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public func FfiConverterTypeMobilePrivateStorageStatus_lift(_ buf: RustBuffer) throws -> MobilePrivateStorageStatus {
|
||||
return try FfiConverterTypeMobilePrivateStorageStatus.lift(buf)
|
||||
}
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public func FfiConverterTypeMobilePrivateStorageStatus_lower(_ value: MobilePrivateStorageStatus) -> RustBuffer {
|
||||
return FfiConverterTypeMobilePrivateStorageStatus.lower(value)
|
||||
}
|
||||
|
||||
|
||||
public struct MobileShell: Equatable, Hashable {
|
||||
public var selectedTab: MobileTab
|
||||
public var pages: [MobilePage]
|
||||
@@ -8521,6 +8906,252 @@ public func FfiConverterTypeMobilePreferenceError_lower(_ value: MobilePreferenc
|
||||
}
|
||||
|
||||
|
||||
|
||||
public enum MobilePrivateStorageErrorKind: Equatable, Hashable {
|
||||
|
||||
case invalidRoots
|
||||
case unsafePath
|
||||
case missingRoot
|
||||
case accessDenied
|
||||
case readOnly
|
||||
case storageFull
|
||||
case busy
|
||||
case io
|
||||
case corruptLayout
|
||||
case migrationRequired
|
||||
case corruptConfiguration
|
||||
case configurationMissingWithData
|
||||
case interruptedSetup
|
||||
case restoredWithoutKeystore
|
||||
case secureStorageLocked
|
||||
case secureStorageUnavailable
|
||||
case invalidSecureBinding
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if compiler(>=6)
|
||||
extension MobilePrivateStorageErrorKind: Sendable {}
|
||||
#endif
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public struct FfiConverterTypeMobilePrivateStorageErrorKind: FfiConverterRustBuffer {
|
||||
typealias SwiftType = MobilePrivateStorageErrorKind
|
||||
|
||||
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MobilePrivateStorageErrorKind {
|
||||
let variant: Int32 = try readInt(&buf)
|
||||
switch variant {
|
||||
|
||||
case 1: return .invalidRoots
|
||||
|
||||
case 2: return .unsafePath
|
||||
|
||||
case 3: return .missingRoot
|
||||
|
||||
case 4: return .accessDenied
|
||||
|
||||
case 5: return .readOnly
|
||||
|
||||
case 6: return .storageFull
|
||||
|
||||
case 7: return .busy
|
||||
|
||||
case 8: return .io
|
||||
|
||||
case 9: return .corruptLayout
|
||||
|
||||
case 10: return .migrationRequired
|
||||
|
||||
case 11: return .corruptConfiguration
|
||||
|
||||
case 12: return .configurationMissingWithData
|
||||
|
||||
case 13: return .interruptedSetup
|
||||
|
||||
case 14: return .restoredWithoutKeystore
|
||||
|
||||
case 15: return .secureStorageLocked
|
||||
|
||||
case 16: return .secureStorageUnavailable
|
||||
|
||||
case 17: return .invalidSecureBinding
|
||||
|
||||
default: throw UniffiInternalError.unexpectedEnumCase
|
||||
}
|
||||
}
|
||||
|
||||
public static func write(_ value: MobilePrivateStorageErrorKind, into buf: inout [UInt8]) {
|
||||
switch value {
|
||||
|
||||
|
||||
case .invalidRoots:
|
||||
writeInt(&buf, Int32(1))
|
||||
|
||||
|
||||
case .unsafePath:
|
||||
writeInt(&buf, Int32(2))
|
||||
|
||||
|
||||
case .missingRoot:
|
||||
writeInt(&buf, Int32(3))
|
||||
|
||||
|
||||
case .accessDenied:
|
||||
writeInt(&buf, Int32(4))
|
||||
|
||||
|
||||
case .readOnly:
|
||||
writeInt(&buf, Int32(5))
|
||||
|
||||
|
||||
case .storageFull:
|
||||
writeInt(&buf, Int32(6))
|
||||
|
||||
|
||||
case .busy:
|
||||
writeInt(&buf, Int32(7))
|
||||
|
||||
|
||||
case .io:
|
||||
writeInt(&buf, Int32(8))
|
||||
|
||||
|
||||
case .corruptLayout:
|
||||
writeInt(&buf, Int32(9))
|
||||
|
||||
|
||||
case .migrationRequired:
|
||||
writeInt(&buf, Int32(10))
|
||||
|
||||
|
||||
case .corruptConfiguration:
|
||||
writeInt(&buf, Int32(11))
|
||||
|
||||
|
||||
case .configurationMissingWithData:
|
||||
writeInt(&buf, Int32(12))
|
||||
|
||||
|
||||
case .interruptedSetup:
|
||||
writeInt(&buf, Int32(13))
|
||||
|
||||
|
||||
case .restoredWithoutKeystore:
|
||||
writeInt(&buf, Int32(14))
|
||||
|
||||
|
||||
case .secureStorageLocked:
|
||||
writeInt(&buf, Int32(15))
|
||||
|
||||
|
||||
case .secureStorageUnavailable:
|
||||
writeInt(&buf, Int32(16))
|
||||
|
||||
|
||||
case .invalidSecureBinding:
|
||||
writeInt(&buf, Int32(17))
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public func FfiConverterTypeMobilePrivateStorageErrorKind_lift(_ buf: RustBuffer) throws -> MobilePrivateStorageErrorKind {
|
||||
return try FfiConverterTypeMobilePrivateStorageErrorKind.lift(buf)
|
||||
}
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public func FfiConverterTypeMobilePrivateStorageErrorKind_lower(_ value: MobilePrivateStorageErrorKind) -> RustBuffer {
|
||||
return FfiConverterTypeMobilePrivateStorageErrorKind.lower(value)
|
||||
}
|
||||
|
||||
|
||||
|
||||
public
|
||||
enum MobilePrivateStorageFfiError: Swift.Error, Equatable, Hashable, Foundation.LocalizedError {
|
||||
|
||||
|
||||
|
||||
case Failed(kind: MobilePrivateStorageErrorKind
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public var errorDescription: String? {
|
||||
String(reflecting: self)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if compiler(>=6)
|
||||
extension MobilePrivateStorageFfiError: Sendable {}
|
||||
#endif
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public struct FfiConverterTypeMobilePrivateStorageFfiError: FfiConverterRustBuffer {
|
||||
typealias SwiftType = MobilePrivateStorageFfiError
|
||||
|
||||
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MobilePrivateStorageFfiError {
|
||||
let variant: Int32 = try readInt(&buf)
|
||||
switch variant {
|
||||
|
||||
|
||||
|
||||
|
||||
case 1: return .Failed(
|
||||
kind: try FfiConverterTypeMobilePrivateStorageErrorKind.read(from: &buf)
|
||||
)
|
||||
|
||||
default: throw UniffiInternalError.unexpectedEnumCase
|
||||
}
|
||||
}
|
||||
|
||||
public static func write(_ value: MobilePrivateStorageFfiError, into buf: inout [UInt8]) {
|
||||
switch value {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case let .Failed(kind):
|
||||
writeInt(&buf, Int32(1))
|
||||
FfiConverterTypeMobilePrivateStorageErrorKind.write(kind, into: &buf)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public func FfiConverterTypeMobilePrivateStorageFfiError_lift(_ buf: RustBuffer) throws -> MobilePrivateStorageFfiError {
|
||||
return try FfiConverterTypeMobilePrivateStorageFfiError.lift(buf)
|
||||
}
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public func FfiConverterTypeMobilePrivateStorageFfiError_lower(_ value: MobilePrivateStorageFfiError) -> RustBuffer {
|
||||
return FfiConverterTypeMobilePrivateStorageFfiError.lower(value)
|
||||
}
|
||||
|
||||
|
||||
public
|
||||
enum MobileSecretError: Swift.Error, Equatable, Hashable, Foundation.LocalizedError {
|
||||
|
||||
@@ -8637,6 +9268,7 @@ public func FfiConverterTypeMobileSecretError_lower(_ value: MobileSecretError)
|
||||
|
||||
public enum MobileSecretLocator: Equatable, Hashable {
|
||||
|
||||
case applicationBinding
|
||||
case openPgpPassphrase(fingerprint: String
|
||||
)
|
||||
case httpsGitCredential(serverId: String, applicationId: String
|
||||
@@ -8664,13 +9296,15 @@ public struct FfiConverterTypeMobileSecretLocator: FfiConverterRustBuffer {
|
||||
let variant: Int32 = try readInt(&buf)
|
||||
switch variant {
|
||||
|
||||
case 1: return .openPgpPassphrase(fingerprint: try FfiConverterString.read(from: &buf)
|
||||
case 1: return .applicationBinding
|
||||
|
||||
case 2: return .openPgpPassphrase(fingerprint: try FfiConverterString.read(from: &buf)
|
||||
)
|
||||
|
||||
case 2: return .httpsGitCredential(serverId: try FfiConverterString.read(from: &buf), applicationId: try FfiConverterString.read(from: &buf)
|
||||
case 3: return .httpsGitCredential(serverId: try FfiConverterString.read(from: &buf), applicationId: try FfiConverterString.read(from: &buf)
|
||||
)
|
||||
|
||||
case 3: return .sshKeyPassphrase(fingerprint: try FfiConverterString.read(from: &buf)
|
||||
case 4: return .sshKeyPassphrase(fingerprint: try FfiConverterString.read(from: &buf)
|
||||
)
|
||||
|
||||
default: throw UniffiInternalError.unexpectedEnumCase
|
||||
@@ -8681,19 +9315,23 @@ public struct FfiConverterTypeMobileSecretLocator: FfiConverterRustBuffer {
|
||||
switch value {
|
||||
|
||||
|
||||
case let .openPgpPassphrase(fingerprint):
|
||||
case .applicationBinding:
|
||||
writeInt(&buf, Int32(1))
|
||||
|
||||
|
||||
case let .openPgpPassphrase(fingerprint):
|
||||
writeInt(&buf, Int32(2))
|
||||
FfiConverterString.write(fingerprint, into: &buf)
|
||||
|
||||
|
||||
case let .httpsGitCredential(serverId,applicationId):
|
||||
writeInt(&buf, Int32(2))
|
||||
writeInt(&buf, Int32(3))
|
||||
FfiConverterString.write(serverId, into: &buf)
|
||||
FfiConverterString.write(applicationId, into: &buf)
|
||||
|
||||
|
||||
case let .sshKeyPassphrase(fingerprint):
|
||||
writeInt(&buf, Int32(3))
|
||||
writeInt(&buf, Int32(4))
|
||||
FfiConverterString.write(fingerprint, into: &buf)
|
||||
|
||||
}
|
||||
@@ -9492,6 +10130,30 @@ fileprivate struct FfiConverterOptionTypeMobileHomeActionKind: FfiConverterRustB
|
||||
}
|
||||
}
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
fileprivate struct FfiConverterOptionTypeMobilePrivateStorageErrorKind: FfiConverterRustBuffer {
|
||||
typealias SwiftType = MobilePrivateStorageErrorKind?
|
||||
|
||||
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
||||
guard let value = value else {
|
||||
writeInt(&buf, Int8(0))
|
||||
return
|
||||
}
|
||||
writeInt(&buf, Int8(1))
|
||||
FfiConverterTypeMobilePrivateStorageErrorKind.write(value, into: &buf)
|
||||
}
|
||||
|
||||
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
||||
switch try readInt(&buf) as Int8 {
|
||||
case 0: return nil
|
||||
case 1: return try FfiConverterTypeMobilePrivateStorageErrorKind.read(from: &buf)
|
||||
default: throw UniffiInternalError.unexpectedOptionalTag
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
@@ -10016,6 +10678,22 @@ public func validateMobileCredentialRequest(request: MobileCredentialRequest)thr
|
||||
)
|
||||
})
|
||||
}
|
||||
public func mobilePrivateStorageFailure(error: MobilePrivateStorageErrorKind) -> MobileShell {
|
||||
return try! FfiConverterTypeMobileShell_lift(try! rustCall() {
|
||||
uniffiCallStatus in
|
||||
uniffi_ironstorage_mobile_fn_func_mobile_private_storage_failure(
|
||||
FfiConverterTypeMobilePrivateStorageErrorKind_lower(error),uniffiCallStatus
|
||||
)
|
||||
})
|
||||
}
|
||||
public func openMobilePrivateRuntime(directories: MobilePrivateDirectories)throws -> MobilePrivateRuntime {
|
||||
return try FfiConverterTypeMobilePrivateRuntime_lift(try rustCallWithError(FfiConverterTypeMobilePrivateStorageFfiError_lift) {
|
||||
uniffiCallStatus in
|
||||
uniffi_ironstorage_mobile_fn_func_open_mobile_private_runtime(
|
||||
FfiConverterTypeMobilePrivateDirectories_lower(directories),uniffiCallStatus
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
private enum InitializationResult {
|
||||
case ok
|
||||
@@ -10089,6 +10767,12 @@ private let initializationResult: InitializationResult = {
|
||||
if (uniffi_ironstorage_mobile_checksum_func_validate_mobile_credential_request() != 60738) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_ironstorage_mobile_checksum_func_mobile_private_storage_failure() != 38666) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_ironstorage_mobile_checksum_func_open_mobile_private_runtime() != 27207) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_ironstorage_mobile_checksum_method_mobileauthentication_acknowledge_watch_snapshot() != 21391) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
@@ -10323,6 +11007,27 @@ private let initializationResult: InitializationResult = {
|
||||
if (uniffi_ironstorage_mobile_checksum_method_mobilesecretbackend_unlock() != 2737) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_ironstorage_mobile_checksum_method_mobileprivateruntime_activate() != 64835) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_ironstorage_mobile_checksum_method_mobileprivateruntime_authentication() != 21237) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_ironstorage_mobile_checksum_method_mobileprivateruntime_clear_disposable_cache() != 35831) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_ironstorage_mobile_checksum_method_mobileprivateruntime_layout() != 33040) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_ironstorage_mobile_checksum_method_mobileprivateruntime_shell() != 42966) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_ironstorage_mobile_checksum_method_mobileprivateruntime_status() != 46293) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_ironstorage_mobile_checksum_method_mobileprivateruntime_verify_secure_storage() != 12909) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
|
||||
uniffiCallbackInitMobileClipboard()
|
||||
uniffiCallbackInitMobileClock()
|
||||
@@ -10529,6 +11234,22 @@ extension MobilePreferences: CustomStringConvertible, CustomDebugStringConvertib
|
||||
public var description: String { "MobilePreferences([REDACTED])" }
|
||||
public var debugDescription: String { description }
|
||||
}
|
||||
extension MobilePrivateDirectories: CustomStringConvertible, CustomDebugStringConvertible {
|
||||
public var description: String { "MobilePrivateDirectories([REDACTED])" }
|
||||
public var debugDescription: String { description }
|
||||
}
|
||||
extension MobilePrivateStorageFfiError: CustomStringConvertible, CustomDebugStringConvertible {
|
||||
public var description: String { "MobilePrivateStorageFfiError([REDACTED])" }
|
||||
public var debugDescription: String { description }
|
||||
}
|
||||
extension MobilePrivateStorageLayout: CustomStringConvertible, CustomDebugStringConvertible {
|
||||
public var description: String { "MobilePrivateStorageLayout([REDACTED])" }
|
||||
public var debugDescription: String { description }
|
||||
}
|
||||
extension MobilePrivateStorageStatus: CustomStringConvertible, CustomDebugStringConvertible {
|
||||
public var description: String { "MobilePrivateStorageStatus([REDACTED])" }
|
||||
public var debugDescription: String { description }
|
||||
}
|
||||
extension MobileSecretError: CustomStringConvertible, CustomDebugStringConvertible {
|
||||
public var description: String { "MobileSecretError([REDACTED])" }
|
||||
public var debugDescription: String { description }
|
||||
|
||||
Reference in new issue
Block a user