Skip to content

Conversation

@venables
Copy link
Contributor

@venables venables commented May 29, 2025

In the core DID v1.0 spec, the only supported formats for a public key in a verificationMethod are publicKeyMultibase and publicKeyJwk.

To increase the likelihood of interoperable implementations, this specification limits the number of formats for expressing verification material in a DID document.

This PR updates the createDidDocument method to convert publicKeyHex and publicKeyBase58 formatted publicKeys to use publicKeyMultibase in the document. Multibase is chosen because it is the same fundamental representation as Hex/Base58 (string versus an object in Jwk)

venables added 5 commits May 28, 2025 20:21
In the did 1.0 spec, publicKeyHex, publicKeyBase58, publicKeyBase64 are
all superseded by publicKeyMultibase, which can handle all of those
formats.

This change updates our handling when creating a didDocument to use
either publicKeyMultibase or publicKeyJwk, regardless of the format that
was provided to the createDidDocument method.
- Renames base64* methods to be explicit that they are base64url
- Renames formatPublicKey to encodePublicKey
- Updates encodePublicKey to return PublicKeyWithEncoding type
- Simplifies publicKey encoding interfaces
Copy link
Collaborator

@domleboss97 domleboss97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@venables venables merged commit 4104ffe into main May 29, 2025
2 checks passed
@venables venables deleted the venables/convert-legacy-public-key-formats branch May 29, 2025 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants