sidetree-client

Crates.iosidetree-client
lib.rssidetree-client
version0.1.2
sourcesrc
created_at2020-12-21 16:16:28.239952
updated_at2020-12-21 21:47:24.910205
descriptionClient library for managing DID operations for Sidetree API services
homepage
repository
max_upload_size
id325301
size62,251
Tomislav Markovski (tmarkovski)

documentation

README

Rust client library for managing DID operations for Sidetree API services

Crates.io

This library provides a set of client services to help work with DID operations for the Sidetree REST API. The goal is to provide access to Sidetree based DID methods using a cross platform library.

Requirements

This library requires sidetree node to be running and expose API interface. Check the ION and Element implementations for running a node locally.

Usage

You can use the library directly in your code, or use the provided CLI to generate requests in console.

Using the library in your code

Install from crates.io

sidetree-client = "*"

Using the CLI from terminal

Install the CLI with

cargo install sidetree-client

Generate create request

sidetree-client create

See a list of all commands supported

sidetree-client --help

Specifications

Sidetree Operations

This library provides objects that are compatible with the API spec. The objects can be converted to JSON using Rust's serde_json crate.

Create Operation

To generate new DID, you can use the create() or create_config() methods.

Create new DID

To generate a request for new DID use the create() function. It will generate a request and document with random EC key for secp256k1 curve:

use sidetree_client::*;

let create_operation = operations::create().unwrap();

// generate JSON request for use with API spec
let json = serde_json::to_string_pretty(&create_operation.operation_request);

println!("did:ion:{}", create_operation.did_suffix);
println!("{}", json);

This operation returns an object of type OperationOutput which has the following fields

  • operation_request - an object that can be serialized to JSON and sent to the POST /operations endpoint of the Sidetree service

  • did_siffix - this is the unique DID suffix that represents the identifier in your DID. It should be appended to your DID to get the full DID identifier, ex. did:ion:123abc

  • signing_key - this field will contain the random key will become part of your DID Document. By default, this key will be of type EcdsaSecp256k1VerificationKey2019 with a key id key-1. To pass your own key, use the create_config() method instead

  • update_key - this key is required to make updates to your DID Document. It will not become part of your public DID Document, it is only used for Sidetree operations. Store this key somewhere secure.

  • recovery_key - this key is required to recover access to your DID Document. It will not become part of your public DID Document, it is only used for Sidetree operations. Store this key somewhere secure.

Update Operation

Add key to your DID Document

TODO

Remove key from your DID Document

TODO

Add service entry to your DID Document

TODO

Remove service entry from your DID Document

TODO

Recover Operation

TODO

Deactivate Operation

TODO

License

Apache 2.0

Commit count: 0

cargo fmt