did:key
methodThis crate is intended to provide basic support for did:key
methods. It has no external dependencies and can be compiled for any target.
It was originally designed for use with DIDComm Extension for gRPC, but we recognized it may be useful if this was an independent library.
To resolve a did formatted URI:
```rust use did_key::*;
let key = DIDKey::resolve("did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL").unwrap();
```
Generate new key:
```rust let key = DIDKey::new(DIDKeyType::Ed25519);
println!("{}", key.fingerprint()); ```
Sign and verify:
```rust let key = DIDKey::new(DIDKeyType::P256); let message = b"message to be signed";
let signature = key.sign(Payload::Buffer(message.tovec())); let valid = key.verify(Payload::Buffer(message.tovec()), &signature);
assert!(valid); ```
...are welcome!