1- use crate :: {
2- Group ,
3- errors:: AuthError ,
4- utils:: {
5- compute_hash, compute_k, compute_m1_legacy, compute_m1_rfc5054, compute_m2, compute_u,
6- monty_form,
7- } ,
8- } ;
1+ use crate :: { errors:: AuthError , groups:: * , utils:: * } ;
92use alloc:: vec:: Vec ;
103use core:: marker:: PhantomData ;
114use crypto_bigint:: { BoxedUint , ConcatenatingMul , Odd , Resize , modular:: BoxedMontyForm } ;
125use digest:: { Digest , Output } ;
136use subtle:: ConstantTimeEq ;
147
8+ /// SRP client configured with a standard 1024-bit group.
9+ pub type ClientG1024 < D > = Client < G1024 , D > ;
10+ /// SRP client configured with a standard 1536-bit group.
11+ pub type ClientG1536 < D > = Client < G1536 , D > ;
12+ /// SRP client configured with a standard 2048-bit group.
13+ pub type ClientG2048 < D > = Client < G2048 , D > ;
14+ /// SRP client configured with a standard 3072-bit group.
15+ pub type ClientG3072 < D > = Client < G3072 , D > ;
16+ /// SRP client configured with a standard 4096-bit group.
17+ pub type ClientG4096 < D > = Client < G4096 , D > ;
18+
1519/// SRP client implementation.
1620///
1721/// # Usage
@@ -22,17 +26,16 @@ use subtle::ConstantTimeEq;
2226/// password hashing algorithm instead (e.g. PBKDF2, argon2 or scrypt).
2327///
2428/// ```rust
25- /// use srp::{G2048, Client};
2629/// use sha2::Sha256;
2730///
28- /// let client = Client::<G2048, Sha256>::new();
31+ /// let client = srp::ClientG2048::< Sha256>::new();
2932/// ```
3033///
3134/// Next send handshake data (username and `a_pub`) to the server and receive
3235/// `salt` and `b_pub`:
3336///
3437/// ```rust
35- /// # let client = srp::Client ::<srp::G2048, sha2::Sha256>::new();
38+ /// # let client = srp::ClientG2048 ::<sha2::Sha256>::new();
3639/// # fn server_response()-> (Vec<u8>, Vec<u8>) { (vec![], vec![]) }
3740///
3841/// let mut a = [0u8; 64];
@@ -45,7 +48,7 @@ use subtle::ConstantTimeEq;
4548/// `process_reply` can return error in case of malicious `b_pub`.
4649///
4750/// ```rust
48- /// # let client = srp::Client ::<srp::G2048, sha2::Sha256>::new();
51+ /// # let client = srp::ClientG2048 ::<sha2::Sha256>::new();
4952/// # let a = [0u8; 64];
5053/// # let username = b"username";
5154/// # let password = b"password";
@@ -61,7 +64,7 @@ use subtle::ConstantTimeEq;
6164/// `verify_server` method will return error in case of incorrect server reply.
6265///
6366/// ```ignore
64- /// # let client = srp::Client ::<srp::G2048, sha2::Sha256>::new();
67+ /// # let client = srp::ClientG2048 ::<sha2::Sha256>::new();
6568/// # let verifier = client.process_reply(b"", b"", b"", b"", b"1").unwrap();
6669/// # fn send_proof(_: &[u8]) -> Vec<u8> { vec![173, 202, 13, 26, 207, 73, 0, 46, 121, 238, 48, 170, 96, 146, 60, 49, 88, 76, 12, 184, 152, 76, 207, 220, 140, 205, 190, 189, 117, 6, 131, 63] }
6770///
@@ -73,7 +76,7 @@ use subtle::ConstantTimeEq;
7376/// `key` contains shared secret key between user and the server. You can extract shared secret
7477/// key using `key()` method.
7578/// ```rust
76- /// # let client = srp::Client ::<srp::G2048, sha2::Sha256>::new();
79+ /// # let client = srp::ClientG2048 ::<sha2::Sha256>::new();
7780/// # let verifier = client.process_reply_legacy(b"", b"", b"", b"", b"1").unwrap();
7881///
7982/// verifier.key();
@@ -86,7 +89,7 @@ use subtle::ConstantTimeEq;
8689/// key in case of correct server data.
8790///
8891/// ```ignore
89- /// # let client = srp::Client ::<srp::G2048, sha2::Sha256>::new();
92+ /// # let client = srp::ClientG2048 ::<sha2::Sha256>::new();
9093/// # let verifier = client.process_reply_rfc5054(b"", b"", b"", b"", b"1").unwrap();
9194/// # fn send_proof(_: &[u8]) -> Vec<u8> { vec![10, 215, 214, 40, 136, 200, 122, 121, 68, 160, 38, 32, 85, 82, 128, 30, 199, 194, 126, 222, 61, 55, 2, 28, 120, 181, 155, 102, 141, 65, 17, 64] }
9295///
@@ -102,7 +105,7 @@ use subtle::ConstantTimeEq;
102105/// Man-in-the-middle (MITM) attack for registration.
103106///
104107/// ```rust
105- /// # let client = srp::Client ::<srp::G2048, sha2::Sha256>::new();
108+ /// # let client = srp::ClientG2048 ::<sha2::Sha256>::new();
106109/// # let username = b"username";
107110/// # let password = b"password";
108111/// # let salt = b"salt";
0 commit comments