pub fn with_transport<I>(id: I, key: &EcdsaSecretKey, transport: T) -> Result<Self>
    where
        I: AsRef<[u8]>,
    {
        let (id_ptr, id_len) = into_raw_parts(id.as_ref());
        let (key_ptr, key_len) = into_raw_parts(key.as_ref());
        let delegate = SecureSessionDelegate::new(transport);

        let user_callbacks = delegate.user_callbacks();
        let session_ctx = unsafe {
            secure_session_create(
                id_ptr as *const c_void,
                id_len,
                key_ptr as *const c_void,
                key_len,
                user_callbacks,
            )
        };

        if session_ctx.is_null() {
            // Technically, this may be an allocation error but we have no way to know so just
            // assume that the user messed up and provided invalid keys (which is more likely).
            return Err(Error::with_kind(ErrorKind::InvalidParameter));
        }

        Ok(Self {
            session_ctx,
            _delegate: delegate,
        })
    }
/// Creates a new Secure Session.
///
/// ID is an arbitrary byte sequence used to identify this peer.
///
/// Secure Session supports only ECDSA keys.
Creates a new Secure Session.
ID is an arbitrary byte sequence used to identify this peer.

Secure Session supports only ECDSA keys.
Creates a new Secure Session . ID is an arbitrary byte sequence used to identify this peer . Secure Session supports only ECDSA keys .
pub fn with_transport<I>(id: I, key: &EcdsaSecretKey, transport: T) -> Result<Self>
    where
        I: AsRef<[u8]>,
    {
        let (id_ptr, id_len) = into_raw_parts(id.as_ref());
        let (key_ptr, key_len) = into_raw_parts(key.as_ref());
        let delegate = SecureSessionDelegate::new(transport);
        let user_callbacks = delegate.user_callbacks();
        let session_ctx = unsafe {
            secure_session_create(
                id_ptr as *const c_void,
                id_len,
                key_ptr as *const c_void,
                key_len,
                user_callbacks,
            )
        };
        if session_ctx.is_null() {
            // Technically, this may be an allocation error but we have no way to know so just
            // assume that the user messed up and provided invalid keys (which is more likely).
            return Err(Error::with_kind(ErrorKind::InvalidParameter));
        }
        Ok(Self {
            session_ctx,
            _delegate: delegate,
        })
    }
pub fn with_transport < I > ( id : I , key : & EcdsaSecretKey , transport : T ) -> Result < Self > where I : AsRef < [ u8 ] > , { let ( id_ptr , id_len ) = into_raw_parts ( id . as_ref ( ) ) ; let ( key_ptr , key_len ) = into_raw_parts ( key . as_ref ( ) ) ; let delegate = SecureSessionDelegate :: new ( transport ) ; let user_callbacks = delegate . user_callbacks ( ) ; let session_ctx = unsafe { secure_session_create ( id_ptr as * const c_void , id_len , key_ptr as * const c_void , key_len , user_callbacks , ) } ; if session_ctx . is_null ( ) { // Technically, this may be an allocation error but we have no way to know so just // assume that the user messed up and provided invalid keys (which is more likely). return Err ( Error :: with_kind ( ErrorKind :: InvalidParameter ) ) ; } Ok ( Self { session_ctx , _delegate : delegate , } ) }
Creates a new Secure Session.
Creates a new Secure Session .
id
I
key
&EcdsaSecretKey
transport
T
id
I
key
&EcdsaSecretKey
transport
T