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
§Related Work
ssb-uri2 - TypeScript version of this library multiserver - JavaScript module multiserver-address - JavaScript module
§License
LGPL-3.0.
Modules§
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
andformat
. - 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.