@web4/dns v1.0.0
@web4/dns
Advanced resolving of decentralized web links using different name systems such as DNS Txt entries and .well-known https lookups locations.
It implements various naming systems such as dat, bit and cabal but is extensible to support other systems as well.
π Basic API
After installing it through npm, you can simply run it like this:
const { resolveProtocol, resolve, resolveURL } = require('@web4/dns')
const protocol = 'bit'
const domain = 'social.x'
const key = await resolveProtocol(protocol, domain)Note: You may need to wrap it in a
asyncfunction until top level async/await lands.
That's it! π - in the key variable you will get the bit key or null, if it can't be found.
π§ββοΈ What is this magic?
Different decentralized web systems have different means to resolve "names" to a decentralized document.
@web4/dns contains a variety of implementations. Many are using DNS TXT records that contain a key of specified pattern, but other means are possible as well. β (more in the Protocol Guide)
The power of @web4/dns in comparison to other, protocol-specific implementations is that it has a shared cache for all protocols, it works in he browser and does a list of things well. β (more in the Architecture Overview)
π©βπ Further reading
- Architecture Overview β¦to learn how caching and other things work. π΅οΈββοΈ
- API documentation β¦for getting to know the API in detail. π§βπ»
- Contribution Guide β¦because help is always welcome. π₯³
- Protocol Guide β¦for current protocols and adding new ones. π€
π License
4 years ago