#did #document #identity #ssi #self-sovereign

caelum-diddoc

Self-Sovereign Identity rust/wasm crate

2 releases

0.1.3 Dec 18, 2019
0.1.1 Dec 9, 2019

#49 in #ssi

MIT/Apache

45KB
607 lines

Decentralized Identity Documents

The diddoc crate is aimed to help javascript and rust developers manage DID docs (Decentralized Identity Documents) in an easy manner. Following w3's specifications on DID Documents this crate aims to be a Resolver. This means it will create, read, update and delete all properties of a DID document. As well as interacting with other DIDs and DID document, using proof verification. Also, it will be able to interact with others on other Decentralized Identifier Registry. This will can effectively be used to perform all the operations required of a CKMS (cryptographic key management system), such as key registration, replacement, rotation, recovery, and expiration. More details in w3's method specifications.

Documentation

You can read our code documentation, which makes reference to usage with javascript and rust as well as the actual implementation of the library.

For more details you can take a look at our book.

Book

Clone repository and go to the book directory:

git clone https://gitlab.com/caelum-tech/caelum-diddoc.git
cd caelum-diddoc/book

Download mdbook and build the documentation:

cargo install mdbook
mdbook build

Open the book /your/relative/path/caelum-diddoc/book/book/index.html on your favorite browser.

Installing DidDoc for JavaScript

From npm

Add it to your package.json:

"devDependencies": {
    "@caelum-tech/caelum-diddoc-nodejs": "^0.1.2",
   ...
  }

Imported in your code:

const diddoc = require('@caelum-tech/caelum-diddoc-nodejs')

Finally you can use it as any other package:

const d = new diddoc.DidDoc('https://www.w3.org/ns/did/v1', 'did:lor:cat:lab:root')
console.log(d.toJSON())

From gitlab

Clone or download diddoc repository

git clone ...

Go to diddoc directory and build the package using wasm-pack (make sure wasm-pack is installed)

cd diddoc

wasm-pack build

This will generate a directory called pkg inside diddoc directory.

Add the generated package to your package.json;

"devDependencies": {
    "diddoc": "file:../diddoc/pkg",
    ...
}

Now your ready to import it in your JavaScript code as usual:

const diddoc = require('diddoc')

Finally you can use it as any other package:

const d = new diddoc.DidDoc('https://www.w3.org/ns/did/v1', 'did:lor:cat:lab:root')
console.log(d.toJSON())

From npm

Installed as a normal npm package:

npm i @caelum-tech/caelum-diddoc-nodejs

Installing DidDoc for Rust

Add crate to your Cargo.toml

...
[dependencies]
caelum-diddoc = "0.1.2"
...

Use and instantiate:

use caelum_diddoc::DidDocument;
let dd = DidDocument::default();
println!("{:#?}", dd);

Resolvers

A DID resolver is a software component with an API designed to accept requests for DID lookups and execute the corresponding DID method to retrieve the authoritative DID Document. To be conformant with this specification, a DID resolver:

SHOULD validate that a DID is valid according to its DID method specification, otherwise it should produce an error.

MUST conform to the requirements of the applicable DID method specification when performing DID resolution operations.

SHOULD offer the service of verifying the integrity of the DID Document if it is signed.

MAY offer the service of returning requested properties of the DID Document.

Roadmap

  • [ x ] Basic CRUD implementation on properties.
  • [ x ] Basic CRUD implementation on Optional properties.
  • Basic interaction with IPFS.
  • Verifying cryptographic proofs.
  • Implementing important DID methods such as did-erc725, did-btcr, did-sov, and others.
  • Helper to implement DID for own methods.

Contributing

Please, contribute to diddoc! The more the better! Feel free to to open an issue and/or contacting directly with the owner for any request or suggestion.

Acknowledgment

This library is created to satisfy w3's specifications.

Code of conduct

This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at http://contributor-covenant.org/version/1/4

License

This project is distributed under the terms of both the Apache License (Version 2.0) and the MIT license, specified in LICENSE-APACHE and LICENSE-MIT respectively.

Dependencies

~1.1–2MB
~43K SLoC