Skip to content

Commit

Permalink
fix(did_parser): Add readme and simple example (#1047)
Browse files Browse the repository at this point in the history
  • Loading branch information
xprazak2 committed Nov 6, 2023
1 parent fee4076 commit 0c921b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions did_parser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# did_parser

A crate for parsing DIDs and DID URLs.
10 changes: 10 additions & 0 deletions did_parser/examples/did_parser/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use did_parser::{Did, DidUrl};

fn main() {
// parse a string into DID
Did::parse("did:web:w3c-ccg.github.io".into()).expect("should correctly parse did");

// parse a string into DID URL
DidUrl::parse("did:example:123456789abcdefghi;param=value?query=value".into())
.expect("should correctly parse did url");
}

0 comments on commit 0c921b9

Please sign in to comment.