[][src]Struct interledger_stream::ConnectionGenerator

pub struct ConnectionGenerator { /* fields omitted */ }

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]

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]

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]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]