Skip to content

Instantly share code, notes, and snippets.

@danielefrisanco
Last active November 21, 2016 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielefrisanco/e02505fa935edecc0159 to your computer and use it in GitHub Desktop.
Save danielefrisanco/e02505fa935edecc0159 to your computer and use it in GitHub Desktop.
script to create a signature for identification_request api
#!/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