Generates and verifies signatures
$ npm i -S @tadashi/signature
import {generate} from '@tadashi/signature'
const algorithm = 'sha1'
const payload = '{}'
const secret = 'a7fee042a2e1a9fa27cfc6931949ffe1'
const signature = generate(algorithm, payload, secret)
// => sha1=61ca6afb7b2752e106c939df11bbd7ca883b8166
import {verify} from '@tadashi/signature'
const signature = 'sha1=61ca6afb7b2752e106c939df11bbd7ca883b8166'
const payload = '{}'
const secret = 'a7fee042a2e1a9fa27cfc6931949ffe1'
const isValid = verify(signature, payload, secret)
// => true
parameter | type | required | description |
---|---|---|---|
signature | string | yes | Algorithm that will be used |
payload | string | yes | Data to generate |
secret | string | yes | Some expression |
parameter | type | required | description |
---|---|---|---|
signature | string | yes | Algorithm used + hash e.g. sha1=61c...675 |
payload | string | yes | Data used to generate the hash |
secret | string | yes | The same expression used to generate |
- BTC: bc1q7famhuj5f25n6qvlm3sssnymk2qpxrfwpyq7g4
MIT © Thiago Lagden