code: function signStr(str, key) {
    var hmac = crypto.createHmac('sha1', key);
    hmac.update(str);
    return hmac.digest('base64').replace(/\+/g, '-').replace(/\//g, '_');
  }
docs: Return base64url signed sha1 hash of str using key