6 releases
0.2.0 | Nov 1, 2021 |
---|---|
0.1.4 | Oct 10, 2021 |
0.1.2 | Sep 24, 2021 |
32 downloads per month
Used in ssb-bfe-rs
34KB
738 lines
ssb-uri-rs
Utilities for recognising and converting Secure Scuttlebutt (SSB) URIs according to the SSB URI Specification.
Example
use ssb_uri_rs;
let example_uri = "ssb:message/sha256/g3hPVPDEO1Aj_uPl0-J2NlhFB2bbFLIHlty-YuqFZ3w=";
assert!(ssb_uri_rs::is_classic_msg_uri(example_uri)?);
let example_sigil = ssb_uri_rs::msg_uri_to_sigil(example_uri)?;
assert_eq!(example_sigil, "%g3hPVPDEO1Aj/uPl0+J2NlhFB2bbFLIHlty+YuqFZ3w=.sha256");
Documentation
Use cargo doc
to generate and serve the Rust documentation for this library:
git clone git@github.com:ssb-ngi-pointer/ssb-uri-rs.git
cd ssb-uri-rs
cargo doc --no-deps --open
License
LGPL-3.0.
lib.rs
:
ssb-uri-rs
Utilities for recognising and converting Secure Scuttlebutt (SSB) URIs.
Written according to the SSB URI Specification.
Example
use ssb_uri_rs;
use ssb_uri_rs::error::SsbUriError;
fn example() -> Result<(), SsbUriError> {
let example_uri = "ssb:message/sha256/g3hPVPDEO1Aj_uPl0-J2NlhFB2bbFLIHlty-YuqFZ3w=";
assert!(ssb_uri_rs::is_classic_msg_uri(example_uri)?);
let example_sigil = ssb_uri_rs::msg_uri_to_sigil(example_uri)?;
assert_eq!(example_sigil, "%g3hPVPDEO1Aj/uPl0+J2NlhFB2bbFLIHlty+YuqFZ3w=.sha256");
Ok(())
}
Documentation
Use cargo doc
to generate and serve the Rust documentation for this library:
git clone git@github.com:ssb-ngi-pointer/ssb-uri-rs.git
cd ssb-uri-rs
cargo doc --no-deps --open
Related Work
ssb-uri2 - TypeScript version of this library multiserver - JavaScript module multiserver-address - JavaScript module
License
LGPL-3.0.
Dependencies
~3–4.5MB
~90K SLoC