Skip to content

Commit 009ded0

Browse files
authoredJun 9, 2021
Replace the num dependency with more specific parts (#219)
This removes 4 dependencies.
1 parent 53e94cd commit 009ded0

File tree

9 files changed

+15
-59
lines changed

9 files changed

+15
-59
lines changed
 

‎Cargo.lock

Lines changed: 2 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ doc = true
2727
chrono = "0.4.19"
2828
data-encoding = "2.3.2"
2929
once_cell = "1.7.2"
30-
num = "0.4"
30+
num-bigint = "0.4"
31+
num-traits = "0.2"
3132
ring = "~0.16.20"
3233
serde = { version = "1.0.126", features=["derive"] }
3334
serde_json = { version = "1.0", features = ["preserve_order"] }

‎src/jwa.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ mod tests {
881881

882882
#[test]
883883
fn sign_and_verify_rs256_key_params() {
884-
use num::BigUint;
884+
use num_bigint::BigUint;
885885
// There is no way in Ring right now to get these values from the key
886886
let params = Secret::RSAModulusExponent {
887887
n: BigUint::parse_bytes(

‎src/jwe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ impl From<RegisteredHeader> for Header<Empty> {
269269
/// // We need to create an `EncryptionOptions` with a nonce for AES GCM encryption.
270270
/// // You must take care NOT to reuse the nonce. You can simply treat the nonce as a 96 bit
271271
/// // counter that is incremented after every use
272-
/// let mut nonce_counter = num::BigUint::from_bytes_le(&vec![0; 96 / 8]);
272+
/// let mut nonce_counter = num_bigint::BigUint::from_bytes_le(&vec![0; 96 / 8]);
273273
/// // Make sure it's no more than 96 bits!
274274
/// assert!(nonce_counter.bits() <= 96);
275275
/// let mut nonce_bytes = nonce_counter.to_bytes_le();

‎src/jwk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use std::fmt;
66

77
use data_encoding::BASE64URL_NOPAD;
8-
use num::BigUint;
8+
use num_bigint::BigUint;
99
use serde::de::{self, DeserializeOwned};
1010
use serde::{self, Deserialize, Deserializer, Serialize, Serializer};
1111

‎src/jws.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::jwa::SignatureAlgorithm;
1313
use crate::jwk;
1414
use crate::{CompactJson, Empty};
1515

16-
use num::BigUint;
16+
use num_bigint::BigUint;
1717
use ring::signature;
1818
use serde::{self, de::DeserializeOwned, Deserialize, Serialize};
1919
use std::sync::Arc;

‎src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ pub type JWT<T, H> = jws::Compact<ClaimsSet<T>, H>;
272272
/// // We need to create an `EncryptionOptions` with a nonce for AES GCM encryption.
273273
/// // You must take care NOT to reuse the nonce. You can simply treat the nonce as a 96 bit
274274
/// // counter that is incremented after every use
275-
/// let mut nonce_counter = num::BigUint::from_bytes_le(&vec![0; 96 / 8]);
275+
/// let mut nonce_counter = num_bigint::BigUint::from_bytes_le(&vec![0; 96 / 8]);
276276
/// // Make sure it's no more than 96 bits!
277277
/// assert!(nonce_counter.bits() <= 96);
278278
/// let mut nonce_bytes = nonce_counter.to_bytes_le();

‎src/serde_custom/base64_url_uint.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use std::fmt;
55

66
use data_encoding::BASE64URL_NOPAD;
7-
use num::BigUint;
7+
use num_bigint::BigUint;
88
use serde::de;
99
use serde::{Deserializer, Serializer};
1010

@@ -63,8 +63,8 @@ impl<'a> serde::Serialize for Wrapper<'a> {
6363

6464
#[cfg(test)]
6565
mod tests {
66-
use num::cast::FromPrimitive;
67-
use num::BigUint;
66+
use num_bigint::BigUint;
67+
use num_traits::cast::FromPrimitive;
6868
use serde::{Deserialize, Serialize};
6969
use serde_test::{assert_tokens, Token};
7070

‎src/serde_custom/option_base64_url_uint.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use std::fmt;
55

66
use data_encoding::BASE64URL_NOPAD;
7-
use num::BigUint;
7+
use num_bigint::BigUint;
88
use serde::de;
99
use serde::{Deserializer, Serializer};
1010

@@ -67,8 +67,8 @@ where
6767

6868
#[cfg(test)]
6969
mod tests {
70-
use num::cast::FromPrimitive;
71-
use num::BigUint;
70+
use num_bigint::BigUint;
71+
use num_traits::cast::FromPrimitive;
7272
use serde::{Deserialize, Serialize};
7373

7474
use serde_test::{assert_tokens, Token};

0 commit comments

Comments
 (0)
Please sign in to comment.