@@ -265,23 +265,26 @@ package struct BridgeClient: ~Copyable, Sendable {
265265 // has to be a valid URL, otherwise input validation fails
266266 try " https://dummy.temporal.com " . withByteArrayRef { dummy_target_url in
267267 try " " . withByteArrayRef { empty_string in
268- let options = TemporalCoreClientOptions (
269- target_url: dummy_target_url, // Dummy URL as gRPC connection is handled by Swift
270- client_name: client_name,
271- client_version: client_version,
272- metadata: empty_string,
273- api_key: empty_string,
274- identity: identityBytes,
275- tls_options: nil , // Empty TLS config as auth is handled by Swift
276- retry_options: nil , // Default is picked when passing `nil`
277- keep_alive_options: nil , // Default is picked when passing `nil`, HTTP2 gRPC keep alive enabled.
278- http_connect_proxy_options: nil ,
279- grpc_override_callback: grpcCallback,
280- grpc_override_callback_user_data: grpcCallbackUserDataPointer
281- )
268+ // Pass API key to Rust core if provided
269+ try ( configuration. apiKey ?? " " ) . withByteArrayRef { api_key_bytes in
270+ let options = TemporalCoreClientOptions (
271+ target_url: dummy_target_url, // Dummy URL as gRPC connection is handled by Swift
272+ client_name: client_name,
273+ client_version: client_version,
274+ metadata: empty_string,
275+ api_key: api_key_bytes, // Now passes the actual API key to Rust core
276+ identity: identityBytes,
277+ tls_options: nil , // Empty TLS config as auth is handled by Swift
278+ retry_options: nil , // Default is picked when passing `nil`
279+ keep_alive_options: nil , // Default is picked when passing `nil`, HTTP2 gRPC keep alive enabled.
280+ http_connect_proxy_options: nil ,
281+ grpc_override_callback: grpcCallback,
282+ grpc_override_callback_user_data: grpcCallbackUserDataPointer
283+ )
282284
283- return try withUnsafePointer ( to: options) { unsafe_options in
284- try body ( unsafe_options)
285+ return try withUnsafePointer ( to: options) { unsafe_options in
286+ try body ( unsafe_options)
287+ }
285288 }
286289 }
287290 }
0 commit comments