Using cocoon for Encrypting and Decrypting Data in a Rust Application

I am working on a Rust application where I need to encrypt and decrypt data, specifically, an authentication token. I'm planning to use minicocoon , which is a lightweight version of cocoon , for this purpose. The token should be encrypted when stored to a file and decrypted when needed (must like a encrypted cache).

This is the TokenResponse struct :

use api_request_utils::serde::Deserialize;

#[serde(crate = "api_request_utils::serde")]
pub(crate) struct TokenResponse {
    #[serde(rename = "idToken")]
    id_token : String,
    #[serde(rename = "refreshToken")]
    refresh_token : String,

    #[serde(rename = "expiresIn")]
    expires_in: u16,

So I tried implementing it using the examples but got nowhere , so can someone guide me through how to do this cuz I have no clue about encryption at all

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.