Weave documentation
Filament referencefilament-crypto

filament-crypto · fernet

Source declarations, signatures and documentation for fernet.

Read the current implementation boundaries before integration. This reference reproduces declarations; it omits source comments whose examples or readiness claims have not been verified.

Source: sigil/weave/filament/filament-crypto/src/fernet.rs. SHA-256: 1672ecd1eb737f8a17c69aabcd368a30c818de015e0202e0ea9413fe84299b3c.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

fernet::FernetError

#[derive(Error, Debug)]
pub enum FernetError {
    /// Invalid key size
    #[error("invalid key size: expected 32 bytes, got {0}")]
    InvalidKeySize(usize),

    /// Invalid token format
    #[error("invalid token format: {0}")]
    InvalidToken(String),

    /// Token expired
    #[error("token expired: age {0} seconds exceeds max {1} seconds")]
    TokenExpired(u64, u64),

    /// Base64 decoding error
    #[error("base64 decode error: {0}")]
    Base64Error(String),

    /// Encryption error
    #[error("encryption error: {0}")]
    Encryption(#[from] EncryptionError),

    /// System time error
    #[error("system time error: {0}")]
    SystemTime(String),
}

Source line: 49.

fernet::Fernet

#[derive(ZeroizeOnDrop)]
pub struct Fernet {

}

Source line: 77.

fernet::Fernet::new

pub fn new(key: &[u8]) -> Result<Self, FernetError>;

Source line: 100.

fernet::Fernet::encrypt

pub fn encrypt(&self, data: &[u8]) -> Result<FernetToken, FernetError>;

Source line: 125.

fernet::Fernet::encrypt_at_time

pub fn encrypt_at_time(&self, data: &[u8], timestamp: u64) -> Result<FernetToken, FernetError>;

Source line: 136.

fernet::Fernet::decrypt

pub fn decrypt(&self, token: &FernetToken, ttl: Option<u64>) -> Result<Vec<u8>, FernetError>;

Source line: 183.

fernet::FernetToken

#[derive(Clone, Debug)]
pub struct FernetToken {

}

Source line: 244.

fernet::FernetToken::from_string

pub fn from_string(s: &str) -> Self;

Source line: 250.

fernet::FernetToken::to_string

pub fn to_string(&self) -> String;

Source line: 257.

fernet::FernetToken::as_bytes

pub fn as_bytes(&self) -> &[u8];

Source line: 262.

On this page