From a4d60e754bd7f852118691c21f5e84d4e2c59320 Mon Sep 17 00:00:00 2001 From: Lewin Bormann Date: Wed, 28 Sep 2016 20:10:53 +0200 Subject: [PATCH] fix(deps): Use small base64 crate instead of rustc-serialize --- Cargo.lock | 7 ++++++- Cargo.toml | 2 +- src/lib.rs.in | 2 +- src/service_account.rs | 6 ++---- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ffa366d93..bac88a698 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,7 @@ name = "yup-oauth2" version = "0.6.3" dependencies = [ + "base64 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -9,7 +10,6 @@ dependencies = [ "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "open 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)", "serde_codegen 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -26,6 +26,11 @@ dependencies = [ "syntex_syntax 0.43.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "base64" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "bitflags" version = "0.5.0" diff --git a/Cargo.toml b/Cargo.toml index f301a835d..13325428f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" build = "src/build.rs" [dependencies] +base64 = "0.2" chrono = ">= 0.2" hyper = "^ 0.9.0" itertools = ">= 0.4" log = ">= 0.3" openssl = "0.7" -rustc-serialize = "0.3" serde = "0.8" serde_json = "0.8" serde_macros = { version = "0.8", optional = true } diff --git a/src/lib.rs.in b/src/lib.rs.in index a6cad6c2f..1a51f557e 100644 --- a/src/lib.rs.in +++ b/src/lib.rs.in @@ -1,7 +1,7 @@ extern crate serde; extern crate serde_json; -extern crate rustc_serialize; +extern crate base64; extern crate chrono; extern crate openssl; extern crate hyper; diff --git a/src/service_account.rs b/src/service_account.rs index 07d7d1884..a9dad15ad 100644 --- a/src/service_account.rs +++ b/src/service_account.rs @@ -24,10 +24,10 @@ use storage::{hash_scopes, MemoryStorage, TokenStorage}; use hyper::header; use url::form_urlencoded; +use base64; use chrono; use hyper; use openssl; -use rustc_serialize; use serde_json; const GRANT_TYPE: &'static str = "urn:ietf:params:oauth:grant-type:jwt-bearer"; @@ -36,9 +36,7 @@ const GOOGLE_RS256_HEAD: &'static str = "{\"alg\":\"RS256\",\"typ\":\"JWT\"}"; // Encodes s as Base64 fn encode_base64>(s: T) -> String { - use rustc_serialize::base64::ToBase64; - - s.as_ref().to_base64(rustc_serialize::base64::URL_SAFE) + base64::encode(s.as_ref()) } // Calculates the SHA256 hash.