Sign params with a shared secret
Add this line to your application's Gemfile:
gem 'param_signer'
And then execute:
$ bundle
Or install it yourself as:
$ gem install param_signer
signature = ParamSigner::Signer.sign({
foo: 'bar',
asdf: 'qwer'
}, my_secret)
Or, you can create an instance to reuse:
signer = ParamSigner::Signer.new(my_secret)
signature = signer.sign({
foo: 'bar',
asdf: 'qwer'
})
ParamSigner::Signer.valid?({
foo: 'bar',
asdf: 'qwer'
}, my_secret, signature)
Or, you can create an instance to reuse:
signer = ParamSigner::Signer.new(my_secret)
is_valid = signer.valid?({
foo: 'bar',
asdf: 'qwer'
}, signature)
- Fork it ( https://github.com/avvo/param_signer/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request