[−][src]Struct interledger_stream::ConnectionGenerator
A STREAM connection generator that creates destination_account
and shared_secret
values
based on a single root secret.
This can be reused across multiple STREAM connections so that a single receiver can accept incoming packets for multiple connections.
Methods
impl ConnectionGenerator
[src]
pub fn new(server_secret: Bytes) -> Self
[src]
pub fn generate_address_and_secret(
&self,
base_address: &Address
) -> (Address, [u8; 32])
[src]
&self,
base_address: &Address
) -> (Address, [u8; 32])
Generate the STREAM parameters for the given ILP address and the configured server secret.
The destination_account
is generated such that the shared_secret
can be re-derived
from a Prepare packet's destination and the same server secret.
pub fn rederive_secret(
&self,
destination_account: &Address
) -> Result<[u8; 32], ()>
[src]
&self,
destination_account: &Address
) -> Result<[u8; 32], ()>
Rederive the shared_secret
from a destination_account
.
Although it is not strictly necessary, this uses the same logic as the Javascript STREAM server. Because this STREAM server is intended to be used as part of a node with forwarding capabilities, rather than as a standalone receiver, it will try forwarding any packets that it is unable to decrypt. An alternative algorithm for rederiving the shared secret could include an auth tag to definitively check whether the packet is meant for this receiver before attempting to decrypt the packet. That will be more important if/when we want to use STREAM for sending larger amounts of data and want to avoid copying the STREAM data packet before decrypting it.
This method returns a Result in case we want to change the internal logic in the future.
Trait Implementations
impl Clone for ConnectionGenerator
[src]
fn clone(&self) -> ConnectionGenerator
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl Send for ConnectionGenerator
impl Sync for ConnectionGenerator
impl Unpin for ConnectionGenerator
impl UnwindSafe for ConnectionGenerator
impl RefUnwindSafe for ConnectionGenerator
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,