@@ -1115,6 +1115,94 @@ public func FfiConverterTypeClientBuilder_lower(_ value: ClientBuilder) -> Unsaf
11151115
11161116
11171117
1118+ public protocol ClientSignerProtocol : AnyObject {
1119+
1120+ }
1121+ public class ClientSigner :
1122+ ClientSignerProtocol {
1123+ fileprivate let pointer : UnsafeMutableRawPointer
1124+
1125+ // TODO: We'd like this to be `private` but for Swifty reasons,
1126+ // we can't implement `FfiConverter` without making this `required` and we can't
1127+ // make it `required` without making it `public`.
1128+ required init ( unsafeFromRawPointer pointer: UnsafeMutableRawPointer ) {
1129+ self . pointer = pointer
1130+ }
1131+
1132+ public func uniffiClonePointer( ) -> UnsafeMutableRawPointer {
1133+ return try ! rustCall { uniffi_nostr_sdk_ffi_fn_clone_clientsigner ( self . pointer, $0) }
1134+ }
1135+
1136+ deinit {
1137+ try ! rustCall { uniffi_nostr_sdk_ffi_fn_free_clientsigner ( pointer, $0) }
1138+ }
1139+
1140+
1141+ public static func keys( keys: Keys ) -> ClientSigner {
1142+ return ClientSigner ( unsafeFromRawPointer: try ! rustCall ( ) {
1143+ uniffi_nostr_sdk_ffi_fn_constructor_clientsigner_keys (
1144+ FfiConverterTypeKeys_lower ( keys) , $0)
1145+ } )
1146+ }
1147+
1148+
1149+ public static func nip46( nip46: Nip46Signer ) -> ClientSigner {
1150+ return ClientSigner ( unsafeFromRawPointer: try ! rustCall ( ) {
1151+ uniffi_nostr_sdk_ffi_fn_constructor_clientsigner_nip46 (
1152+ FfiConverterTypeNip46Signer . lower ( nip46) , $0)
1153+ } )
1154+ }
1155+
1156+
1157+
1158+
1159+
1160+
1161+ }
1162+
1163+ public struct FfiConverterTypeClientSigner : FfiConverter {
1164+
1165+ typealias FfiType = UnsafeMutableRawPointer
1166+ typealias SwiftType = ClientSigner
1167+
1168+ public static func lift( _ pointer: UnsafeMutableRawPointer ) throws -> ClientSigner {
1169+ return ClientSigner ( unsafeFromRawPointer: pointer)
1170+ }
1171+
1172+ public static func lower( _ value: ClientSigner ) -> UnsafeMutableRawPointer {
1173+ return value. uniffiClonePointer ( )
1174+ }
1175+
1176+ public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> ClientSigner {
1177+ let v : UInt64 = try readInt ( & buf)
1178+ // The Rust code won't compile if a pointer won't fit in a UInt64.
1179+ // We have to go via `UInt` because that's the thing that's the size of a pointer.
1180+ let ptr = UnsafeMutableRawPointer ( bitPattern: UInt ( truncatingIfNeeded: v) )
1181+ if ( ptr == nil ) {
1182+ throw UniffiInternalError . unexpectedNullPointer
1183+ }
1184+ return try lift ( ptr!)
1185+ }
1186+
1187+ public static func write( _ value: ClientSigner , into buf: inout [ UInt8 ] ) {
1188+ // This fiddling is because `Int` is the thing that's the same size as a pointer.
1189+ // The Rust code won't compile if a pointer won't fit in a `UInt64`.
1190+ writeInt ( & buf, UInt64 ( bitPattern: Int64 ( Int ( bitPattern: lower ( value) ) ) ) )
1191+ }
1192+ }
1193+
1194+
1195+ public func FfiConverterTypeClientSigner_lift( _ pointer: UnsafeMutableRawPointer ) throws -> ClientSigner {
1196+ return try FfiConverterTypeClientSigner . lift ( pointer)
1197+ }
1198+
1199+ public func FfiConverterTypeClientSigner_lower( _ value: ClientSigner ) -> UnsafeMutableRawPointer {
1200+ return FfiConverterTypeClientSigner . lower ( value)
1201+ }
1202+
1203+
1204+
1205+
11181206public protocol Nip46SignerProtocol : AnyObject {
11191207
11201208 /**
@@ -2170,66 +2258,6 @@ public func FfiConverterTypeRelayConnectionStats_lower(_ value: RelayConnectionS
21702258 return FfiConverterTypeRelayConnectionStats . lower ( value)
21712259}
21722260
2173- // Note that we don't yet support `indirect` for enums.
2174- // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
2175- public enum ClientSigner {
2176-
2177- case keys(
2178- signer: Keys
2179- )
2180- case nip46(
2181- signer: Nip46Signer
2182- )
2183- }
2184-
2185- public struct FfiConverterTypeClientSigner : FfiConverterRustBuffer {
2186- typealias SwiftType = ClientSigner
2187-
2188- public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> ClientSigner {
2189- let variant : Int32 = try readInt ( & buf)
2190- switch variant {
2191-
2192- case 1 : return . keys(
2193- signer: try FfiConverterTypeKeys . read ( from: & buf)
2194- )
2195-
2196- case 2 : return . nip46(
2197- signer: try FfiConverterTypeNip46Signer . read ( from: & buf)
2198- )
2199-
2200- default : throw UniffiInternalError . unexpectedEnumCase
2201- }
2202- }
2203-
2204- public static func write( _ value: ClientSigner , into buf: inout [ UInt8 ] ) {
2205- switch value {
2206-
2207-
2208- case let . keys( signer) :
2209- writeInt ( & buf, Int32 ( 1 ) )
2210- FfiConverterTypeKeys . write ( signer, into: & buf)
2211-
2212-
2213- case let . nip46( signer) :
2214- writeInt ( & buf, Int32 ( 2 ) )
2215- FfiConverterTypeNip46Signer . write ( signer, into: & buf)
2216-
2217- }
2218- }
2219- }
2220-
2221-
2222- public func FfiConverterTypeClientSigner_lift( _ buf: RustBuffer ) throws -> ClientSigner {
2223- return try FfiConverterTypeClientSigner . lift ( buf)
2224- }
2225-
2226- public func FfiConverterTypeClientSigner_lower( _ value: ClientSigner ) -> RustBuffer {
2227- return FfiConverterTypeClientSigner . lower ( value)
2228- }
2229-
2230-
2231-
2232-
22332261// Note that we don't yet support `indirect` for enums.
22342262// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
22352263public enum LogLevel {
@@ -3013,7 +3041,7 @@ private var initializationResult: InitializationResult {
30133041 if ( uniffi_nostr_sdk_ffi_checksum_method_client_shutdown ( ) != 18928 ) {
30143042 return InitializationResult . apiChecksumMismatch
30153043 }
3016- if ( uniffi_nostr_sdk_ffi_checksum_method_client_signer ( ) != 8016 ) {
3044+ if ( uniffi_nostr_sdk_ffi_checksum_method_client_signer ( ) != 57777 ) {
30173045 return InitializationResult . apiChecksumMismatch
30183046 }
30193047 if ( uniffi_nostr_sdk_ffi_checksum_method_client_start ( ) != 10767 ) {
@@ -3040,7 +3068,7 @@ private var initializationResult: InitializationResult {
30403068 if ( uniffi_nostr_sdk_ffi_checksum_method_clientbuilder_opts ( ) != 13520 ) {
30413069 return InitializationResult . apiChecksumMismatch
30423070 }
3043- if ( uniffi_nostr_sdk_ffi_checksum_method_clientbuilder_signer ( ) != 47855 ) {
3071+ if ( uniffi_nostr_sdk_ffi_checksum_method_clientbuilder_signer ( ) != 39026 ) {
30443072 return InitializationResult . apiChecksumMismatch
30453073 }
30463074 if ( uniffi_nostr_sdk_ffi_checksum_method_nip46signer_relay_url ( ) != 34734 ) {
@@ -3175,15 +3203,21 @@ private var initializationResult: InitializationResult {
31753203 if ( uniffi_nostr_sdk_ffi_checksum_method_relayconnectionstats_uptime ( ) != 18216 ) {
31763204 return InitializationResult . apiChecksumMismatch
31773205 }
3178- if ( uniffi_nostr_sdk_ffi_checksum_constructor_client_new ( ) != 37668 ) {
3206+ if ( uniffi_nostr_sdk_ffi_checksum_constructor_client_new ( ) != 28400 ) {
31793207 return InitializationResult . apiChecksumMismatch
31803208 }
3181- if ( uniffi_nostr_sdk_ffi_checksum_constructor_client_with_opts ( ) != 53855 ) {
3209+ if ( uniffi_nostr_sdk_ffi_checksum_constructor_client_with_opts ( ) != 54987 ) {
31823210 return InitializationResult . apiChecksumMismatch
31833211 }
31843212 if ( uniffi_nostr_sdk_ffi_checksum_constructor_clientbuilder_new ( ) != 53242 ) {
31853213 return InitializationResult . apiChecksumMismatch
31863214 }
3215+ if ( uniffi_nostr_sdk_ffi_checksum_constructor_clientsigner_keys ( ) != 57808 ) {
3216+ return InitializationResult . apiChecksumMismatch
3217+ }
3218+ if ( uniffi_nostr_sdk_ffi_checksum_constructor_clientsigner_nip46 ( ) != 46208 ) {
3219+ return InitializationResult . apiChecksumMismatch
3220+ }
31873221 if ( uniffi_nostr_sdk_ffi_checksum_constructor_nip46signer_new ( ) != 14708 ) {
31883222 return InitializationResult . apiChecksumMismatch
31893223 }
0 commit comments