{"id":21503710,"url":"https://github.com/unavi-xyz/dwn","last_synced_at":"2025-03-17T13:44:41.665Z","repository":{"id":212752310,"uuid":"732238884","full_name":"unavi-xyz/dwn","owner":"unavi-xyz","description":"Rust implementation of the Decentralized Web Node specification.","archived":false,"fork":false,"pushed_at":"2023-12-23T07:49:15.000Z","size":124,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-12-23T10:12:12.033Z","etag":null,"topics":["decentralized-web-node","did","dwn","rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/dwn","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unavi-xyz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-12-16T02:42:40.000Z","updated_at":"2024-02-22T04:20:08.968Z","dependencies_parsed_at":"2023-12-28T06:34:02.688Z","dependency_job_id":"0d0902d7-fdd2-4351-9f4d-e4b90b4c3ef1","html_url":"https://github.com/unavi-xyz/dwn","commit_stats":null,"previous_names":["unavi-xyz/dwn"],"tags_count":1,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unavi-xyz%2Fdwn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unavi-xyz%2Fdwn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unavi-xyz%2Fdwn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unavi-xyz%2Fdwn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unavi-xyz","download_url":"https://codeload.github.com/unavi-xyz/dwn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244044860,"owners_count":20388837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decentralized-web-node","did","dwn","rust"],"created_at":"2024-11-23T18:26:04.897Z","updated_at":"2025-03-17T13:44:41.644Z","avatar_url":"https://github.com/unavi-xyz.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dwn\n\n\u003c!-- cargo-rdme start --\u003e\n\nRust implementation of a [Decentralized Web Node](https://identity.foundation/decentralized-web-node/spec/).\n\nThe DWN spec is a work-in-progress and often out of date from other implementations,\nso it is treated more as a loose guide rather than an absolute set of rules to follow.\n\n## Example\n\n```rust\nuse dwn::{\n    core::{message::{descriptor::{RecordsReadBuilder, RecordsWriteBuilder}, mime::TEXT_PLAIN}, reply::Reply},\n    stores::NativeDbStore,\n    Actor,\n    Dwn\n};\nuse xdid::methods::key::{p256::P256KeyPair, DidKeyPair, PublicKey};\n\n#[tokio::main]\nasync fn main() {\n    // Create a local in-memory DWN.\n    let store = NativeDbStore::new_in_memory().unwrap();\n    let mut dwn = Dwn::from(store);\n\n    // Create a new did:key.\n    let key = P256KeyPair::generate();\n    let did = key.public().to_did();\n\n    // Create an actor to sign messages on behalf of our DID.\n    let mut actor = Actor::new(did.clone());\n    actor.auth_key = Some(key.clone().into());\n    actor.sign_key = Some(key.into());\n\n    // Prepare to write a new record to the DWN.\n    let mut msg = RecordsWriteBuilder::default()\n        .data(TEXT_PLAIN, \"Hello, world!\".as_bytes().to_vec())\n        .published(true)\n        .build()\n        .unwrap();\n\n    let record_id = msg.record_id.clone();\n\n    // Authorize the message using the actor.\n    actor.authorize(\u0026mut msg).unwrap();\n\n    // Process the message at our DID's DWN.\n    dwn.process_message(\u0026did, msg.clone()).await.unwrap();\n\n    // We can now read the record using its ID.\n    let read = RecordsReadBuilder::new(record_id.clone())\n        .build()\n        .unwrap();\n\n    let reply = dwn.process_message(\u0026did, read).await.unwrap();\n\n    let found = match reply {\n        Some(Reply::RecordsRead(r)) =\u003e r.entry.unwrap(),\n        _ =\u003e panic!(\"invalid reply\"),\n    };\n\n    assert_eq!(found, msg);\n}\n```\n\n\u003c!-- cargo-rdme end --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funavi-xyz%2Fdwn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funavi-xyz%2Fdwn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funavi-xyz%2Fdwn/lists"}