-
Notifications
You must be signed in to change notification settings - Fork 10
dWeb URL Resolving
Jared Rice Sr edited this page Jun 28, 2018
·
2 revisions
Library For Resolving dWeb URLs and dPack Keys
- Common dWeb/dPack/dDrive key representations (
dweb://
, etc.) - URLs with keys in them (
dwebs.io/6161616161616161616161616161616161616161616161616161616161616161
) -
ddrive-key
ordpack-key
headers - Url to JSON http request that returns
{key: <dweb-key>}
- dWeb DNS resolution (via @distdns/core)
npm install @dwebs/resolve
var dWebUrlResolve = require('@dwebs/resolve')
dWebUrlResolve(link, function (err, key) {
console.log('found key', key)
})
Link can be string or buffer.
Resolution order:
- Validate buffers or any strings with 64 character hashes in them via @dwebs/codec
- Check headers in http request
- Check JSON request response for
key
- Dat-DNS resolution via @distdns/core
Note that @dwebs/resolve
also supports other methods, such as detection of dWeb, dPack or dDrive keys in paths and http headers.
- Plain: 40a7f6b6147ae695bcbcff432f684c7bb5291ea339c28c1755896cdeb80bd2f9
- DNS: test.dhost.io
- Plain: 40a7f6b6147ae695bcbcff432f684c7bb5291ea339c28c1755896cdeb80bd2f9+5
- DNS: test.dhost.io+5
- https: https://40a7f6b6147ae695bcbcff432f684c7bb5291ea339c28c1755896cdeb80bd2f9/
- dWeb: dweb://test.dhost.io
- https: 40a7f6b6147ae695bcbcff432f684c7bb5291ea339c28c1755896cdeb80bd2f9/path1
- dweb: test.dhost.io/path2
- 40a7f6b6147ae695bcbcff432f684c7bb5291ea339c28c1755896cdeb80bd2f9+5/path3
- dweb://40a7f6b6147ae695bcbcff432f684c7bb5291ea339c28c1755896cdeb80bd2f9+5/path4
- https://40a7f6b6147ae695bcbcff432f684c7bb5291ea339c28c1755896cdeb80bd2f9/path5 [(^1)][]
- https://test.dhost.io+5/path6 [(^2)][]
- browsers expect http and https schemes with traditional hostname, not a dWeb key
- browsers expect http and https schemes with traditional hostname, no +5 (version) support