This PR brings the did-key library up to date with the new ssi API. During this update I notices a few issues with the previous ssi implementation that have been fixed with the refactor:
Whenever a DID document generated with the did:key method contains a verification method of type Ed25519VerificationKey2018, the public key in the verification method is provided by the wrong attribute: publicKeyJwk instead of publicKeyBase58.
Similarly, EcdsaSecp256r1VerificationKey2019 methods are generated with the publicKeyJwk attribute instead of publicKeyMultibase.
The proof value generated by the EcdsaSecp256r1Signature2019 cryptosuite is provided by the wrong attribute in the proof object: jws instead of proofValue. This is a more serious issue because fixing it means loosing backward compatibility with VCs signed with the old faulty implementation of this cryptosuite.
Bonus: removing ugly associated future types
While refactoring, I initially added some associated types in the new traits meant to represent the future of async functions in traits. Something like that:
trait MessageSigner {
type Sign: Future<Output = Signature>;
// this function is async.
fn sign(&self, message: &[u8]) -> Self::Sign;
}
This was required because until version 1.75, rust did not support "real" async functions in traits (there was some possible workaround with the async_trait crate, but not offering enough flexibility). Now that version 1.75 is stable, I've been able to remove all the associated future types (and their often ugly implementations). The example above is reduced to:
This PR brings the
did-key
library up to date with the newssi
API. During this update I notices a few issues with the previous ssi implementation that have been fixed with the refactor:did:key
method contains a verification method of typeEd25519VerificationKey2018
, the public key in the verification method is provided by the wrong attribute:publicKeyJwk
instead ofpublicKeyBase58
.EcdsaSecp256r1VerificationKey2019
methods are generated with thepublicKeyJwk
attribute instead ofpublicKeyMultibase
.EcdsaSecp256r1Signature2019
cryptosuite is provided by the wrong attribute in the proof object:jws
instead ofproofValue
. This is a more serious issue because fixing it means loosing backward compatibility with VCs signed with the old faulty implementation of this cryptosuite.Bonus: removing ugly associated future types
While refactoring, I initially added some associated types in the new traits meant to represent the future of async functions in traits. Something like that:
This was required because until version 1.75, rust did not support "real" async functions in traits (there was some possible workaround with the
async_trait
crate, but not offering enough flexibility). Now that version 1.75 is stable, I've been able to remove all the associated future types (and their often ugly implementations). The example above is reduced to: