WebProperty is a BEP 46 package https://www.bittorrent.org/beps/bep_0046.html
Using this package you can update your torrents by using a public key
There are 3 modules in this package, they are the following: lookup, managed, and regular
const {WebProperty, verify} = require('webproperty/lookup.js')
lookup is used for the bare minimum, you can publish an infohash under a public key and you can resolve a public key to a infohash
webproperty.publish(keypairObject, infoHashString, sequenceNumber, metaObject, (errorCallback, responseCallback))
keypair
is optional, can either be an object with the address(public key) and secret(private key) {address: publickey, secret: privatekey}, or it can be a falsy value like null and it will create a keypair for you
infoHashString
is required, it needs to be a 40 character infohash string of a torrent
sequenceNumber
is optional, it can either be the sequence number you want to publish the data at, or it can be null and the package will take care of the sequence for you
metaObject
is optional, it is an object that holds strings of extra details that you might want to add for the torrent, or leave it null, remember to be careful here because there is a size limit when it comes to saving data in the network
(errorCallback, responseCallback)
is required, errorCallback is returned if it would not publish the data for some reason, responseCallback is returned the data was successfully published
webproperty.resolve(publicKeyAddressString, (errorCallback, responseCallback))
publicKeyAddressString
is required, it needs to be a 64 character public key string
(errorCallback, responseCallback)
is required, errorCallback is returned if it could not resolve the address to an infohash for some reason, responseCallback is returned if the address was successfully resolved to a infohash
webproperty.shred(publicKeyAddressString, (errorCallback, responseCallback))
publicKeyAddressString
is required, it needs to be a 64 character public key string
(errorCallback, responseCallback)
is required, errorCallback is returned if it could not remove the data for some reason, responseCallback is returned the data was successfully removed
takes an address and gets the data from the network and then puts that data back into the network to keep it active
webproperty.current(publicKeyAddressString, (errorCallback, responseCallback))
publicKeyAddressStrinng
is required, must be a 64 character public key
(errorCallback, responseCallback)
is required, errorCallback is returned if it could not both get the data and put the data back, responseCallback is returned if it both got the data and put it back into the network
webproperty.createKeypair()
return a {address: publicKeyString, secret: privateKeyString} object, both address and secret in the object will be a string
webproperty.addressFromLink(linkString)
returns the public key address after parsing the string
webproperty.on('error', error)
the error event is fired when there is an error, the check option must be enabled