Crates.io | vade-evan-substrate |
lib.rs | vade-evan-substrate |
version | 0.2.0 |
source | src |
created_at | 2022-05-05 16:00:25.303038 |
updated_at | 2022-08-25 10:54:01.379098 |
description | substrate based DID and DID document handling plugin for vade |
homepage | https://github.com/evannetwork/vade-evan-substrate |
repository | https://github.com/evannetwork/vade-evan-substrate |
max_upload_size | |
id | 581080 |
size | 137,275 |
This crate allows you to use to work with DIDs Trust and Trace, which runs on evan.network.
For this purpose a VadePlugin
implementation is exported: VadeEvanSubstrate
.
Supports creating, updating and getting DIDs and DID documents on substrate, therefore supports:
As the did resolver instance needs to sign its requests against substrate, a remote endpoint for signing has to be provided. The DID resolver will sign requests for did_create
and did_update
. A signing endpoint has to be passed with the config argument in the constructor, e.g.:
use vade_evan_substrate::{ResolverConfig, VadeEvanSubstrate};
use vade_signer::{LocalSigner, Signer},
let signer: Box<dyn Signer> = Box::new(LocalSigner::new());
let resolver = VadeEvanSubstrate::new(ResolverConfig {
signer,
target: "127.0.0.1".to_string(),
});
When signing remotely, signing_url
will be called with a POST request. The messages that should be signed is passed to the server alongside a reference to a key like this:
{
"key": "some-key-id",
"type": "some-key-type",
"message": "sign me please"
}
Two types of of responses are supported. Successful signing results are give in this format:
{
"messageHash": "0x52091d1299031b18c1099620a1786363855d9fcd91a7686c866ad64f83de13ff",
"signature": "0xc465a9499b75eed6fc4f658d1764168d63578b05ae15305ceedc94872bda793f74cb850c0683287b245b4da523851fbbe37738116635ebdb08e80b867c0b4aea1b",
"signerAddress": "0x3daa2c354dba8d51fdabc30cf9219b251c74eb56"
}
Errors can be signaled this way:
{
"error": "key not found"
}
No surprise here:
cargo build --release
To compile vade-evan-substrate
for wasm, use wasm pack.
Also you have to specify whether to build a browser or a nodejs environment.
nodejs:
wasm-pack build --release --target nodejs
browser:
wasm-pack build --release --target web