Skip to content
This repository has been archived by the owner on Sep 21, 2024. It is now read-only.

Commit

Permalink
chore: Remove direct dependency to multihash -- use cid re-export ins…
Browse files Browse the repository at this point in the history
…tead everywhere. (#826)
  • Loading branch information
jsantell authored Feb 20, 2024
1 parent 0cf8f63 commit 31e4b2b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 26 deletions.
37 changes: 19 additions & 18 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ libipld = { version = "0.16" }
libipld-core = { version = "0.16" }
libipld-cbor = { version = "0.16" }
libipld-json = { version = "0.16" }
multihash = { version = "0.18" }
pathdiff = { version = "0.2.1" }
rand = { version = "0.8" }
reqwest = { version = "=0.11.20", default-features = false, features = ["json", "rustls-tls", "stream"] }
Expand Down
1 change: 0 additions & 1 deletion rust/noosphere-ipfs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,4 @@ rand = { workspace = true }
iroh-car = { workspace = true }
libipld-cbor = { workspace = true }
libipld-json = { workspace = true }
multihash = { workspace = true }
noosphere-core = { workspace = true }
15 changes: 9 additions & 6 deletions rust/noosphere-ipfs/examples/car.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
//! Simple utility to verify the contents of a .car file using the same
//! CAR-reading facilities in use by Noosphere more generally

#[cfg(not(target_arch = "wasm32"))]
pub fn hash_for(cid: cid::Cid) -> &'static str {
match multihash::Code::try_from(cid.hash().code()) {
Ok(multihash::Code::Blake3_256) => "BLAKE3",
Ok(multihash::Code::Sha2_256) => "SHA-256",
use cid::{
multihash::{Code, MultihashDigest},
Cid,
};

pub fn hash_for(cid: Cid) -> &'static str {
match Code::try_from(cid.hash().code()) {
Ok(Code::Blake3_256) => "BLAKE3",
Ok(Code::Sha2_256) => "SHA-256",
Ok(_) => "Other",
Err(error) => {
println!("ERROR: {}", error);
Expand Down Expand Up @@ -36,7 +40,6 @@ pub async fn main() -> anyhow::Result<()> {
use libipld_cbor::DagCborCodec;
use libipld_core::ipld::Ipld;
use libipld_core::raw::RawCodec;
use multihash::MultihashDigest;
use noosphere_core::stream::BlockLedger;
use noosphere_storage::block_decode;
use std::env;
Expand Down

0 comments on commit 31e4b2b

Please sign in to comment.