Crates.io | sidetree-client |
lib.rs | sidetree-client |
version | 0.1.2 |
source | src |
created_at | 2020-12-21 16:16:28.239952 |
updated_at | 2020-12-21 21:47:24.910205 |
description | Client library for managing DID operations for Sidetree API services |
homepage | |
repository | |
max_upload_size | |
id | 325301 |
size | 62,251 |
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.
This library requires sidetree node to be running and expose API interface. Check the ION and Element implementations for running a node locally.
You can use the library directly in your code, or use the provided CLI to generate requests in console.
Install from crates.io
sidetree-client = "*"
Install the CLI with
cargo install sidetree-client
Generate create
request
sidetree-client create
See a list of all commands supported
sidetree-client --help
This library provides objects that are compatible with the API spec. The objects can be converted to JSON using Rust's serde_json
crate.
To generate new DID, you can use the create()
or create_config()
methods.
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.
TODO
TODO
TODO
TODO
TODO
TODO