Skip to content

Commit

Permalink
logo link for embeds. (#36)
Browse files Browse the repository at this point in the history
Includes:

* fix codeowners file
* update based on nightly finds
  • Loading branch information
Zeeshan Lakhani authored Oct 25, 2022
1 parent 11d10d6 commit c2709e7
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 18 deletions.
3 changes: 1 addition & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# Default
* @cdata
* @ucan-wg/fission
* @cdata @ucan-wg/fission
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<div align="center">
<a href="https://github.com/ucan-wg/rs-ucan" target="_blank">
<img src="assets/logo.png" alt="rs-ucan Logo" height="200"></img>
<img src="https://raw.githubusercontent.com/ucan-wg/rs-ucan/main/assets/logo.png" alt="rs-ucan Logo" height="200"></img>
</a>

<h1 align="center">rs-ucan</h1>

<p>
<a href="https://crates.io/crates/ucanskip_ratchet">
<a href="https://crates.io/crates/ucan">
<img src="https://img.shields.io/crates/v/ucan.svg?label=crates" alt="Crate Information">
</a>
<a href="https://codecov.io/gh/ucan-wg/rs-ucan">
Expand Down
36 changes: 33 additions & 3 deletions ucan-key-support/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
# ucan-key-support
<div align="center">
<a href="https://github.com/ucan-wg/rs-ucan" target="_blank">
<img src="https://raw.githubusercontent.com/ucan-wg/rs-ucan/main/assets/logo.png" alt="rs-ucan Logo" height="200"></img>
</a>

<h1 align="center">ucan-key-support</h1>

<p>
<a href="https://crates.io/crates/ucan-key-support">
<img src="https://img.shields.io/crates/v/ucan-key-support.svg?label=crates" alt="Crate Information">
</a>
<a href="https://codecov.io/gh/ucan-wg/rs-ucan">
<img src="https://codecov.io/gh/ucan-wg/rs-ucan/branch/main/graph/badge.svg?token=UZ53MKNKJC" alt="Code Coverage"/>
</a>
<a href="https://github.com/ucan-wg/rs-ucan/actions?query=">
<img src="https://github.com/ucan-wg/rs-ucan/actions/workflows/run_test_suite.yaml/badge.svg" alt="Build Status">
</a>
<a href="https://github.com/ucan-wg/rs-ucan/blob/main/LICENSE">
<img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License">
</a>
<a href="https://docs.rs/ucan-key-support">
<img src="https://img.shields.io/static/v1?label=Docs&message=docs.rs&color=blue" alt="Docs">
</a>
<a href="https://discord.gg/JSyFG6XgVM">
<img src="https://img.shields.io/static/v1?label=Discord&message=join%20us!&color=mediumslateblue" alt="Discord">
</a>
</p>
</div>


##

This is an auxilliary crate containing ready-to-use `SigningKey` implementations
for the Rust UCAN implementation.
for the [Rust UCAN implementation][rs-ucan].

See https://docs.rs/ucan-key-support for documentation.
[rs-ucan]: https://docs.rs/ucan
40 changes: 37 additions & 3 deletions ucan/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# ucan
<div align="center">
<a href="https://github.com/ucan-wg/rs-ucan" target="_blank">
<img src="https://raw.githubusercontent.com/ucan-wg/rs-ucan/main/assets/logo.png" alt="rs-ucan Logo" height="200"></img>
</a>

This is the core Rust UCAN implementation.
<h1 align="center">ucan</h1>

See https://docs.rs/ucan for documentation.
<p>
<a href="https://crates.io/crates/ucan">
<img src="https://img.shields.io/crates/v/ucan.svg?label=crates" alt="Crate Information">
</a>
<a href="https://codecov.io/gh/ucan-wg/rs-ucan">
<img src="https://codecov.io/gh/ucan-wg/rs-ucan/branch/main/graph/badge.svg?token=UZ53MKNKJC" alt="Code Coverage"/>
</a>
<a href="https://github.com/ucan-wg/rs-ucan/actions?query=">
<img src="https://github.com/ucan-wg/rs-ucan/actions/workflows/run_test_suite.yaml/badge.svg" alt="Build Status">
</a>
<a href="https://github.com/ucan-wg/rs-ucan/blob/main/LICENSE">
<img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License">
</a>
<a href="https://docs.rs/ucan">
<img src="https://img.shields.io/static/v1?label=Docs&message=docs.rs&color=blue" alt="Docs">
</a>
<a href="https://discord.gg/JSyFG6XgVM">
<img src="https://img.shields.io/static/v1?label=Discord&message=join%20us!&color=mediumslateblue" alt="Discord">
</a>
</p>
</div>


##

This is a Rust library to help the next generation of web applications make use
of UCANs in their authorization flows. To learn more about UCANs and how you
might use them in your application, visit [https://ucan.xyz][ucan website] or
read the [spec][spec].

[spec]: https://github.com/ucan-wg/spec
[ucan website]: https://ucan.xyz
4 changes: 2 additions & 2 deletions ucan/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ where
let header_base64 = header.jwt_base64_encode()?;
let payload_base64 = payload.jwt_base64_encode()?;

let data_to_sign = format!("{}.{}", header_base64, payload_base64)
let data_to_sign = format!("{header_base64}.{payload_base64}")
.as_bytes()
.to_vec();
let signature = self.issuer.sign(data_to_sign.as_slice()).await?;
Expand Down Expand Up @@ -232,7 +232,7 @@ where
let proof_index = self.proofs.len() - 1;
let proof_delegation = ProofDelegationSemantics {};
let capability =
proof_delegation.parse(&format!("prf:{}", proof_index), "ucan/DELEGATE");
proof_delegation.parse(&format!("prf:{proof_index}"), "ucan/DELEGATE");

match capability {
Some(capability) => {
Expand Down
2 changes: 1 addition & 1 deletion ucan/src/capability/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl TryFrom<String> for ProofSelection {
impl ToString for ProofSelection {
fn to_string(&self) -> String {
match self {
ProofSelection::Index(usize) => format!("prf:{}", usize),
ProofSelection::Index(usize) => format!("prf:{usize}"),
ProofSelection::All => "prf:*".to_string(),
}
}
Expand Down
4 changes: 2 additions & 2 deletions ucan/src/capability/semantics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ where
match self {
With::Resource { kind } => kind.to_string(),
With::My { kind } => format!("my:{}", kind.to_string()),
With::As { did, kind } => format!("as:{}:{}", did, kind.to_string()),
With::As { did, kind } => format!("as:{did}:{}", kind.to_string()),
}
}
}
Expand Down Expand Up @@ -184,7 +184,7 @@ where
_ => return None,
};

Some((format!("did:key:{}", value), path_parts.collect()))
Some((format!("did:key:{value}"), path_parts.collect()))
}

fn parse_resource(&self, with: &Url) -> Option<Resource<S>> {
Expand Down
2 changes: 1 addition & 1 deletion ucan/src/ipld/principle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl Display for Principle {
_ => [DID_KEY_PREFIX, &bs58::encode(bytes).into_string()].concat(),
};

write!(f, "{}", did_content)
write!(f, "{did_content}")
}
}

Expand Down
4 changes: 2 additions & 2 deletions ucan/src/ucan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl Ucan {
let payload = self.payload.jwt_base64_encode()?;
let signature = base64::encode_config(self.signature.as_slice(), base64::URL_SAFE_NO_PAD);

Ok(format!("{}.{}.{}", header, payload, signature))
Ok(format!("{header}.{payload}.{signature}"))
}

/// Returns true if the UCAN has past its expiration date
Expand Down Expand Up @@ -222,7 +222,7 @@ impl FromStr for Ucan {
.split('.')
.take(2)
.map(String::from)
.reduce(|l, r| format!("{}.{}", l, r))
.reduce(|l, r| format!("{l}.{r}"))
.ok_or_else(|| anyhow!("Could not parse signed data from token string"))?;

let mut parts = ucan_token.split('.').map(|str| {
Expand Down

0 comments on commit c2709e7

Please sign in to comment.