Skip to content

Commit

Permalink
did-simple: Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
TheButlah committed May 20, 2024
1 parent 828cadc commit dae6057
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ libraries and `apps` for application-specific crates.

- [universal-capture](crates/universal-capture) - A cross platform solution for
window capture.
- [did-simple](crates/did-simple) - An easy to use crate for working with
Decentralized Identifiers (DIDs).

## First Time Setup

Expand Down
2 changes: 1 addition & 1 deletion crates/did-chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ rust-version.workspace = true
description = "A chain of Decentralized Identifiers"

[dependencies]
did-simple = { version = "0.0.0", path = "../did-simple" }
did-simple = { version = "0.0.1", path = "../did-simple" }
16 changes: 12 additions & 4 deletions crates/did-simple/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
[package]
name = "did-simple"
version.workspace = true
version = "0.0.1-beta.0"
license.workspace = true
repository.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "Dead simple DIDs"
publish = false
publish = true

[features]
default = []

# Only applications should enable this! If you use did-simple as a dependency,
# don't enable this feature - let applications set it instead.
# Enabling this feature removes the #[forbid(unsafe_code)] crate attribute.
allow-unsafe = []

[dependencies]
thiserror = "1.0.60"
bytes = "1.6.0"
bs58 = "0.5.1"
bytes = "1.6.0"
thiserror = "1.0.60"

[dev-dependencies]
eyre = "0.6.12"
Expand Down
43 changes: 43 additions & 0 deletions crates/did-simple/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# did-simple

Dead simple [DID][spec]s (Decentralized Identifiers).

This crate provides the ability to:
* Parse did urls.
* (optional feature) Perform cryptographic operations on the public keys
resolved from DIDs.

We intentionally do not perform IO, such as what would be required to resolve a
did:web. It is *your* responsibility to do IO, and then use this crate to
validate that data and get back something that you can do cryptographic operations
with. This ensures that this crate stays small, and that did-simple can be used
with any backend or client and in both sync and async paradigms.

Supported DID methods:
* did:key
* (coming soon) did:web

# Security

This crate enforces `#![forbid(unsafe_code)]` unless the `allow-unsafe` feature
is enabled. Since features in rust are additive across a dependency graph, don't
enable this feature unless you are writing an application!

This crate has a very high bar for the addition of new dependencies, because
dependencies are places where the software supply chain can be attacked. Right now,
we have zero non-rust dependencies, and passing `no-default-features` gives you
dependencies on only the following crates:

* thiserror (proc macro)
* bytes (no transitive deps)
* bs58 (no transitive deps)

We also test effectively every possible bit pattern when encoding and decoding
varints, a necessary part of did:key resolution.

# Breaking Changes

This crate is v0.0.X, and may introduce breaking changes at any time, with any
frequency.

[spec]: https://www.w3.org/TR/did-core/
2 changes: 1 addition & 1 deletion crates/did-simple/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//!
//! [spec]: https://www.w3.org/TR/did-core/

#![forbid(unsafe_code)]
#![cfg_attr(not(feature = "allow-unsafe"), forbid(unsafe_code))]

use std::str::FromStr;

Expand Down

0 comments on commit dae6057

Please sign in to comment.