Skip to content

Commit

Permalink
chore: update base64 dependency from 0.13.0 to 0.21.0
Browse files Browse the repository at this point in the history
It seems that dependabot is not monitoring our library crate .toml
files, as our top-level Cargo.toml only specifies the binary crates as
workspace members.

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
  • Loading branch information
roypat authored and JonathanWoollett-Light committed Dec 8, 2023
1 parent 4d66562 commit bd87a91
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/vmm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ vm-superio = "0.7.0"
vm-memory = { version = "0.13.1", features = ["backend-mmap", "backend-bitmap"] }
log = { version = "0.4.17", features = ["std", "serde"] }
aes-gcm = { version = "0.10.1", default-features = false, features = ["aes"] }
base64 = "0.13.0"
base64 = "0.21.0"
bincode = "1.2.1"
micro_http = { git = "https://github.com/firecracker-microvm/micro-http" }
log-instrument = { path = "../log-instrument", optional = true }
Expand Down
6 changes: 4 additions & 2 deletions src/vmm/src/mmds/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::path::Path;
use std::{fmt, io};

use aes_gcm::{AeadInPlace, Aes256Gcm, Key, KeyInit, Nonce};
use base64::Engine;
use bincode::{DefaultOptions, Error as BincodeError, Options};
use serde::{Deserialize, Serialize};
use utils::time::{get_time_ms, ClockType};
Expand Down Expand Up @@ -289,12 +290,13 @@ impl Token {
let token_bytes: Vec<u8> = bincode::serialize(self)?;

// Encode token structure bytes into base64.
Ok(base64::encode_config(token_bytes, base64::STANDARD))
Ok(base64::engine::general_purpose::STANDARD.encode(token_bytes))
}

/// Decode token structure from base64 string.
fn base64_decode(encoded_token: &str) -> Result<Self, Error> {
let token_bytes = base64::decode_config(encoded_token, base64::STANDARD)
let token_bytes = base64::engine::general_purpose::STANDARD
.decode(encoded_token)
.map_err(|_| Error::ExpiryExtraction)?;

let token: Token = DefaultOptions::new()
Expand Down

0 comments on commit bd87a91

Please sign in to comment.