Skip to content

Commit edd061c

Browse files
committed
rebase changes
1 parent 4c0db92 commit edd061c

8 files changed

Lines changed: 30 additions & 19 deletions

File tree

mfkdf2/src/definitions/bytearray.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Generic ByteArray type for FFI boundaries, typically used for fixed-size byte arrays like keys
2+
//! and salts.
13
use serde::{Deserialize, Serialize};
24

35
/// Generic fixed-size byte array used as the basis for key-like types.

mfkdf2/src/definitions/mod.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1-
pub mod bytearray;
2-
pub mod mfkdf_derived_key;
3-
use serde::{Deserialize, Serialize};
4-
#[cfg(feature = "bindings")] mod uniffi_types;
5-
1+
//! # MFKDF2 Definitions
2+
//!
3+
//! This module contains the definitions for the MFKDF2 protocol.
4+
//!
5+
//! - [`MFKDF2Options`]: Options for setting up a [`MFKDF2DerivedKey`] key.
6+
//! - [`MFKDF2Entropy`]: Entropy estimation for the derived key.
7+
//! - [`MFKDF2Factor`]: Factor type.
8+
//! - [`MFKDF2DerivedKey`]: Derived key after setup or derive operation.
9+
//! - [`FactorMetadata`]: Trait for factor metadata.
10+
//! - [`FactorType`]: Factor type enum.
11+
//! - [`ByteArray`]: Generic byte array type.
12+
//! - [`Key`]: 32 byte key.
13+
//! - [`Salt`]: 32 byte salt.
14+
mod bytearray;
615
mod entropy;
716
pub mod factor;
817
pub mod mfkdf_derived_key;

mfkdf2/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![doc = include_str!("../README.md")]
2-
#![warn(missing_docs, rustdoc::missing_doc_code_examples)]
2+
#![warn(missing_docs)]
33
#![warn(unused_extern_crates, unreachable_pub, nonstandard_style)]
44

55
pub mod constants;

mfkdf2/src/otpauth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub struct OtpAuthUrlOptions {
8686
pub counter: Option<u64>,
8787
/// The period parameter defines a validity period in seconds for the TOTP code. It is only
8888
/// applicable for TOTP credentials and defaults to 30 seconds
89-
pub period: Option<u64>,
89+
pub period: Option<u32>,
9090
/// The encoding of the secret
9191
pub encoding: Option<Encoding>,
9292
/// The hash algorithm to use for the credential

mfkdf2/src/setup/factors/stack.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ use serde::{Deserialize, Serialize};
99
use serde_json::Value;
1010

1111
use crate::{
12-
definitions::{FactorMetadata, FactorType, Key, MFKDF2DerivedKey, MFKDF2Factor, Salt},
12+
definitions::{
13+
FactorMetadata, FactorType, Key, MFKDF2DerivedKey, MFKDF2Factor, MFKDF2Options, Salt,
14+
},
1315
error::{MFKDF2Error, MFKDF2Result},
1416
setup::{FactorSetup, key},
1517
};

mfkdf2/src/setup/key.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,12 @@ use crate::{
117117
/// };
118118
///
119119
/// let factor = password("password123", PasswordOptions { id: Some("pw".to_string()) })?;
120-
/// let salt = vec![42u8; 32];
121-
/// let options =
122-
/// MFKDF2Options {
123-
/// id: Some("my‑policy‑id".to_string()), salt: Some(salt), ..Default::default()
124-
/// };
120+
/// let salt = [42u8; 32];
121+
/// let options = MFKDF2Options {
122+
/// id: Some("my‑policy‑id".to_string()),
123+
/// salt: Some(salt.into()),
124+
/// ..Default::default()
125+
/// };
125126
///
126127
/// let setup_key = setup::key(&[factor], options)?;
127128
///

mfkdf2/tests/integration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ fn totp_static() -> Result<(), mfkdf2::error::MFKDF2Error> {
250250
time: Some(1),
251251
..Default::default()
252252
})?],
253-
mfkdf2::setup::key::MFKDF2Options::default(),
253+
mfkdf2::definitions::MFKDF2Options::default(),
254254
)?;
255255

256256
let derived_key1 = mfkdf2::derive::key(

mfkdf2/tests/integrity.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ use crate::common::{create_derive_factor, create_setup_factor};
1414
fn make_policy(setup_factor_names: &[&str], threshold: u8, integrity: bool) -> MFKDF2DerivedKey {
1515
let setup_factors: Vec<_> = setup_factor_names.iter().copied().map(create_setup_factor).collect();
1616

17-
let options = mfkdf2::setup::key::MFKDF2Options {
18-
threshold: Some(threshold),
19-
integrity: Some(integrity),
20-
..Default::default()
21-
};
17+
let options =
18+
MFKDF2Options { threshold: Some(threshold), integrity: Some(integrity), ..Default::default() };
2219

2320
mfkdf2::setup::key(&setup_factors, options).unwrap()
2421
}

0 commit comments

Comments
 (0)