Skip to content

Commit 2b20dbc

Browse files
committed
Bump to version v1.0.18 (matrix-rust-sdk/main e89659b)
1 parent f000a92 commit 2b20dbc

File tree

3 files changed

+435
-668
lines changed

3 files changed

+435
-668
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// swift-tools-version:5.9
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33
import PackageDescription
4-
let checksum = "3bfdec1c04cd3c1d197a5f0fcbc6d9980c812fe309a48bcefde6f6bc5b018a93"
5-
let version = "v1.0.17"
4+
let checksum = "2a416a6965f655a8722f10aaad3bf729b3fbb3dbc04fb05edfa291fa7ab6f259"
5+
let version = "v1.0.18"
66
let url = "https://github.com/element-hq/matrix-rust-components-swift/releases/download/\(version)/MatrixSDKFFI.xcframework.zip"
77
let package = Package(
88
name: "MatrixRustSDK",

Sources/MatrixRustSDK/matrix_sdk.swift

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,120 @@ fileprivate struct FfiConverterString: FfiConverter {
433433
}
434434

435435

436+
437+
438+
/**
439+
* The data needed to perform authorization using OpenID Connect.
440+
*/
441+
public protocol OidcAuthorizationDataProtocol : AnyObject {
442+
443+
/**
444+
* The login URL to use for authorization.
445+
*/
446+
func loginUrl() -> String
447+
448+
}
449+
450+
/**
451+
* The data needed to perform authorization using OpenID Connect.
452+
*/
453+
open class OidcAuthorizationData:
454+
OidcAuthorizationDataProtocol {
455+
fileprivate let pointer: UnsafeMutableRawPointer!
456+
457+
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
458+
public struct NoPointer {
459+
public init() {}
460+
}
461+
462+
// TODO: We'd like this to be `private` but for Swifty reasons,
463+
// we can't implement `FfiConverter` without making this `required` and we can't
464+
// make it `required` without making it `public`.
465+
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
466+
self.pointer = pointer
467+
}
468+
469+
/// This constructor can be used to instantiate a fake object.
470+
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
471+
///
472+
/// - Warning:
473+
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
474+
public init(noPointer: NoPointer) {
475+
self.pointer = nil
476+
}
477+
478+
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
479+
return try! rustCall { uniffi_matrix_sdk_fn_clone_oidcauthorizationdata(self.pointer, $0) }
480+
}
481+
// No primary constructor declared for this class.
482+
483+
deinit {
484+
guard let pointer = pointer else {
485+
return
486+
}
487+
488+
try! rustCall { uniffi_matrix_sdk_fn_free_oidcauthorizationdata(pointer, $0) }
489+
}
490+
491+
492+
493+
494+
/**
495+
* The login URL to use for authorization.
496+
*/
497+
open func loginUrl() -> String {
498+
return try! FfiConverterString.lift(try! rustCall() {
499+
uniffi_matrix_sdk_fn_method_oidcauthorizationdata_login_url(self.uniffiClonePointer(),$0
500+
)
501+
})
502+
}
503+
504+
505+
}
506+
507+
public struct FfiConverterTypeOidcAuthorizationData: FfiConverter {
508+
509+
typealias FfiType = UnsafeMutableRawPointer
510+
typealias SwiftType = OidcAuthorizationData
511+
512+
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> OidcAuthorizationData {
513+
return OidcAuthorizationData(unsafeFromRawPointer: pointer)
514+
}
515+
516+
public static func lower(_ value: OidcAuthorizationData) -> UnsafeMutableRawPointer {
517+
return value.uniffiClonePointer()
518+
}
519+
520+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> OidcAuthorizationData {
521+
let v: UInt64 = try readInt(&buf)
522+
// The Rust code won't compile if a pointer won't fit in a UInt64.
523+
// We have to go via `UInt` because that's the thing that's the size of a pointer.
524+
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
525+
if (ptr == nil) {
526+
throw UniffiInternalError.unexpectedNullPointer
527+
}
528+
return try lift(ptr!)
529+
}
530+
531+
public static func write(_ value: OidcAuthorizationData, into buf: inout [UInt8]) {
532+
// This fiddling is because `Int` is the thing that's the same size as a pointer.
533+
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
534+
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
535+
}
536+
}
537+
538+
539+
540+
541+
public func FfiConverterTypeOidcAuthorizationData_lift(_ pointer: UnsafeMutableRawPointer) throws -> OidcAuthorizationData {
542+
return try FfiConverterTypeOidcAuthorizationData.lift(pointer)
543+
}
544+
545+
public func FfiConverterTypeOidcAuthorizationData_lower(_ value: OidcAuthorizationData) -> UnsafeMutableRawPointer {
546+
return FfiConverterTypeOidcAuthorizationData.lower(value)
547+
}
548+
549+
436550
/**
437551
* A set of common power levels required for various operations within a room,
438552
* that can be applied as a single operation. When updating these
@@ -1037,6 +1151,9 @@ private var initializationResult: InitializationResult {
10371151
if bindings_contract_version != scaffolding_contract_version {
10381152
return InitializationResult.contractVersionMismatch
10391153
}
1154+
if (uniffi_matrix_sdk_checksum_method_oidcauthorizationdata_login_url() != 59213) {
1155+
return InitializationResult.apiChecksumMismatch
1156+
}
10401157

10411158
return InitializationResult.ok
10421159
}

0 commit comments

Comments
 (0)