Archived from the Transloadit support forum. Originally posted on September 23, 2011; details may be outdated, see our docs for current behavior. Original thread
I am trying to get the Ruby sample given at http://transloadit.com/docs/authentication working in node.js. Could you please provide an equivalent node.js sample on that page?
I am a novice in using Crypto library. The signature from Ruby and node.js code are different. Any help is appreciated.
Ruby code:
require ‘openssl’
digest = OpenSSL::Digest::Digest.new(‘sha1’)
signature = OpenSSL::HMAC.hexdigest(digest, ‘auth secret’, ‘some string’)
puts signature
Node.js code:
var crypto, signature;
crypto = require('crypto');
signature = crypto.createHash("sha1").
update('auth secret').
update('some string').
digest("hex")
console.log(signature);