Bump version, enable documentation of features in docs.rs

This commit is contained in:
K Shiva Kiran 2024-05-01 11:41:26 +05:30
parent 2b63047eb9
commit 53870a550a
3 changed files with 11 additions and 7 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "false-bottom" name = "false-bottom"
version = "0.3.0" version = "0.3.1"
description = "A deniable encryption scheme" description = "A deniable encryption scheme"
repository = "https://codeberg.org/skran/false-bottom" repository = "https://codeberg.org/skran/false-bottom"
authors = ["K Shiva Kiran <shiva_kr@riseup.net>"] authors = ["K Shiva Kiran <shiva_kr@riseup.net>"]
@ -25,3 +25,7 @@ harness = false
[[example]] [[example]]
name = "export" name = "export"
required-features = ["base64"] required-features = ["base64"]
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

View File

@ -21,7 +21,7 @@ pub trait Encode {
/// Returns the base64 encoded representation of the ciphertext and keybase. /// Returns the base64 encoded representation of the ciphertext and keybase.
/// Requires `base64` feature to be enabled. /// Requires `base64` feature to be enabled.
#[cfg(feature = "base64")] #[cfg_attr(docsrs, doc(cfg(feature = "base64")))]
fn to_base64(&self) -> (String, String); fn to_base64(&self) -> (String, String);
/// Constructs the `FbObj` from the provided base64 encoded forms of /// Constructs the `FbObj` from the provided base64 encoded forms of
@ -30,7 +30,7 @@ pub trait Encode {
/// # Errors /// # Errors
/// - [DecodeError](FbError::DecodeError) /// - [DecodeError](FbError::DecodeError)
/// - [InvalidParams](FbError::InvalidParams) - Are the parameters in the wrong order? /// - [InvalidParams](FbError::InvalidParams) - Are the parameters in the wrong order?
#[cfg(feature = "base64")] #[cfg_attr(docsrs, doc(cfg(feature = "base64")))]
fn from_base64(cipher: &str, keybase: &str) -> Result<Self, FbError> fn from_base64(cipher: &str, keybase: &str) -> Result<Self, FbError>
where where
Self: Sized; Self: Sized;
@ -68,14 +68,14 @@ where
Ok(FbObj {c, r}) Ok(FbObj {c, r})
} }
#[cfg(feature = "base64")] #[cfg_attr(docsrs, doc(cfg(feature = "base64")))]
fn to_base64(&self) -> (String, String) { fn to_base64(&self) -> (String, String) {
let (c, r) = self.to_bytes(); let (c, r) = self.to_bytes();
(BASE64_STANDARD.encode(c), BASE64_STANDARD.encode(r)) (BASE64_STANDARD.encode(c), BASE64_STANDARD.encode(r))
} }
#[cfg(feature = "base64")] #[cfg_attr(docsrs, doc(cfg(feature = "base64")))]
fn from_base64(cipher: &str, keybase: &str) -> Result<Self, FbError> { fn from_base64(cipher: &str, keybase: &str) -> Result<Self, FbError> {
let c_bytes = BASE64_STANDARD.decode(cipher) let c_bytes = BASE64_STANDARD.decode(cipher)
.map_err(|_| FbError::DecodeError)?; .map_err(|_| FbError::DecodeError)?;

View File

@ -1,4 +1,5 @@
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
#![cfg_attr(docsrs, feature(doc_cfg))]
//! ## Usage //! ## Usage
//! False Bottom is a [deniable encryption](https://en.wikipedia.org/wiki/Deniable_encryption) scheme. //! False Bottom is a [deniable encryption](https://en.wikipedia.org/wiki/Deniable_encryption) scheme.
//! Unlike traditional encryption algorithms that map a given plaintext to ciphertext, //! Unlike traditional encryption algorithms that map a given plaintext to ciphertext,
@ -83,13 +84,12 @@ mod packing;
pub use crate::{ pub use crate::{
encode::Encode, encode::Encode,
falsebottom::FalseBottom, falsebottom::FalseBottom,
fbobj::{Fb128, Fb256, Fb512}, fbobj::{Fb128, Fb256, Fb512, FbObj},
fbkey::FbKey, fbkey::FbKey,
fberror::FbError, fberror::FbError,
}; };
use crate::{ use crate::{
fbobj::FbObj,
packing::Packing, packing::Packing,
primefield::PrimeField, primefield::PrimeField,
}; };