Skip to content

Commit

Permalink
Merge pull request #51 from Cardinal-Cryptography/use-ark-std
Browse files Browse the repository at this point in the history
Make the lib no_std.
  • Loading branch information
Ancient123 authored May 24, 2023
2 parents a84d66d + 52441e3 commit 19bb2ba
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tagged-base64"
version = "0.3.0"
version = "0.3.1"
authors = ["John D. Corbett <[email protected]>"]
edition = "2021"
description = "User-oriented format for binary data. Tagged Base64 is intended to be used in user interfaces including URLs and text to be copied and pasted without the need for additional encoding, such as quoting or escape sequences."
Expand All @@ -23,6 +23,7 @@ build-cli = ["dep:clap"]

[dependencies]
ark-serialize = { version = "0.4.0", optional = true, default-features = false, features = ["derive"] }
ark-std = { version = "0.4.0", default-features = false }
base64 = "0.13.0"
crc-any = { version = "2.4.1", default-features = false }
serde = { version = "1.0", optional = true, features = ["derive"] }
Expand All @@ -45,7 +46,6 @@ web-sys = { version = "0.3.49", optional = true, features = ["console", "Headers
console_error_panic_hook = { version = "0.1.7", optional = true }

[dev-dependencies]
ark-std = { version = "0.4.0", default-features = false }
bincode = "1.3"
getrandom = { version = "0.2", features = ["js"] }
quickcheck = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "tagged-base64-macros"
description = "Procedural macros associated with tagged-base64"
version = "0.3.0"
version = "0.3.1"
authors = ["Espresso Systems <[email protected]>"]
edition = "2021"

Expand Down
9 changes: 8 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
//! allow safe transit to- and from JavaScript, including in URLs, as
//! well as display and input in a user interface.
#![no_std]
#![allow(clippy::unused_unit)]
#[cfg(feature = "ark-serialize")]
use ark_serialize::*;
Expand All @@ -55,6 +56,12 @@ use serde::{
};
use snafu::Snafu;

use ark_std::{
format,
string::{String, ToString},
vec::Vec,
};

#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;

Expand Down Expand Up @@ -93,7 +100,7 @@ impl Serialize for TaggedBase64 {
Serialize::serialize(&self.to_string(), serializer)
} else {
// For binary formats, convert to bytes (using CanonicalSerialize) and write the bytes.
let mut bytes = vec![];
let mut bytes = Vec::new();
CanonicalSerialize::serialize_compressed(self, &mut bytes).map_err(S::Error::custom)?;
Serialize::serialize(&bytes, serializer)
}
Expand Down

0 comments on commit 19bb2ba

Please sign in to comment.