Skip to content

Commit a6987cf

Browse files
authored
Release dfdbf7df0d8642f440177c6ef6abe5f04b63c2c4 (#19)
1 parent 7fe0558 commit a6987cf

9 files changed

+141
-93
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ let package = Package(
2727
swiftSettings: [.unsafeFlags(["-suppress-warnings"])]),
2828
.binaryTarget(
2929
name: "BitwardenFFI",
30-
url: "https://bwlivefronttest.blob.core.windows.net/sdk/6311733-BitwardenFFI.xcframework.zip",
31-
checksum: "bfd5d95b5198cc462d4e93c992f2e6ae0ff5eb9de29009f2b4a05f64e9b6ff8b"),
30+
url: "https://bwlivefronttest.blob.core.windows.net/sdk/dfdbf7d-BitwardenFFI.xcframework.zip",
31+
checksum: "6ec71db8879e53f3a22cb68822d416e72f306b28bfda26c8c49777afd96334eb"),
3232
.testTarget(
3333
name: "BitwardenSdkTests",
3434
dependencies: ["BitwardenSdk"])

Sources/BitwardenSdk/BitwardenCore.swift

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ fileprivate func writeDouble(_ writer: inout [UInt8], _ value: Double) {
153153
}
154154

155155
// Protocol for types that transfer other types across the FFI. This is
156-
// analogous go the Rust trait of the same name.
156+
// analogous to the Rust trait of the same name.
157157
fileprivate protocol FfiConverter {
158158
associatedtype FfiType
159159
associatedtype SwiftType
@@ -253,18 +253,19 @@ fileprivate extension RustCallStatus {
253253
}
254254

255255
private func rustCall<T>(_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
256-
try makeRustCall(callback, errorHandler: nil)
256+
let neverThrow: ((RustBuffer) throws -> Never)? = nil
257+
return try makeRustCall(callback, errorHandler: neverThrow)
257258
}
258259

259-
private func rustCallWithError<T>(
260-
_ errorHandler: @escaping (RustBuffer) throws -> Error,
260+
private func rustCallWithError<T, E: Swift.Error>(
261+
_ errorHandler: @escaping (RustBuffer) throws -> E,
261262
_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
262263
try makeRustCall(callback, errorHandler: errorHandler)
263264
}
264265

265-
private func makeRustCall<T>(
266+
private func makeRustCall<T, E: Swift.Error>(
266267
_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T,
267-
errorHandler: ((RustBuffer) throws -> Error)?
268+
errorHandler: ((RustBuffer) throws -> E)?
268269
) throws -> T {
269270
uniffiEnsureInitialized()
270271
var callStatus = RustCallStatus.init()
@@ -273,9 +274,9 @@ private func makeRustCall<T>(
273274
return returnedVal
274275
}
275276

276-
private func uniffiCheckCallStatus(
277+
private func uniffiCheckCallStatus<E: Swift.Error>(
277278
callStatus: RustCallStatus,
278-
errorHandler: ((RustBuffer) throws -> Error)?
279+
errorHandler: ((RustBuffer) throws -> E)?
279280
) throws {
280281
switch callStatus.code {
281282
case CALL_SUCCESS:
@@ -1879,9 +1880,9 @@ private enum InitializationResult {
18791880
case contractVersionMismatch
18801881
case apiChecksumMismatch
18811882
}
1882-
// Use a global variables to perform the versioning checks. Swift ensures that
1883+
// Use a global variable to perform the versioning checks. Swift ensures that
18831884
// the code inside is only computed once.
1884-
private var initializationResult: InitializationResult {
1885+
private var initializationResult: InitializationResult = {
18851886
// Get the bindings contract version from our ComponentInterface
18861887
let bindings_contract_version = 26
18871888
// Get the scaffolding contract version by calling the into the dylib
@@ -1891,7 +1892,7 @@ private var initializationResult: InitializationResult {
18911892
}
18921893

18931894
return InitializationResult.ok
1894-
}
1895+
}()
18951896

18961897
private func uniffiEnsureInitialized() {
18971898
switch initializationResult {

Sources/BitwardenSdk/BitwardenCrypto.swift

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ fileprivate func writeDouble(_ writer: inout [UInt8], _ value: Double) {
153153
}
154154

155155
// Protocol for types that transfer other types across the FFI. This is
156-
// analogous go the Rust trait of the same name.
156+
// analogous to the Rust trait of the same name.
157157
fileprivate protocol FfiConverter {
158158
associatedtype FfiType
159159
associatedtype SwiftType
@@ -253,18 +253,19 @@ fileprivate extension RustCallStatus {
253253
}
254254

255255
private func rustCall<T>(_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
256-
try makeRustCall(callback, errorHandler: nil)
256+
let neverThrow: ((RustBuffer) throws -> Never)? = nil
257+
return try makeRustCall(callback, errorHandler: neverThrow)
257258
}
258259

259-
private func rustCallWithError<T>(
260-
_ errorHandler: @escaping (RustBuffer) throws -> Error,
260+
private func rustCallWithError<T, E: Swift.Error>(
261+
_ errorHandler: @escaping (RustBuffer) throws -> E,
261262
_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
262263
try makeRustCall(callback, errorHandler: errorHandler)
263264
}
264265

265-
private func makeRustCall<T>(
266+
private func makeRustCall<T, E: Swift.Error>(
266267
_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T,
267-
errorHandler: ((RustBuffer) throws -> Error)?
268+
errorHandler: ((RustBuffer) throws -> E)?
268269
) throws -> T {
269270
uniffiEnsureInitialized()
270271
var callStatus = RustCallStatus.init()
@@ -273,9 +274,9 @@ private func makeRustCall<T>(
273274
return returnedVal
274275
}
275276

276-
private func uniffiCheckCallStatus(
277+
private func uniffiCheckCallStatus<E: Swift.Error>(
277278
callStatus: RustCallStatus,
278-
errorHandler: ((RustBuffer) throws -> Error)?
279+
errorHandler: ((RustBuffer) throws -> E)?
279280
) throws {
280281
switch callStatus.code {
281282
case CALL_SUCCESS:
@@ -834,9 +835,9 @@ private enum InitializationResult {
834835
case contractVersionMismatch
835836
case apiChecksumMismatch
836837
}
837-
// Use a global variables to perform the versioning checks. Swift ensures that
838+
// Use a global variable to perform the versioning checks. Swift ensures that
838839
// the code inside is only computed once.
839-
private var initializationResult: InitializationResult {
840+
private var initializationResult: InitializationResult = {
840841
// Get the bindings contract version from our ComponentInterface
841842
let bindings_contract_version = 26
842843
// Get the scaffolding contract version by calling the into the dylib
@@ -846,7 +847,7 @@ private var initializationResult: InitializationResult {
846847
}
847848

848849
return InitializationResult.ok
849-
}
850+
}()
850851

851852
private func uniffiEnsureInitialized() {
852853
switch initializationResult {

Sources/BitwardenSdk/BitwardenExporters.swift

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ fileprivate func writeDouble(_ writer: inout [UInt8], _ value: Double) {
153153
}
154154

155155
// Protocol for types that transfer other types across the FFI. This is
156-
// analogous go the Rust trait of the same name.
156+
// analogous to the Rust trait of the same name.
157157
fileprivate protocol FfiConverter {
158158
associatedtype FfiType
159159
associatedtype SwiftType
@@ -253,18 +253,19 @@ fileprivate extension RustCallStatus {
253253
}
254254

255255
private func rustCall<T>(_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
256-
try makeRustCall(callback, errorHandler: nil)
256+
let neverThrow: ((RustBuffer) throws -> Never)? = nil
257+
return try makeRustCall(callback, errorHandler: neverThrow)
257258
}
258259

259-
private func rustCallWithError<T>(
260-
_ errorHandler: @escaping (RustBuffer) throws -> Error,
260+
private func rustCallWithError<T, E: Swift.Error>(
261+
_ errorHandler: @escaping (RustBuffer) throws -> E,
261262
_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
262263
try makeRustCall(callback, errorHandler: errorHandler)
263264
}
264265

265-
private func makeRustCall<T>(
266+
private func makeRustCall<T, E: Swift.Error>(
266267
_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T,
267-
errorHandler: ((RustBuffer) throws -> Error)?
268+
errorHandler: ((RustBuffer) throws -> E)?
268269
) throws -> T {
269270
uniffiEnsureInitialized()
270271
var callStatus = RustCallStatus.init()
@@ -273,9 +274,9 @@ private func makeRustCall<T>(
273274
return returnedVal
274275
}
275276

276-
private func uniffiCheckCallStatus(
277+
private func uniffiCheckCallStatus<E: Swift.Error>(
277278
callStatus: RustCallStatus,
278-
errorHandler: ((RustBuffer) throws -> Error)?
279+
errorHandler: ((RustBuffer) throws -> E)?
279280
) throws {
280281
switch callStatus.code {
281282
case CALL_SUCCESS:
@@ -489,9 +490,9 @@ private enum InitializationResult {
489490
case contractVersionMismatch
490491
case apiChecksumMismatch
491492
}
492-
// Use a global variables to perform the versioning checks. Swift ensures that
493+
// Use a global variable to perform the versioning checks. Swift ensures that
493494
// the code inside is only computed once.
494-
private var initializationResult: InitializationResult {
495+
private var initializationResult: InitializationResult = {
495496
// Get the bindings contract version from our ComponentInterface
496497
let bindings_contract_version = 26
497498
// Get the scaffolding contract version by calling the into the dylib
@@ -501,7 +502,7 @@ private var initializationResult: InitializationResult {
501502
}
502503

503504
return InitializationResult.ok
504-
}
505+
}()
505506

506507
private func uniffiEnsureInitialized() {
507508
switch initializationResult {

Sources/BitwardenSdk/BitwardenFido.swift

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ fileprivate func writeDouble(_ writer: inout [UInt8], _ value: Double) {
153153
}
154154

155155
// Protocol for types that transfer other types across the FFI. This is
156-
// analogous go the Rust trait of the same name.
156+
// analogous to the Rust trait of the same name.
157157
fileprivate protocol FfiConverter {
158158
associatedtype FfiType
159159
associatedtype SwiftType
@@ -253,18 +253,19 @@ fileprivate extension RustCallStatus {
253253
}
254254

255255
private func rustCall<T>(_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
256-
try makeRustCall(callback, errorHandler: nil)
256+
let neverThrow: ((RustBuffer) throws -> Never)? = nil
257+
return try makeRustCall(callback, errorHandler: neverThrow)
257258
}
258259

259-
private func rustCallWithError<T>(
260-
_ errorHandler: @escaping (RustBuffer) throws -> Error,
260+
private func rustCallWithError<T, E: Swift.Error>(
261+
_ errorHandler: @escaping (RustBuffer) throws -> E,
261262
_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
262263
try makeRustCall(callback, errorHandler: errorHandler)
263264
}
264265

265-
private func makeRustCall<T>(
266+
private func makeRustCall<T, E: Swift.Error>(
266267
_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T,
267-
errorHandler: ((RustBuffer) throws -> Error)?
268+
errorHandler: ((RustBuffer) throws -> E)?
268269
) throws -> T {
269270
uniffiEnsureInitialized()
270271
var callStatus = RustCallStatus.init()
@@ -273,9 +274,9 @@ private func makeRustCall<T>(
273274
return returnedVal
274275
}
275276

276-
private func uniffiCheckCallStatus(
277+
private func uniffiCheckCallStatus<E: Swift.Error>(
277278
callStatus: RustCallStatus,
278-
errorHandler: ((RustBuffer) throws -> Error)?
279+
errorHandler: ((RustBuffer) throws -> E)?
279280
) throws {
280281
switch callStatus.code {
281282
case CALL_SUCCESS:
@@ -2138,9 +2139,9 @@ private enum InitializationResult {
21382139
case contractVersionMismatch
21392140
case apiChecksumMismatch
21402141
}
2141-
// Use a global variables to perform the versioning checks. Swift ensures that
2142+
// Use a global variable to perform the versioning checks. Swift ensures that
21422143
// the code inside is only computed once.
2143-
private var initializationResult: InitializationResult {
2144+
private var initializationResult: InitializationResult = {
21442145
// Get the bindings contract version from our ComponentInterface
21452146
let bindings_contract_version = 26
21462147
// Get the scaffolding contract version by calling the into the dylib
@@ -2150,7 +2151,7 @@ private var initializationResult: InitializationResult {
21502151
}
21512152

21522153
return InitializationResult.ok
2153-
}
2154+
}()
21542155

21552156
private func uniffiEnsureInitialized() {
21562157
switch initializationResult {

Sources/BitwardenSdk/BitwardenGenerators.swift

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ fileprivate func writeDouble(_ writer: inout [UInt8], _ value: Double) {
153153
}
154154

155155
// Protocol for types that transfer other types across the FFI. This is
156-
// analogous go the Rust trait of the same name.
156+
// analogous to the Rust trait of the same name.
157157
fileprivate protocol FfiConverter {
158158
associatedtype FfiType
159159
associatedtype SwiftType
@@ -253,18 +253,19 @@ fileprivate extension RustCallStatus {
253253
}
254254

255255
private func rustCall<T>(_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
256-
try makeRustCall(callback, errorHandler: nil)
256+
let neverThrow: ((RustBuffer) throws -> Never)? = nil
257+
return try makeRustCall(callback, errorHandler: neverThrow)
257258
}
258259

259-
private func rustCallWithError<T>(
260-
_ errorHandler: @escaping (RustBuffer) throws -> Error,
260+
private func rustCallWithError<T, E: Swift.Error>(
261+
_ errorHandler: @escaping (RustBuffer) throws -> E,
261262
_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
262263
try makeRustCall(callback, errorHandler: errorHandler)
263264
}
264265

265-
private func makeRustCall<T>(
266+
private func makeRustCall<T, E: Swift.Error>(
266267
_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T,
267-
errorHandler: ((RustBuffer) throws -> Error)?
268+
errorHandler: ((RustBuffer) throws -> E)?
268269
) throws -> T {
269270
uniffiEnsureInitialized()
270271
var callStatus = RustCallStatus.init()
@@ -273,9 +274,9 @@ private func makeRustCall<T>(
273274
return returnedVal
274275
}
275276

276-
private func uniffiCheckCallStatus(
277+
private func uniffiCheckCallStatus<E: Swift.Error>(
277278
callStatus: RustCallStatus,
278-
errorHandler: ((RustBuffer) throws -> Error)?
279+
errorHandler: ((RustBuffer) throws -> E)?
279280
) throws {
280281
switch callStatus.code {
281282
case CALL_SUCCESS:
@@ -1095,9 +1096,9 @@ private enum InitializationResult {
10951096
case contractVersionMismatch
10961097
case apiChecksumMismatch
10971098
}
1098-
// Use a global variables to perform the versioning checks. Swift ensures that
1099+
// Use a global variable to perform the versioning checks. Swift ensures that
10991100
// the code inside is only computed once.
1100-
private var initializationResult: InitializationResult {
1101+
private var initializationResult: InitializationResult = {
11011102
// Get the bindings contract version from our ComponentInterface
11021103
let bindings_contract_version = 26
11031104
// Get the scaffolding contract version by calling the into the dylib
@@ -1107,7 +1108,7 @@ private var initializationResult: InitializationResult {
11071108
}
11081109

11091110
return InitializationResult.ok
1110-
}
1111+
}()
11111112

11121113
private func uniffiEnsureInitialized() {
11131114
switch initializationResult {

0 commit comments

Comments
 (0)