Geolocation npm package
The Geolocation npm package abstracts a lot of the complexity of manually requesting Proofs by providing a series of useful methods to easily check the validity of your values, sign messages and send requests to the W3bstream Node.
Installation
To install the package run:
HIW
Create a new instance of a geolocation, like this:
This constructor doesn't take any parameters for testnet.
In order to call the mainnet API you'll need to specify it like this:
In order to generate a Siwe message, you'll have to first create a location, like this:
Or for scaled coordinates (e.g. latitude: 47658872, etc...), you can set a scaledLocationArea
like this:
These values will be validated under the hood, and will be used in the generateSiweMessage()
method:
You can now use any library of choice to sign this message and retrieve its signature.
You can set the signature you just retrieved like this:
You're now ready to call the verifyLocation()
method which will not need any params.
Last updated