Skip to content

Commit 0b12368

Browse files
Update Swift SDK to 8a7175fe9b2668bd51008081caca135adf4bdd0e
1 parent bb36b48 commit 0b12368

File tree

6 files changed

+107
-15
lines changed

6 files changed

+107
-15
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ let package = Package(
3333
),
3434
.binaryTarget(
3535
name: "BitwardenFFI",
36-
url: "https://github.com/bitwarden/sdk-swift/releases/download/v1.0.0-unstable-03d02e6/BitwardenFFI-1.0.0-03d02e6.xcframework.zip",
37-
checksum: "46a95fdf8c05fec40a280fef7c3978cc5d3150e57fb1fc3c8fbafca80cee4f9b"
36+
url: "https://github.com/bitwarden/sdk-swift/releases/download/v1.0.0-unstable-8a7175f/BitwardenFFI-1.0.0-8a7175f.xcframework.zip",
37+
checksum: "8f4992d6f338641810e0ef3b1caa7672f54d0ae13ffba65545216195105e854d"
3838
),
3939
]
4040
)

Sources/BitwardenSdk/BitwardenCollections.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,8 +891,8 @@ private let initializationResult: InitializationResult = {
891891
return InitializationResult.contractVersionMismatch
892892
}
893893

894-
uniffiEnsureBitwardenCryptoInitialized()
895894
uniffiEnsureBitwardenCoreInitialized()
895+
uniffiEnsureBitwardenCryptoInitialized()
896896
return InitializationResult.ok
897897
}()
898898

Sources/BitwardenSdk/BitwardenFido.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2666,8 +2666,8 @@ private let initializationResult: InitializationResult = {
26662666
return InitializationResult.contractVersionMismatch
26672667
}
26682668

2669-
uniffiEnsureBitwardenVaultInitialized()
26702669
uniffiEnsureBitwardenCoreInitialized()
2670+
uniffiEnsureBitwardenVaultInitialized()
26712671
return InitializationResult.ok
26722672
}()
26732673

Sources/BitwardenSdk/BitwardenSDK.swift

Lines changed: 101 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5201,7 +5201,9 @@ public func FfiConverterTypeSshClient_lower(_ value: SshClient) -> UnsafeMutable
52015201

52025202
public protocol StateClientProtocol: AnyObject, Sendable {
52035203

5204-
func registerCipherRepository(store: CipherRepository)
5204+
func initializeState(configuration: SqliteConfiguration) async throws
5205+
5206+
func registerCipherRepository(repository: CipherRepository)
52055207

52065208
}
52075209
open class StateClient: StateClientProtocol, @unchecked Sendable {
@@ -5256,9 +5258,26 @@ open class StateClient: StateClientProtocol, @unchecked Sendable {
52565258

52575259

52585260

5259-
open func registerCipherRepository(store: CipherRepository) {try! rustCall() {
5261+
open func initializeState(configuration: SqliteConfiguration)async throws {
5262+
return
5263+
try await uniffiRustCallAsync(
5264+
rustFutureFunc: {
5265+
uniffi_bitwarden_uniffi_fn_method_stateclient_initialize_state(
5266+
self.uniffiClonePointer(),
5267+
FfiConverterTypeSqliteConfiguration_lower(configuration)
5268+
)
5269+
},
5270+
pollFunc: ffi_bitwarden_uniffi_rust_future_poll_void,
5271+
completeFunc: ffi_bitwarden_uniffi_rust_future_complete_void,
5272+
freeFunc: ffi_bitwarden_uniffi_rust_future_free_void,
5273+
liftFunc: { $0 },
5274+
errorHandler: FfiConverterTypeBitwardenError_lift
5275+
)
5276+
}
5277+
5278+
open func registerCipherRepository(repository: CipherRepository) {try! rustCall() {
52605279
uniffi_bitwarden_uniffi_fn_method_stateclient_register_cipher_repository(self.uniffiClonePointer(),
5261-
FfiConverterTypeCipherRepository_lower(store),$0
5280+
FfiConverterTypeCipherRepository_lower(repository),$0
52625281
)
52635282
}
52645283
}
@@ -5753,6 +5772,76 @@ public func FfiConverterTypeCipherViewWrapper_lower(_ value: CipherViewWrapper)
57535772
}
57545773

57555774

5775+
public struct SqliteConfiguration {
5776+
public let dbName: String
5777+
public let folderPath: String
5778+
5779+
// Default memberwise initializers are never public by default, so we
5780+
// declare one manually.
5781+
public init(dbName: String, folderPath: String) {
5782+
self.dbName = dbName
5783+
self.folderPath = folderPath
5784+
}
5785+
}
5786+
5787+
#if compiler(>=6)
5788+
extension SqliteConfiguration: Sendable {}
5789+
#endif
5790+
5791+
5792+
extension SqliteConfiguration: Equatable, Hashable {
5793+
public static func ==(lhs: SqliteConfiguration, rhs: SqliteConfiguration) -> Bool {
5794+
if lhs.dbName != rhs.dbName {
5795+
return false
5796+
}
5797+
if lhs.folderPath != rhs.folderPath {
5798+
return false
5799+
}
5800+
return true
5801+
}
5802+
5803+
public func hash(into hasher: inout Hasher) {
5804+
hasher.combine(dbName)
5805+
hasher.combine(folderPath)
5806+
}
5807+
}
5808+
5809+
5810+
5811+
#if swift(>=5.8)
5812+
@_documentation(visibility: private)
5813+
#endif
5814+
public struct FfiConverterTypeSqliteConfiguration: FfiConverterRustBuffer {
5815+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SqliteConfiguration {
5816+
return
5817+
try SqliteConfiguration(
5818+
dbName: FfiConverterString.read(from: &buf),
5819+
folderPath: FfiConverterString.read(from: &buf)
5820+
)
5821+
}
5822+
5823+
public static func write(_ value: SqliteConfiguration, into buf: inout [UInt8]) {
5824+
FfiConverterString.write(value.dbName, into: &buf)
5825+
FfiConverterString.write(value.folderPath, into: &buf)
5826+
}
5827+
}
5828+
5829+
5830+
#if swift(>=5.8)
5831+
@_documentation(visibility: private)
5832+
#endif
5833+
public func FfiConverterTypeSqliteConfiguration_lift(_ buf: RustBuffer) throws -> SqliteConfiguration {
5834+
return try FfiConverterTypeSqliteConfiguration.lift(buf)
5835+
}
5836+
5837+
#if swift(>=5.8)
5838+
@_documentation(visibility: private)
5839+
#endif
5840+
public func FfiConverterTypeSqliteConfiguration_lower(_ value: SqliteConfiguration) -> RustBuffer {
5841+
return FfiConverterTypeSqliteConfiguration.lower(value)
5842+
}
5843+
5844+
57565845
public enum BitwardenError: Swift.Error {
57575846

57585847

@@ -7123,7 +7212,10 @@ private let initializationResult: InitializationResult = {
71237212
if (uniffi_bitwarden_uniffi_checksum_method_sshclient_import_ssh_key() != 34814) {
71247213
return InitializationResult.apiChecksumMismatch
71257214
}
7126-
if (uniffi_bitwarden_uniffi_checksum_method_stateclient_register_cipher_repository() != 64881) {
7215+
if (uniffi_bitwarden_uniffi_checksum_method_stateclient_initialize_state() != 27371) {
7216+
return InitializationResult.apiChecksumMismatch
7217+
}
7218+
if (uniffi_bitwarden_uniffi_checksum_method_stateclient_register_cipher_repository() != 63324) {
71277219
return InitializationResult.apiChecksumMismatch
71287220
}
71297221
if (uniffi_bitwarden_uniffi_checksum_method_vaultclient_attachments() != 23471) {
@@ -7154,16 +7246,16 @@ private let initializationResult: InitializationResult = {
71547246
uniffiCallbackInitCipherRepository()
71557247
uniffiCallbackInitFido2CredentialStore()
71567248
uniffiCallbackInitFido2UserInterface()
7157-
uniffiEnsureBitwardenSendInitialized()
7158-
uniffiEnsureBitwardenCollectionsInitialized()
7159-
uniffiEnsureBitwardenFidoInitialized()
7160-
uniffiEnsureBitwardenCoreInitialized()
7161-
uniffiEnsureBitwardenSshInitialized()
71627249
uniffiEnsureBitwardenCryptoInitialized()
7250+
uniffiEnsureBitwardenCoreInitialized()
71637251
uniffiEnsureBitwardenGeneratorsInitialized()
71647252
uniffiEnsureBitwardenVaultInitialized()
7253+
uniffiEnsureBitwardenSendInitialized()
71657254
uniffiEnsureBitwardenEncodingInitialized()
7255+
uniffiEnsureBitwardenCollectionsInitialized()
71667256
uniffiEnsureBitwardenExportersInitialized()
7257+
uniffiEnsureBitwardenFidoInitialized()
7258+
uniffiEnsureBitwardenSshInitialized()
71677259
return InitializationResult.ok
71687260
}()
71697261

Sources/BitwardenSdk/BitwardenSend.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1653,8 +1653,8 @@ private let initializationResult: InitializationResult = {
16531653
return InitializationResult.contractVersionMismatch
16541654
}
16551655

1656-
uniffiEnsureBitwardenCoreInitialized()
16571656
uniffiEnsureBitwardenCryptoInitialized()
1657+
uniffiEnsureBitwardenCoreInitialized()
16581658
return InitializationResult.ok
16591659
}()
16601660

Sources/BitwardenSdk/BitwardenVault.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6510,9 +6510,9 @@ private let initializationResult: InitializationResult = {
65106510
return InitializationResult.contractVersionMismatch
65116511
}
65126512

6513-
uniffiEnsureBitwardenCollectionsInitialized()
65146513
uniffiEnsureBitwardenCoreInitialized()
65156514
uniffiEnsureBitwardenCryptoInitialized()
6515+
uniffiEnsureBitwardenCollectionsInitialized()
65166516
return InitializationResult.ok
65176517
}()
65186518

0 commit comments

Comments
 (0)