W3C home > Mailing lists > Public > public-credentials@w3.org > March 2022

Possible breaking change to decentralized-identity/did-jwt due to Base58 & Base64 Matcher issue

From: Brent Shambaugh <brent.shambaugh@gmail.com>
Date: Tue, 29 Mar 2022 16:22:37 -0500
Message-ID: <CACvcBVoTkYvN3AR+6X62zTHnLkGJhqGVifyVUa53Y9TC3rdagw@mail.gmail.com>
To: Credentials Community Group <public-credentials@w3.org>
There is an issue with the did-jwt library that may need a breaking change
to fix. See (https://github.com/decentralized-identity/did-jwt/issues/222)
and/or Consider this exmaple:

A 64 character, 32 bit hex string representing a private key is written as:
040f1dbf0a2ca86875447a7c010b0fc6d39d76859c458fbe8f2bf775a40ad74a .

In Base58 these bits take 43 characters:

This is a problem for the existing base58Matcher

const base58Matcher =

A possible solution would be to rewrite this matcher to include 43
character strings:

const base58Matcher =

However, this is a problem as the base64 matcher considers the same 43
character length, with a similar alphabet:

const base64Matcher =

Here are the alphabets for Base64 and Base58::

Base64 Alphabet::


Source: https://datatracker.ietf.org/doc/html/rfc4648#section-4

Base58 Alphabet::


Source: https://datatracker.ietf.org/doc/html/draft-msporny-base58-01

-Brent Shambaugh

GitHub: https://github.com/bshambaugh
Website: http://bshambaugh.org/
LinkedIN: https://www.linkedin.com/in/brent-shambaugh-9b91259
Skype: brent.shambaugh
Twitter: https://twitter.com/Brent_Shambaugh
WebID: http://bshambaugh.org/foaf.rdf#me
Received on Tuesday, 29 March 2022 21:48:42 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 29 March 2022 21:48:43 UTC