Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.81.0 # pinned to prevent breakages
toolchain: 1.85.0 # pinned to prevent breakages
components: clippy
override: true
profile: minimal
Expand Down
4 changes: 2 additions & 2 deletions bip32/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ repository = "https://github.com/iqlusioninc/crates/tree/main/bip32"
categories = ["cryptography", "no-std"]
keywords = ["crypto", "bip32", "bip39", "derivation", "mnemonic"]
readme = "README.md"
edition = "2021"
rust-version = "1.81"
edition = "2024"
rust-version = "1.85"

[dependencies]
bs58 = { version = "0.5", default-features = false, features = ["check"] }
Expand Down
4 changes: 2 additions & 2 deletions canonical-path/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ repository = "https://github.com/iqlusioninc/crates/tree/main/canonical-path"
readme = "README.md"
categories = ["filesystem"]
keywords = ["filesystem", "path", "canonicalization"]
edition = "2021"
rust-version = "1.63"
edition = "2024"
rust-version = "1.85"

[badges]
maintenance = { status = "passively-maintained" }
Expand Down
2 changes: 1 addition & 1 deletion canonical-path/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ impl CanonicalPath {
where
P: AsRef<Path> + ?Sized,
{
&*(path.as_ref() as *const Path as *const CanonicalPath)
unsafe { &*(path.as_ref() as *const Path as *const CanonicalPath) }
}

/// Convert a canonical path reference into an owned `CanonicalPathBuf`
Expand Down
4 changes: 2 additions & 2 deletions hkd32/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ repository = "https://github.com/iqlusioninc/crates/tree/main/hkd32"
readme = "README.md"
categories = ["cryptography", "no-std"]
keywords = ["crypto", "bip32", "bip39", "derivation", "mnemonic"]
edition = "2021"
rust-version = "1.63"
edition = "2024"
rust-version = "1.85"

[dependencies]
hmac = { version = "0.12", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion hkd32/src/key_material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! The `KeyMaterial` type is used to represent both input and output key
//! material, and is the primary type useful for deriving other keys.

use crate::{path::Path, Error, KEY_SIZE};
use crate::{Error, KEY_SIZE, path::Path};
use hmac::{Hmac, Mac};
use rand_core::{CryptoRng, RngCore};
use sha2::Sha512;
Expand Down
2 changes: 1 addition & 1 deletion hkd32/src/mnemonic/bits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl Bits for u8 {
}
}

impl<'a> Bits for &'a u8 {
impl Bits for &u8 {
const SIZE: usize = 8;

fn bits(self) -> u32 {
Expand Down
2 changes: 1 addition & 1 deletion hkd32/src/mnemonic/phrase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::{
bits::{BitWriter, IterExt},
language::Language,
};
use crate::{Error, KeyMaterial, Path, KEY_SIZE};
use crate::{Error, KEY_SIZE, KeyMaterial, Path};
use alloc::string::String;
use rand_core::{CryptoRng, RngCore};
use sha2::{Digest, Sha256};
Expand Down
8 changes: 2 additions & 6 deletions hkd32/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

use super::Error;
#[cfg(feature = "alloc")]
use crate::{pathbuf::PathBuf, DELIMITER};
use crate::{DELIMITER, pathbuf::PathBuf};
#[cfg(feature = "alloc")]
use alloc::{str, string::String, vec::Vec};
#[cfg(feature = "alloc")]
Expand Down Expand Up @@ -202,11 +202,7 @@ impl<'a> Component<'a> {
.map(String::from)
.map_err(|_| Error)?;

if s.is_ascii() {
Ok(s)
} else {
Err(Error)
}
if s.is_ascii() { Ok(s) } else { Err(Error) }
}

/// Serialize this component as a length-prefixed bytestring.
Expand Down
2 changes: 1 addition & 1 deletion hkd32/src/pathbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//! This type is only available when the `alloc` feature is enabled.

use crate::{
DELIMITER, Error,
path::{Component, Path},
Error, DELIMITER,
};
use alloc::{borrow::ToOwned, str::FromStr, vec::Vec};
use core::fmt::{self, Debug};
Expand Down
3 changes: 1 addition & 2 deletions hkd32/tests/test_vectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ fn test_key() -> KeyMaterial {
#[cfg(feature = "mnemonic")]
fn test_mnemonic() -> mnemonic::Phrase {
// This phrase is the BIP39 equipvalent of `test_key()` above
let bip39_phrase: &str =
"abandon amount liar amount expire adjust cage candy arch gather drum bullet \
let bip39_phrase: &str = "abandon amount liar amount expire adjust cage candy arch gather drum bullet \
absurd math era live bid rhythm alien crouch range attend journey unaware";

mnemonic::Phrase::new(bip39_phrase, Default::default()).unwrap()
Expand Down
4 changes: 2 additions & 2 deletions iqhttp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ license = "Apache-2.0 OR MIT"
categories = ["network-programming", "web-programming::http-client"]
keywords = ["api", "client", "http", "rest", "web"]
readme = "README.md"
edition = "2021"
rust-version = "1.63"
edition = "2024"
rust-version = "1.85"

[dependencies]
hyper = "0.14.10"
Expand Down
4 changes: 2 additions & 2 deletions iqhttp/src/https_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

use crate::{Path, Query, Result, USER_AGENT};
use hyper::{
Body, Request, Response,
body::Buf,
client::{Client, HttpConnector},
header::{self, HeaderMap, HeaderName, HeaderValue},
Body, Request, Response,
};
use hyper_rustls::HttpsConnector;

Expand Down Expand Up @@ -104,7 +104,7 @@ impl HttpsClient {
}

/// Perform HTTP GET request and return the response body.
pub async fn get_body(&self, path: &Path, query: &Query) -> Result<impl Buf> {
pub async fn get_body(&self, path: &Path, query: &Query) -> Result<impl Buf + use<>> {
// TODO(tarcieri): timeouts
let response = self.get(path, query).await?;
Ok(hyper::body::aggregate(response.into_body()).await?)
Expand Down
2 changes: 1 addition & 1 deletion iqhttp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub use self::{
https_client::HttpsClient,
query::Query,
};
pub use hyper::{self, header, HeaderMap, Uri};
pub use hyper::{self, HeaderMap, Uri, header};

/// User-Agent to send in HTTP request
pub const USER_AGENT: &str = concat!("iqhttp/", env!("CARGO_PKG_VERSION"));
Expand Down
4 changes: 2 additions & 2 deletions iqhttp/src/serializers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// Annotate fields with `#[serde(with = "iqhttp::serializers::uri)]` to use these.
pub mod uri {
use crate::Uri;
use serde::{de, ser, Deserialize, Serialize};
use serde::{Deserialize, Serialize, de, ser};

/// Deserialize [`Uri`].
pub fn deserialize<'de, D>(deserializer: D) -> Result<Uri, D::Error>
Expand All @@ -31,7 +31,7 @@ pub mod uri {
/// Annotate fields with `#[serde(with = "iqhttp::serializers::uri_optional)]` to use these.
pub mod uri_optional {
use crate::Uri;
use serde::{de, ser, Deserialize};
use serde::{Deserialize, de, ser};

/// Deserialize an optional [`Uri`].
pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<Uri>, D::Error>
Expand Down
4 changes: 2 additions & 2 deletions secrecy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ repository = "https://github.com/iqlusioninc/crates/tree/main/secrecy"
readme = "README.md"
categories = ["cryptography", "memory-management", "no-std", "os"]
keywords = ["clear", "memory", "secret", "secure", "wipe"]
edition = "2021"
rust-version = "1.60"
edition = "2024"
rust-version = "1.85"

[dependencies]
zeroize = { version = "1.6", default-features = false, features = ["alloc"] }
Expand Down
2 changes: 1 addition & 1 deletion secrecy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ use core::{
use zeroize::{Zeroize, ZeroizeOnDrop};

#[cfg(feature = "serde")]
use serde::{de, ser, Deserialize, Serialize};
use serde::{Deserialize, Serialize, de, ser};

pub use zeroize;

Expand Down
4 changes: 2 additions & 2 deletions signatory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ repository = "https://github.com/iqlusioninc/crates/tree/main/signatory"
readme = "README.md"
categories = ["authentication", "cryptography"]
keywords = ["cryptography", "ecdsa", "ed25519", "signing", "signatures"]
edition = "2021"
rust-version = "1.65"
edition = "2024"
rust-version = "1.85"

[dependencies]
pkcs8 = { version = "0.10", features = ["alloc", "pem"] }
Expand Down
2 changes: 1 addition & 1 deletion signatory/src/ecdsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub mod secp256k1;
mod keyring;

pub use self::keyring::KeyRing;
pub use ecdsa::{elliptic_curve, Signature};
pub use ecdsa::{Signature, elliptic_curve};

#[cfg(feature = "nistp256")]
pub use {self::nistp256::NistP256Signer, p256::NistP256};
Expand Down
2 changes: 1 addition & 1 deletion signatory/src/ecdsa/nistp256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
pub use p256::ecdsa::{Signature, VerifyingKey};

use crate::{
key::{ring::LoadPkcs8, store::GeneratePkcs8},
Error, KeyHandle, Map, Result,
key::{ring::LoadPkcs8, store::GeneratePkcs8},
};
use alloc::boxed::Box;
use core::fmt;
Expand Down
2 changes: 1 addition & 1 deletion signatory/src/ecdsa/nistp384.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
pub use p384::ecdsa::{Signature, VerifyingKey};

use crate::{
key::{ring::LoadPkcs8, store::GeneratePkcs8},
Error, KeyHandle, Map, Result,
key::{ring::LoadPkcs8, store::GeneratePkcs8},
};
use alloc::boxed::Box;
use core::fmt;
Expand Down
2 changes: 1 addition & 1 deletion signatory/src/ecdsa/secp256k1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
pub use k256::ecdsa::{Signature, VerifyingKey};

use crate::{
key::{ring::LoadPkcs8, store::GeneratePkcs8},
Error, KeyHandle, Map, Result,
key::{ring::LoadPkcs8, store::GeneratePkcs8},
};
use alloc::boxed::Box;
use core::fmt;
Expand Down
4 changes: 2 additions & 2 deletions signatory/src/ed25519/sign.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Ed25519 keys.

use super::{Signature, VerifyingKey, ALGORITHM_ID, ALGORITHM_OID};
use crate::{key::store::GeneratePkcs8, Error, Result};
use super::{ALGORITHM_ID, ALGORITHM_OID, Signature, VerifyingKey};
use crate::{Error, Result, key::store::GeneratePkcs8};
use alloc::boxed::Box;
use core::fmt;
use ed25519_dalek::SECRET_KEY_LENGTH;
Expand Down
4 changes: 2 additions & 2 deletions signatory/src/ed25519/verify.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! Ed25519 keys.

use super::{Signature, ALGORITHM_ID, ALGORITHM_OID};
use super::{ALGORITHM_ID, ALGORITHM_OID, Signature};
use crate::{Error, Result};
use core::cmp::Ordering;
use pkcs8::{der::asn1, EncodePublicKey};
use pkcs8::{EncodePublicKey, der::asn1};
use signature::Verifier;

/// Ed25519 verifying key.
Expand Down
10 changes: 6 additions & 4 deletions signatory/tests/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#![cfg(feature = "secp256k1")]

use signatory::{
FsKeyStore, GeneratePkcs8, KeyName, KeyRing,
ecdsa::secp256k1::{Signature, SigningKey},
signature::{Signer, Verifier},
FsKeyStore, GeneratePkcs8, KeyName, KeyRing,
};

/// Integration test for loading a key from a keystore
Expand All @@ -27,7 +27,9 @@ fn integration() {

let example_message = "Hello, world!";
let signature: Signature = signing_key.sign(example_message.as_bytes());
assert!(verifying_key
.verify(example_message.as_bytes(), &signature)
.is_ok());
assert!(
verifying_key
.verify(example_message.as_bytes(), &signature)
.is_ok()
);
}
4 changes: 2 additions & 2 deletions subtle-encoding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ repository = "https://github.com/iqlusioninc/crates/tree/main/subtle-encoding"
readme = "README.md"
categories = ["cryptography", "encoding", "no-std"]
keywords = ["base64", "bech32", "constant-time", "hex", "security"]
edition = "2021"
rust-version = "1.60"
edition = "2024"
rust-version = "1.85"

[dependencies.zeroize]
version = "1"
Expand Down
31 changes: 20 additions & 11 deletions subtle-encoding/src/bech32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use zeroize::Zeroize;
mod base32;
mod checksum;

use self::checksum::{Checksum, CHECKSUM_SIZE};
use self::checksum::{CHECKSUM_SIZE, Checksum};
use crate::error::Error;
use alloc::{string::String, vec::Vec};

Expand Down Expand Up @@ -256,43 +256,52 @@ mod tests {
encoded: "A12UEL5L",
hrp: "a",
bytes: &[],
upper_case: true
upper_case: true,
},
TestVector {
encoded: "a12uel5l",
hrp: "a",
bytes: &[],
upper_case: false
upper_case: false,
},
TestVector {
encoded: "an83characterlonghumanreadablepartthatcontainsthenumber1andtheexcludedcharactersbio1tt5tgs",
hrp: "an83characterlonghumanreadablepartthatcontainsthenumber1andtheexcludedcharactersbio",
bytes: &[],
upper_case: false
upper_case: false,
},
TestVector {
hrp: "abcdef",
bytes: &[0, 68, 50, 20, 199, 66, 84, 182, 53, 207, 132, 101, 58, 86, 215, 198, 117, 190, 119, 223],
bytes: &[
0, 68, 50, 20, 199, 66, 84, 182, 53, 207, 132, 101, 58, 86, 215, 198, 117, 190,
119, 223,
],
encoded: "abcdef1qpzry9x8gf2tvdw0s3jn54khce6mua7lmqqqxw",
upper_case: false
upper_case: false,
},
TestVector {
encoded: "11qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqc8247j",
hrp: "1",
bytes: &[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
upper_case: false
bytes: &[
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
],
upper_case: false,
},
TestVector {
encoded: "split1checkupstagehandshakeupstreamerranterredcaperred2y9e3w",
hrp: "split",
bytes: &[197, 243, 139, 112, 48, 95, 81, 155, 246, 109, 133, 251, 108, 240, 48, 88, 243, 221, 228, 99, 236, 215, 145, 143, 45, 199, 67, 145, 143, 45],
upper_case: false
bytes: &[
197, 243, 139, 112, 48, 95, 81, 155, 246, 109, 133, 251, 108, 240, 48, 88, 243,
221, 228, 99, 236, 215, 145, 143, 45, 199, 67, 145, 143, 45,
],
upper_case: false,
},
TestVector {
encoded: "?1ezyfcl",
hrp: "?",
bytes: &[],
upper_case: false
upper_case: false,
},
];

Expand Down
2 changes: 1 addition & 1 deletion subtle-encoding/src/bech32/checksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ mod polymod {

pub fn input_byte(&mut self, byte: u8) {
let b = (self.0 >> 25) as u8;
self.0 = (self.0 & 0x1ff_ffff) << 5 ^ u32::from(byte);
self.0 = ((self.0 & 0x1ff_ffff) << 5) ^ u32::from(byte);

for (i, c) in COEFFICIENTS.iter().enumerate() {
if (b >> i) & 1 == 1 {
Expand Down
2 changes: 1 addition & 1 deletion subtle-encoding/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ pub use crate::encoding::Encoding;
pub use crate::error::Error;
#[cfg(feature = "hex")]
pub use crate::hex::Hex;
pub use crate::identity::{Identity, IDENTITY};
pub use crate::identity::{IDENTITY, Identity};
Loading