diff --git a/libs/gl-client-py/glclient/pairing.py b/libs/gl-client-py/glclient/pairing.py index 886384caf..7a236de31 100644 --- a/libs/gl-client-py/glclient/pairing.py +++ b/libs/gl-client-py/glclient/pairing.py @@ -8,8 +8,8 @@ class NewDeviceClient(object): """A Pairing Client for the "new device" flow.""" - def __init__(self, tls: TlsConfig, uri: Optional[str] = None): - self._inner = native.NewDeviceClient(tls=tls.inner, uri=uri) + def __init__(self, creds: Credentials, uri: Optional[str] = None): + self._inner = native.NewDeviceClient(creds=creds, uri=uri) def _recv(self, m): msgs = { diff --git a/libs/gl-client-py/src/pairing.rs b/libs/gl-client-py/src/pairing.rs index 5ac55826a..7779c5c3c 100644 --- a/libs/gl-client-py/src/pairing.rs +++ b/libs/gl-client-py/src/pairing.rs @@ -1,6 +1,5 @@ use crate::credentials::Credentials; use crate::runtime::exec; -use crate::tls::TlsConfig; use bytes::BufMut; use gl_client::pairing::{attestation_device, new_device, PairingSessionData}; use gl_client::pb::scheduler::GetPairingDataResponse; @@ -17,8 +16,8 @@ pub struct NewDeviceClient { #[pymethods] impl NewDeviceClient { #[new] - fn new(tls: TlsConfig, uri: Option) -> Result { - let mut client = new_device::Client::new(tls.inner); + fn new(creds: Credentials, uri: Option) -> Result { + let mut client = new_device::Client::new(creds.inner); if let Some(uri) = uri { client = client.with_uri(uri); diff --git a/libs/gl-client-py/tests/test_pairing.py b/libs/gl-client-py/tests/test_pairing.py index 202cf2253..5be837632 100644 --- a/libs/gl-client-py/tests/test_pairing.py +++ b/libs/gl-client-py/tests/test_pairing.py @@ -16,7 +16,7 @@ def test_pairing_session(sclient, signer, creds): name = "new_device" desc = "my_description" restrs = "method^list" - ps = NewDeviceClient(TlsConfig(creds)) + ps = NewDeviceClient(creds) session = ps.pair_device(name, desc, restrs) session_iter = iter(session) @@ -72,7 +72,7 @@ def test_paring_data_validation(attestation_device, creds): desc = "my description" restrs = "method^list" - dc = NewDeviceClient(TlsConfig(creds)) + dc = NewDeviceClient(creds) session = dc.pair_device(name, desc, restrs) session_iter = iter(session) m = next(session_iter) diff --git a/libs/gl-client/src/pairing/new_device.rs b/libs/gl-client/src/pairing/new_device.rs index 49153a98f..46ddaa241 100644 --- a/libs/gl-client/src/pairing/new_device.rs +++ b/libs/gl-client/src/pairing/new_device.rs @@ -1,6 +1,6 @@ use super::PairingSessionData; use crate::{ - credentials::Device, + credentials::{Device, TlsConfigProvider}, pb::scheduler::{pairing_client::PairingClient, PairDeviceRequest, PairingQr}, tls::{self, TlsConfig}, }; @@ -20,11 +20,14 @@ pub struct Client { } impl Client { - pub fn new(tls: TlsConfig) -> Client { + pub fn new(creds: T) -> Client + where + T: TlsConfigProvider, + { Client { inner: Unconnected(), uri: crate::utils::scheduler_uri(), - tls, + tls: creds.tls_config(), } } }