Crate ssb_uri_rs

Source
Expand description

§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

ssb-uri2 - TypeScript version of this library multiserver - JavaScript module multiserver-address - JavaScript module

§License

LGPL-3.0.

Modules§

error

Structs§

Parts
Data representation for a TFD (type, format, data) identity.

Functions§

blob_sigil_to_uri
Convert a sigil-based (&) sha256 blob identifier to a URI.
blob_uri_to_sigil
Convert a blob URI to a sigil-based (&) sha256 identifier.
check_type_format
Ensure a URI is formatted according to the specification for the given type and format.
compose_uri
Compose a new URI from the given parts: type, format, data.
decompose_uri
Decompose the given URI into its constituent parts: type, format, data.
extract_base64_data
Extract and return the base64 data from a URI pathname.
feed_sigil_to_uri
Convert a sigil-based (@) ed25519 feed identifier to a URI.
feed_uri_to_sigil
Convert a classic feed URI to a sigil-based (@) ed25519 identifier.
is_bendy_butt_v1_feed_uri
Check whether the given URI is a Bendy Butt feed URI.
is_bendy_butt_v1_msg_uri
Check whether the given URI is a Bendy Butt message URI.
is_blob_uri
Check whether the given URI is a blob URI.
is_classic_feed_uri
Check whether the given URI is a classic feed URI.
is_classic_msg_uri
Check whether the given URI is a classic message URI.
is_encryption_key_box2_uri
Check whether the given URI is an encryption key (box2 Diffie-Hellman) URI.
is_experimental_uri
Check whether the given URI is an experimental URI.
is_experimental_uri_with_action
Check whether the given URI is an experimental URI with an action query parameter matching the given action.
is_gabby_grove_v1_feed_uri
Check whether the given URI is a Gabby Grove feed URI.
is_gabby_grove_v1_msg_uri
Check whether the given URI is a Gabby Grove message URI.
is_identity_po_box_uri
Check whether the given URI is an identity PO-box URI.
is_multiserver_uri
Check whether the given URI is a multiserver address URI.
is_ssb_uri
Check whether the given URI matches any of the SSB URI specifications.
msg_sigil_to_uri
Convert a sigil-based (%) sha256 message identifier to a URI.
msg_uri_to_sigil
Convert a classic message URI to a sigil-based (%) sha256 identifier.
multiserver_address_to_uri
Convert a multiserver address to a URI.
multiserver_uri_to_address
Convert a multiserver address URI to a multiserver address.
safe_to_unsafe_base64
Replace all instances of the URL-safe character set with the standard equivalent.
unsafe_to_safe_base64
Replace all instance of the standard character set with the URL-safe equivalent.