/// Create a new Yodeler
///
/// If provided the session transcript SHOULD include a session identifier,
/// an encoding of the known user idenities ( including network ids such as IP/port,
/// MAC address, etc ) and any other additional data that the parties wish to authenticate.
/// The session identifier SHOULD be distinct from any concurrent sessions by the application,
/// and is RECOMMENDED to be a unique, mutually generated, strongly random value so that reuse can not be forced.
///
/// If a transcript is not provided, one will be created and a random
/// session id will be chosen and bound. In this case, the other user MUST use the
/// Handshake.respond method as the symmetry of the protocol has been broken.
///
/// The identity passed SHOULD be self determined and SHOULD NOT change
/// while there are active sessions. Use of an identity which is assigned outside of your control
/// may lead to impersonation attacks in contexts that allow concurrent sessions though
/// attempts have been made to mitigate this possibility.
Create a new Yodeler
If provided the session transcript SHOULD include a session identifier,
an encoding of the known user idenities ( including network ids such as IP/port,
MAC address, etc ) and any other additional data that the parties wish to authenticate.
The session identifier SHOULD be distinct from any concurrent sessions by the application,
and is RECOMMENDED to be a unique, mutually generated, strongly random value so that reuse can not be forced.

If a transcript is not provided, one will be created and a random
session id will be chosen and bound. In this case, the other user MUST use the
Handshake.respond method as the symmetry of the protocol has been broken.

The identity passed SHOULD be self determined and SHOULD NOT change
while there are active sessions. Use of an identity which is assigned outside of your control
may lead to impersonation attacks in contexts that allow concurrent sessions though
attempts have been made to mitigate this possibility.
Create a new Yodeler If provided the session transcript SHOULD include a session identifier an encoding of the known user idenities ( including network ids such as IP / port MAC address etc ) and any other additional data that the parties wish to authenticate . The session identifier SHOULD be distinct from any concurrent sessions by the application and is RECOMMENDED to be a unique mutually generated strongly random value so that reuse can not be forced . If a transcript is not provided one will be created and a random session id will be chosen and bound . In this case the other user MUST use the Handshake . respond method as the symmetry of the protocol has been broken . The identity passed SHOULD be self determined and SHOULD NOT change while there are active sessions . Use of an identity which is assigned outside of your control may lead to impersonation attacks in contexts that allow concurrent sessions though attempts have been made to mitigate this possibility .
pub fn new<T>(
        session_transcript: Option<Strobe>,
        rng: &mut T,
        password: &[u8],
        self_identity: &[u8],
    ) -> (Self, Handshake)
    where
        T: RngCore + CryptoRng,
    {
        let (session_id, mut transcript) = match session_transcript {
            Some(transcript) => (None, transcript),
            None => {
                let mut transcript = Strobe::new(
                    b"https://github.com/evq/yodel/cpace/session/unilateral",
                    SecParam::B128,
                );
                let mut session_id = [0u8; SESSION_ID_LENGTH];
                rng.fill_bytes(&mut session_id[..]);
                transcript.ad(&session_id, false);
                (Some(session_id), transcript)
            }
        };
        // prepare for the protocol becoming full-duplex
        let mut rx_transcript = transcript.clone();
        let mut tx_transcript = transcript.clone();
        // tx/rx domain seperators
        tx_transcript.ad(b"https://github.com/evq/yodel/cpace", false);
        rx_transcript.ad(b"https://github.com/evq/yodel/cpace", false);
        // add the password to the original transcript
        transcript.ad(b"https://github.com/evq/yodel/cpace/password", false);
        transcript.key(password, false);
        // after this point we will no longer be able to use the original transcript which had the
        // password mixed into it. this is to ensure that if a session key is leaked it provides
        // no useful information about the password to an attacker
        let g = transcript_into_generator(transcript);
        // generate a random blind (x)
        let blind = Scalar::random(rng);
        // X = g ^ x
        let blinded_password = (g * blind).compress();
        // NOTE the application instance id and originator id ensure
        // that messages cannot be replayed between concurrent sessions
        // when combined with a check when we complete the handshake
        let application_instance_id = APPLICATION_INSTANCE_ID.get_or_init(|| {
            let mut application_instance_id = [0u8; APPLICATION_INSTANCE_ID_LENGTH];
            rng.fill_bytes(&mut application_instance_id[..]);
            application_instance_id
        });
        let originator_id = derive_originator_id(self_identity);
        let handshake = Handshake {
            session_id,
            originator_id,
            application_instance_id: *application_instance_id,
            blinded_password: blinded_password,
        };
        tx_transcript.send_clr(&handshake.to_bytes(), false);
        (
            Yodeler {
                tx_transcript,
                rx_transcript,
                blind,
                handshake,
                ignore_application_instance_id: false,
            },
            handshake,
        )
    }
pub fn new < T > ( session_transcript : Option < Strobe > , rng : & mut T , password : & [ u8 ] , self_identity : & [ u8 ] , ) -> ( Self , Handshake ) where T : RngCore + CryptoRng , { let ( session_id , mut transcript ) = match session_transcript { Some ( transcript ) => ( None , transcript ) , None => { let mut transcript = Strobe :: new ( b" " , SecParam :: B128 , ) ; let mut session_id = [ 0u8 ; SESSION_ID_LENGTH ] ; rng . fill_bytes ( & mut session_id [ .. ] ) ; transcript . ad ( & session_id , false ) ; ( Some ( session_id ) , transcript ) } } ; // prepare for the protocol becoming full-duplex let mut rx_transcript = transcript . clone ( ) ; let mut tx_transcript = transcript . clone ( ) ; // tx/rx domain seperators tx_transcript . ad ( b" " , false ) ; rx_transcript . ad ( b" " , false ) ; // add the password to the original transcript transcript . ad ( b" " , false ) ; transcript . key ( password , false ) ; // after this point we will no longer be able to use the original transcript which had the // password mixed into it. this is to ensure that if a session key is leaked it provides // no useful information about the password to an attacker let g = transcript_into_generator ( transcript ) ; // generate a random blind (x) let blind = Scalar :: random ( rng ) ; // X = g ^ x let blinded_password = ( g * blind ) . compress ( ) ; // NOTE the application instance id and originator id ensure // that messages cannot be replayed between concurrent sessions // when combined with a check when we complete the handshake let application_instance_id = APPLICATION_INSTANCE_ID . get_or_init ( | | { let mut application_instance_id = [ 0u8 ; APPLICATION_INSTANCE_ID_LENGTH ] ; rng . fill_bytes ( & mut application_instance_id [ .. ] ) ; application_instance_id } ) ; let originator_id = derive_originator_id ( self_identity ) ; let handshake = Handshake { session_id , originator_id , application_instance_id : * application_instance_id , blinded_password : blinded_password , } ; tx_transcript . send_clr ( & handshake . to_bytes ( ) , false ) ; ( Yodeler { tx_transcript , rx_transcript , blind , handshake , ignore_application_instance_id : false , } , handshake , ) }
Create a new Yodeler
If provided the session transcript SHOULD include a session identifier,
an encoding of the known user idenities ( including network ids such as IP/port,
MAC address, etc ) and any other additional data that the parties wish to authenticate.
Create a new Yodeler If provided the session transcript SHOULD include a session identifier an encoding of the known user idenities ( including network ids such as IP / port MAC address etc ) and any other additional data that the parties wish to authenticate .
session_transcript
Option<Strobe>
rng
&mut T
password
&[u8]
self_identity
&[u8]