Last active
November 21, 2016 13:17
-
-
Save danielefrisanco/e02505fa935edecc0159 to your computer and use it in GitHub Desktop.
script to create a signature for identification_request api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'digest' | |
require 'cgi' | |
secret_key = ARGV.pop | |
fields =%w(api_token callback_url face_url id_url nonce timestamp) | |
ARGV.map!{|argv| CGI::escape(argv )} | |
puts Digest::HMAC.hexdigest( fields.zip(ARGV).map!{ |pair| pair.join("=") }.join("?"), | |
secret_key, | |
Digest::SHA256) | |
# ruby ./signature.rb pippo http://localhost:12345/api https://media.licdn.com/mpr/mpr/shrink_200_200/p/4/005/088/341/1cf13a1.jpg http://www.plotprojects.com/wp-content/uploads/2015/02/xevent.jpg.pagespeed.ic.iEEoMX8ctX.jpg ciao 1438248110556 segreto |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment