pub struct PairedClient { /* private fields */ }
Expand description

A remote signing client that has joined a session and is ready to exchange messages.

Implementations§

Request the signing certificate from the peer.

Examples found in repository?
src/remote_signing/mod.rs (line 544)
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
    fn create_session_and_wait_for_signer(
        mut self,
        initiator: Box<dyn SessionInitiatePeer>,
        session_info_cb: Option<SessionInfoCallback>,
    ) -> Result<InitiatorClient, RemoteSignError> {
        let session_id = initiator.session_id().to_string();

        self.send_request(
            ApiMethod::CreateSession,
            Some(ClientPayload::CreateSession {
                session_id: session_id.clone(),
                ttl: 600,
                context: initiator.session_create_context().map(base64::encode),
            }),
        )?;

        let sjs_base64 = initiator.session_join_string_base64()?;
        let sjs_pem = initiator.session_join_string_pem()?;

        wait_for_expected_server_message(&mut self.ws, ServerMessageType::SessionCreated)?;
        warn!("session successfully created on server");

        if let Some(cb) = session_info_cb {
            cb(&sjs_base64, &sjs_pem)?;
        }

        let res = wait_for_expected_server_message(&mut self.ws, ServerMessageType::SessionJoined)?;

        let joined = res.as_session_joined()?;
        warn!("signer joined session; deriving shared encryption key");

        let context = if let Some(context) = joined.context {
            Some(base64::decode(context)?)
        } else {
            None
        };

        let keys = initiator.negotiate_session(context)?;

        let mut client = PairedClient {
            ws: self.ws,
            session_id,
            keys,
        };

        client.send_ping()?;

        let (signing_cert, signing_chain) = client.request_signing_certificate()?;

        if let Some(name) = signing_cert.subject_common_name() {
            warn!("remote signer will sign with certificate: {}", name);
        }

        Ok(InitiatorClient {
            client: RefCell::new(client),
            signing_cert,
            signing_chain,
        })
    }

Trait Implementations§

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Converts self into T using Into<T>. Read more
Causes self to use its Binary implementation when Debug-formatted.
Causes self to use its Display implementation when Debug-formatted.
Causes self to use its LowerExp implementation when Debug-formatted.
Causes self to use its LowerHex implementation when Debug-formatted.
Causes self to use its Octal implementation when Debug-formatted.
Causes self to use its Pointer implementation when Debug-formatted.
Causes self to use its UpperExp implementation when Debug-formatted.
Causes self to use its UpperHex implementation when Debug-formatted.
Formats each item in a sequence. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Pipes by value. This is generally the method you want to use. Read more
Borrows self and passes that borrow into the pipe function. Read more
Mutably borrows self and passes that borrow into the pipe function. Read more
Borrows self, then passes self.borrow() into the pipe function. Read more
Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Borrows self, then passes self.as_ref() into the pipe function.
Mutably borrows self, then passes self.as_mut() into the pipe function.
Borrows self, then passes self.deref() into the pipe function.
Mutably borrows self, then passes self.deref_mut() into the pipe function.
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
Immutable access to a value. Read more
Mutable access to a value. Read more
Immutable access to the Borrow<B> of a value. Read more
Mutable access to the BorrowMut<B> of a value. Read more
Immutable access to the AsRef<R> view of a value. Read more
Mutable access to the AsMut<R> view of a value. Read more
Immutable access to the Deref::Target of a value. Read more
Mutable access to the Deref::Target of a value. Read more
Calls .tap() only in debug builds, and is erased in release builds.
Calls .tap_mut() only in debug builds, and is erased in release builds.
Calls .tap_borrow() only in debug builds, and is erased in release builds.
Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
Calls .tap_ref() only in debug builds, and is erased in release builds.
Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
Calls .tap_deref() only in debug builds, and is erased in release builds.
Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Attempts to convert self into T using TryInto<T>. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more