Crates.io | xdid |
lib.rs | xdid |
version | 0.2.0 |
source | src |
created_at | 2024-10-21 23:52:24.133154 |
updated_at | 2024-11-07 05:37:00.007589 |
description | Simple DID library. |
homepage | |
repository | https://github.com/unavi-xyz/xdid |
max_upload_size | |
id | 1418050 |
size | 7,412 |
Simple DID library.
use xdid::{resolver::DidResolver, methods::key::{p256::P256KeyPair, DidKeyPair, PublicKey}};
#[tokio::main]
async fn main() {
// Generate a new did:key.
let keys = P256KeyPair::generate();
let did = keys.public().to_did();
assert!(did.to_string().starts_with("did:key:zDn"));
// Resolve the DID document.
let resolver = DidResolver::new().unwrap();
let document = resolver.resolve(&did).await.unwrap();
assert_eq!(document.id, did);
}