[!IMPORTANT]
Prioritizing the changes in this first PR because it includes stuff that i need in order to implement did:web which is necessary to unblock a bunch of work for the upcoming week. Details on what was and wasn't included in the sections below
What's Included
changed ToKeys and FromKeys to ToPortableDID and FromPortableDID respectively
ToKeys and FromKeys no longer made sense because PortableDID includes more than just keys.
ToPortableDID no longer throws if the BearerDID's Key Manager cannot export keys. Instead, PrivateKeys is omitted.
This makes it so BearerDID created using HSM based key manager's can still be exported to a PortableDID. This is useful because there's still necessary state even when re-inflating a BearerDID with an HSM based key manager
added Document field to PortableDID
Including the DID Document allows us to import a DID without making potential network calls and also does not require DIDs to be published prior to exporting them.
changed VerificationMethod field to PrivateKeys
Now that we have the DID Document, including what was previously in VerificationMethod is duplicative
added Metadata. Used to store method-specific properties
What's Not Included
FromPortableDID doesn't accept an optional KeyManager arg yet
Will likely move this function to method-specific packages to accommodate method-specific metadata. Also haven't decided how to share functional options yet.
PortableDID.Metadata doesn't include an explicit published property yet.
This is simply because i can't remember a detail we discussed in the meeting where we decided all of these thangs. will double back with @frankhinek and @amika-sq and then make the appropriate change
What's Weird Right Now
FromPortableDID and ToPortableDID are in the did package right now which makes calling these functions from outside the package look like did.FromPortableDID and did.ToPortableDID. It's not evident what representation of DID you're going to or from just by reading the line of code.
Overview
This PR is part 1 of 3 to introduce changes discussed here: https://github.com/TBD54566975/web5-spec/issues/112#issuecomment-1924691567.
What's Included
changed
ToKeys
andFromKeys
toToPortableDID
andFromPortableDID
respectivelyToKeys
andFromKeys
no longer made sense becausePortableDID
includes more than just keys.ToPortableDID
no longer throws if theBearerDID
's Key Manager cannot export keys. Instead,PrivateKeys
is omitted.This makes it so
BearerDID
created using HSM based key manager's can still be exported to aPortableDID
. This is useful because there's still necessary state even when re-inflating aBearerDID
with an HSM based key manageradded
Document
field toPortableDID
Including the DID Document allows us to import a DID without making potential network calls and also does not require DIDs to be published prior to exporting them.
changed
VerificationMethod
field toPrivateKeys
Now that we have the DID Document, including what was previously in
VerificationMethod
is duplicativeadded
Metadata
. Used to store method-specific propertiesWhat's Not Included
FromPortableDID
doesn't accept an optionalKeyManager
arg yetWill likely move this function to method-specific packages to accommodate method-specific metadata. Also haven't decided how to share functional options yet.
PortableDID.Metadata
doesn't include an explicitpublished
property yet.This is simply because i can't remember a detail we discussed in the meeting where we decided all of these thangs. will double back with @frankhinek and @amika-sq and then make the appropriate change
What's Weird Right Now
FromPortableDID
andToPortableDID
are in thedid
package right now which makes calling these functions from outside the package look likedid.FromPortableDID
anddid.ToPortableDID
. It's not evident what representation of DID you're going to or from just by reading the line of code.