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

Re: 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:30:31 -0500
Message-ID: <CACvcBVrDy13yrgUkyxkUUqD=aFjh=aBRwYsjbB4W-QdiFw9L_A@mail.gmail.com>
To: Credentials Community Group <public-credentials@w3.org>
Apologies if this was too much information. I figured it was a widely used
library, so if it changes, or would like to comment, you know. :P

-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


On Tue, Mar 29, 2022 at 4:22 PM Brent Shambaugh <brent.shambaugh@gmail.com>
wrote:

> 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:
> Gqzym8nfnxR5ZYZ3wZo8rvTwKTqGn5cJsbHnEhUZDPo.
>
> This is a problem for the existing base58Matcher
>
> const base58Matcher =
> /^([1-9A-HJ-NP-Za-km-z]{44}|[1-9A-HJ-NP-Za-km-z]{88})$/
>
> A possible solution would be to rewrite this matcher to include 43
> character strings:
>
> const base58Matcher =
> /^([1-9A-HJ-NP-Za-km-z]{43,44}|[1-9A-HJ-NP-Za-km-z]{86,88})$/
>
> However, this is a problem as the base64 matcher considers the same 43
> character length, with a similar alphabet:
>
> const base64Matcher =
> /^([0-9a-zA-Z=\-_+/]{43}|[0-9a-zA-Z=\-_+/]{86})(={0,2})$/
>
> Here are the alphabets for Base64 and Base58::
>
> Base64 Alphabet::
>
> 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/=
>
> Source: https://datatracker.ietf.org/doc/html/rfc4648#section-4
>
> Base58 Alphabet::
>
> 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
>
> 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:43:57 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 29 March 2022 21:44:17 UTC