content-hash
content-hash copied to clipboard
Decoding an IPNS name that uses DNSLink
-
decodereturns the base58 string for an IPNS + DNSLink name, when we expect the utf8 string - the content when base58 decoded includes a prefix of the string length e.g. the uniswap.eth contenthash is 0xe5010170000f6170702e756e69737761702e6f7267 this points at the ipns url: ipns://app.uniswap.org
import {decode} from 'content-hash'
// this is the result of decode in the latest version of content-hash
decode('0xe5010170000f6170702e756e69737761702e6f7267') === '12uA8M8Ku8mHUumxHcu7uee'
if i base58 decode '12uA8M8Ku8mHUumxHcu7uee' and then convert to utf8 i get:
"\u0000\u000fapp.uniswap.org"