digitalcredentials / tls-did

2 stars 0 forks source link

[Resolver] publicKey vs. assertionMethod property in DIDDocument type #22

Open KilianKae opened 3 years ago

KilianKae commented 3 years ago

Problem description

The W3C did-core specification defines that the verification method used to assert the proof of a Verifiable Credential has to be associated with the assertionMethod property in the issuer's DID document (cf. 5.2.4.2 Assertion Method). But currently, the DIDDocument type of the did-resolver library does not allow a property assertionMethod. Instead, for this purpose the DIDDocument type currently only offers the property publicKey. The property publicKey is not defined in the W3C did-core specification (cf. 5.1.1 Core Properties of a DID Document). Thus, the DIDDocument type currently violates the W3C did-core specification. Other libraries (such as vc-js and jsonld-signatures) expect the public key related to a Verifiable Credential signature in the assertionMethod property. Thus, it is currently not possible to use the DIDDocument type along with such libraries. In did-resolver/resolver.ts:

export interface DIDDocument {
    '@context': 'https://w3id.org/did/v1' | string | string[];
    id: string;
    publicKey: PublicKey[];
    ...
}

Suggested solution

The DIDDocument type should offer a property assertionMethod of type PublicKey[] to comply with the W3C did-core specification and to make it possible using this type along with other libraries.

KilianKae commented 3 years ago

We are currently using the types of the did-resolver library. They are currently not updating to the newest did specification since it is a moving target.