Skip to content

Commit

Permalink
Rebase & cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
expede committed Mar 28, 2024
1 parent ebcb290 commit 7186f09
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 15 deletions.
1 change: 0 additions & 1 deletion src/crypto/nonce.rs
Expand Up @@ -31,7 +31,6 @@ impl PartialEq for Nonce {
(Nonce::Custom(a), Nonce::Custom(b)) => a == b,
(Nonce::Custom(a), Nonce::Nonce16(b)) => a.as_slice() == b,
(Nonce::Nonce16(a), Nonce::Custom(b)) => a == b.as_slice(),
_ => false,
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/delegation/agent.rs
Expand Up @@ -68,7 +68,6 @@ where
now: SystemTime,
varsig_header: V,
) -> Result<Delegation<DID, V, C>, DelegateError<S::Error>> {
let mut salt = self.did.clone().to_string().into_bytes();
let nonce = Nonce::generate_16();

let (subject, policy) = match subject {
Expand Down
4 changes: 2 additions & 2 deletions src/delegation/store/memory.rs
Expand Up @@ -160,7 +160,7 @@ where
let mut tx = self.lock();

tx.index
.entry(delegation.subject().clone())
.entry(delegation.subject().cloned())
.or_default()
.entry(delegation.audience().clone())
.or_default()
Expand Down Expand Up @@ -251,7 +251,7 @@ where
let issuer = delegation.issuer().clone();

// Hit a root delegation, AKA base case
if &Some(issuer.clone()) == delegation.subject() {
if Some(&issuer) == delegation.subject() {
break 'outer;
}

Expand Down
11 changes: 2 additions & 9 deletions src/invocation/agent.rs
Expand Up @@ -4,20 +4,13 @@ use super::{
Invocation,
};
use crate::{
ability::{
self, arguments,
arguments::Named,
command::ToCommand,
parse::{ParseAbility, ParseAbilityError},
ucan::revoke::Revoke,
},
ability::{self, arguments, arguments::Named, command::ToCommand, parse::ParseAbility},
crypto::{
signature::{self, Envelope},
varsig, Nonce,
},
delegation,
did::{self, Did},
invocation::payload::PayloadBuilder,
time::Timestamp,
};
use enum_as_inner::EnumAsInner;
Expand All @@ -26,7 +19,7 @@ use libipld_core::{
codec::{Codec, Encode},
ipld::Ipld,
};
use std::{collections::BTreeMap, fmt, marker::PhantomData};
use std::{collections::BTreeMap, marker::PhantomData};
use thiserror::Error;
use web_time::SystemTime;

Expand Down
5 changes: 3 additions & 2 deletions src/ipld/cid.rs
Expand Up @@ -130,8 +130,9 @@ impl Arbitrary for Newtype {
// Very much faking it
any::<([u8; 32], SomeMultihash, SomeCodec)>()
.prop_map(|(hash_bytes, hasher, codec)| {
let multihash = MultihashGeneric::wrap(hasher.0.into(), &hash_bytes.as_slice())
.expect("Sha2_256 should always successfully encode a hash");
let multihash =
multihash::MultihashGeneric::wrap(hasher.0.into(), &hash_bytes.as_slice())
.expect("Sha2_256 should always successfully encode a hash");

let cid = Cid::new_v1(codec.0.into(), multihash);
Newtype { cid }
Expand Down

0 comments on commit 7186f09

Please sign in to comment.