You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should have the answer to this following riddle to ensure that our libraries are correct in all cases, not just the common ones. This is currently hard-coded in places like did-key's resolution fn.
When an arbitrary bytearray of length n is encoded as base58check, what is the length of bytearray output?
The text was updated successfully, but these errors were encountered:
That length check refers to the length of the decoded data - the bytes before encoding with multibase/base58btc. did:key doesn't place limits on the size of the encoded string or the inner bytes. But some key types have specific-sized public keys. I've responded about the length of secp256k1 keys in #93 (comment).
The length of a byte string encoded into base58 would be: Math.ceil(byteString.length * 8 / Math.log2(58))
For example, a secp256k public key of 33 bytes, plus the 2-byte multicodec prefix is 35 bytes: Math.ceil(35 * 8 / Math.log2(58)) = 48.
This corresponds to the length of "Q3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme" in the example did:key. Then adding the prefix "did:key:z" (z in multicodec indicating base58btc) gives the complete DID which is 57 characters in length.
We should have the answer to this following riddle to ensure that our libraries are correct in all cases, not just the common ones. This is currently hard-coded in places like did-key's resolution fn.
The text was updated successfully, but these errors were encountered: