resolve urls, links to a dwebx key using common methods
- Common dwebx key representations (
dwebx://
, etc.) - URLs with keys in them (
dwebx.org/6161616161616161616161616161616161616161616161616161616161616161
) ddrive-key
ordwebx-key
headers- Url to JSON http request that returns
{key: <dwebx-key>}
- DWebX-DNS resolution (via dwebx-dns)
npm install dwebx-link-resolve
var dwebxResolve = require('dwebx-link-resolve')
dwebxResolve(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 dwebx-encoding
- Check headers in http request
- Check JSON request response for
key
- DWebX-DNS resolution via dwebx-dns
Trying to tighten up a bit dwebx-link-resolve (and its dependencies dwebx-dns and dwebx-decode). I am noticing a few inconsistencies as I'm writing dwebx-shell.
Ideally, I'd like to launch dwebx-shell like this:
$ dwebx-shell dwebx://40a7f6b6147ae695bcbcff432f684c7bb5291ea339c28c1755896cdeb80bd2f9+5/path4
and have it open the dwebx at version 5 and change directory to /path4.
Currently dwebx-shell google-fonts-kewitz.hashbase.io/fonts/
fails somewhere in dwebx-link-resolve.
Note that dwebx-link-resolve also supports other methods, such as detection of dwebx keys in paths and http headers.
- Plain: 40a7f6b6147ae695bcbcff432f684c7bb5291ea339c28c1755896cdeb80bd2f9
- DNS: dwebx.org
- Plain: 40a7f6b6147ae695bcbcff432f684c7bb5291ea339c28c1755896cdeb80bd2f9+5
- DNS: dwebx.org+5
- https: https://40a7f6b6147ae695bcbcff432f684c7bb5291ea339c28c1755896cdeb80bd2f9/
- dwebx: dwebx://dwebx.org
- https: 40a7f6b6147ae695bcbcff432f684c7bb5291ea339c28c1755896cdeb80bd2f9/path1
- dwebx: dwebx.org/path2
- 40a7f6b6147ae695bcbcff432f684c7bb5291ea339c28c1755896cdeb80bd2f9+5/path3
- dwebx://40a7f6b6147ae695bcbcff432f684c7bb5291ea339c28c1755896cdeb80bd2f9+5/path4
- https://40a7f6b6147ae695bcbcff432f684c7bb5291ea339c28c1755896cdeb80bd2f9/path5 (^1)
- https://dwebx.org+5/path6 (^2)
- browsers expect http and https schemes with traditional hostname, not a dwebx key
- browsers expect http and https schemes with traditional hostname, no +5 (version) support
Contributions welcome! Please read the contributing guidelines first.