Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify Multicodec Identifiers #35

Open
Matt-Spence opened this issue May 20, 2021 · 6 comments
Open

Clarify Multicodec Identifiers #35

Matt-Spence opened this issue May 20, 2021 · 6 comments

Comments

@Matt-Spence
Copy link

Matt-Spence commented May 20, 2021

The draft spec says that the Multibase step is a base58 encoding of "a concatenation of the Multicodec [MULTICODEC] identifier for the public key type and the raw bytes". The multicodec table it references is here, and doesn't seem to match the examples in the spec. For instance, for an ed25519 pub key (line 85 in the csv), the Multicodec identifier is listed as 0xed, but the example keys all begin with 0xed01. This extra 01 is also present in the Secp256k1 examples (0xe7 in the list, 0xe701 in the example). The extra 01 byte should either be dropped, or the spec should be clarified to make it clear why these don't match the cited multicodec list.

@paulbastian
Copy link

I just came through the same thought process.
Have a look here:
https://github.com/multiformats/unsigned-varint
https://lists.w3.org/Archives/Public/public-credentials/2021Mar/0042.html

@Matt-Spence
Copy link
Author

That explains it. Thank you for the information, I was unaware of the strange way multicodec handles integers. This should be clarified in the spec.

@paulbastian
Copy link

Yes, I agree as well, it's pretty unintuitive and makes it hard to read the codec as the values in the csv are stored as "real" ints and not varints. You got to live with that or choose others like JWK+base64 or similar

@OR13
Copy link
Contributor

OR13 commented Sep 23, 2021

How can I help to address this concern?

@miketery
Copy link

miketery commented Feb 18, 2022

Had same trouble as above when I was trying to figure out mapping from key (z6Mkp...) to publicKeyBase58 (B12NY...).

@OR13 , I think an example showing the hex of the public key, and then the steps to add 0xED01 (0xED for ed25519 per multicodec table, 0x01 due to integer encoding) then to base58, then add z.

@OR13
Copy link
Contributor

OR13 commented Feb 22, 2022

yes, i have also struggled with this.... I agree with the proposed approach:

define a table, include the public key bytes, public key kty / crv, multicodec prefix, base58 encoding.

provide an example for all supported multicodec public keys.

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

No branches or pull requests

4 participants