fn encrypt_encode(&self) -> Result<String, Error> {
        let mut nonce = [0u8; aead::NONCE_LEN];
        rand::thread_rng().fill_bytes(&mut nonce);
        let nonce_string = base64::encode(&nonce);
        let nonce = aead::Nonce::assume_unique_for_key(nonce);
        let mut token = bincode::serialize(&self).map_err(|_| {
            println!("failed to serialize refresh token");
            Error::InternalError
        })?;

        REFRESH_TOKEN_KEY
            .seal_in_place_append_tag(nonce, aead::Aad::empty(), &mut token)
            .map_err(|_| Error::InternalError)?;

        let token_string = base64::encode(&token);
        Ok(format!("{}.{}", nonce_string, token_string))
    }
/// Returns a `String` to be used as a token by client-side code. The data is serialized,
/// encrypted, then base64 encoded.
Returns a `String` to be used as a token by client-side code. The data is serialized,
encrypted, then base64 encoded.
Returns a ` String ` to be used as a token by client - side code . The data is serialized encrypted then base64 encoded .
fn encrypt_encode(&self) -> Result<String, Error> {
        let mut nonce = [0u8; aead::NONCE_LEN];
        rand::thread_rng().fill_bytes(&mut nonce);
        let nonce_string = base64::encode(&nonce);
        let nonce = aead::Nonce::assume_unique_for_key(nonce);
        let mut token = bincode::serialize(&self).map_err(|_| {
            println!("failed to serialize refresh token");
            Error::InternalError
        })?;
        REFRESH_TOKEN_KEY
            .seal_in_place_append_tag(nonce, aead::Aad::empty(), &mut token)
            .map_err(|_| Error::InternalError)?;
        let token_string = base64::encode(&token);
        Ok(format!("{}.{}", nonce_string, token_string))
    }
fn encrypt_encode ( & self ) -> Result < String , Error > { let mut nonce = [ 0u8 ; aead :: NONCE_LEN ] ; rand :: thread_rng ( ) . fill_bytes ( & mut nonce ) ; let nonce_string = base64 :: encode ( & nonce ) ; let nonce = aead :: Nonce :: assume_unique_for_key ( nonce ) ; let mut token = bincode :: serialize ( & self ) . map_err ( | _ | { println ! ( " " ) ; Error :: InternalError } ) ? ; REFRESH_TOKEN_KEY . seal_in_place_append_tag ( nonce , aead :: Aad :: empty ( ) , & mut token ) . map_err ( | _ | Error :: InternalError ) ? ; let token_string = base64 :: encode ( & token ) ; Ok ( format ! ( " " nonce_string token_string ) ) }
Returns a `String` to be used as a token by client-side code.
Returns a ` String ` to be used as a token by client - side code .
&self
&self