freeclimb 2.2.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3329b44735fb00cbe89d1f64b29bcd20746822b7976acd11e046f0e04553b78c
4
- data.tar.gz: 0c10c93eb8bf849cf7e376d111e2e1332470a27a45b67e56a5d7fcbce3e03cce
3
+ metadata.gz: 8822c0cb7172e4c5ff3cab045f98636e7645b842dcc7c17097fec6b2257c10a7
4
+ data.tar.gz: fa3c4ec0294ec97f141a1d58dffd65034f1d664b8e4ea65e62fc4ffffb2c6911
5
5
  SHA512:
6
- metadata.gz: 0d7e751a6941e8e5962b73fad832ab0893d13d0e145e46e1458d5e49781a34b82f275057565b29056094a7ec76c0e579932a81afb8740570413a23e9797c8a50
7
- data.tar.gz: 2b96b3486f150332c36af12d84f870497ba8c300b804964d99f4fc1743ece7b33789f06872eaa0c6d63173768ec42e35837d3d8195be48c43a6cb45b7b0887ee
6
+ metadata.gz: 1ad8968cabebe723a38432655e665764a7841aa97bb21a0275f3d6920bdc9c870ef69b922f03c69e79320e567e9f5a39cc2e6a9d521c8e38c684f793cf8dd761
7
+ data.tar.gz: a8b822a510b5bed0bba1b77ea3507becc96efe65259a518a6f45d014ee4c564c24828f28d23f3bb75026ceebd40daeb8c337bb998e19373f807c13e7533c37fb
data/CHANGELOG.md CHANGED
@@ -7,8 +7,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
7
7
  ## [Unreleased]
8
8
  None
9
9
 
10
+ <a name="3.0.0"></a>
11
+ ## [3.0.0] - 2021-05-03
12
+ ### Added
13
+ - Add `verify_request` utility function
14
+
10
15
  <a name="2.2.0"></a>
11
- ## [2.1.2] - 2021-04-12
16
+ ## [2.2.0] - 2021-04-12
12
17
  ### Changed
13
18
  - Replace any language instance of `auth_token` or similar speech to `api_key`
14
19
 
data/README.md CHANGED
@@ -5,7 +5,7 @@ FreeClimb is a cloud-based application programming interface (API) that puts the
5
5
  This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
6
6
 
7
7
  - API version: 1.0.0
8
- - Package version: 2.2.0
8
+ - Package version: 3.0.0
9
9
  - Build package: org.openapitools.codegen.languages.RubyClientCodegen
10
10
 
11
11
  ## Installation
@@ -21,16 +21,16 @@ gem build freeclimb.gemspec
21
21
  Then either install the gem locally:
22
22
 
23
23
  ```shell
24
- gem install ./freeclimb-2.2.0.gem
24
+ gem install ./freeclimb-3.0.0.gem
25
25
  ```
26
26
 
27
- (for development, run `gem install --dev ./freeclimb-2.2.0.gem` to install the development dependencies)
27
+ (for development, run `gem install --dev ./freeclimb-3.0.0.gem` to install the development dependencies)
28
28
 
29
29
  or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
30
30
 
31
31
  Finally add this to the Gemfile:
32
32
 
33
- gem 'freeclimb', '~> 2.2.0'
33
+ gem 'freeclimb', '~> 3.0.0'
34
34
 
35
35
  ### Install from Ruby gems
36
36
  ```shell
Binary file
data/lib/freeclimb.rb CHANGED
@@ -15,6 +15,7 @@ require 'freeclimb/api_client'
15
15
  require 'freeclimb/api_error'
16
16
  require 'freeclimb/version'
17
17
  require 'freeclimb/configuration'
18
+ require 'freeclimb/utils'
18
19
  require 'freeclimb/models/percl_command'
19
20
 
20
21
  # Models
@@ -30,7 +30,7 @@ module Freeclimb
30
30
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
31
31
  def initialize(config = Configuration.default)
32
32
  @config = config
33
- @user_agent = "FreeClimbSDK/2.2.0/ruby"
33
+ @user_agent = "FreeClimbSDK/3.0.0/ruby"
34
34
  @default_headers = {
35
35
  'Content-Type' => 'application/json',
36
36
  'User-Agent' => @user_agent
@@ -0,0 +1,34 @@
1
+ require 'json'
2
+ require 'cgi'
3
+ require 'date'
4
+ require 'openssl'
5
+
6
+ module FreeClimb
7
+ class Utils
8
+ def self.verify_request(requestBody, signatureHeader, signingSecret, tolerance=5*60*1000)
9
+ signatureArr = signatureHeader.split(',')
10
+ signatureHash = {}
11
+ signatureArr.each { |queryStr|
12
+ hash = CGI.parse(queryStr)
13
+ if (signatureHash.key?(hash.keys[0]))
14
+ signatureHash[hash.keys[0]] = [signatureHash[hash.keys[0]]].append(hash.values[0][0])
15
+ else
16
+ signatureHash[hash.keys[0]] = hash.values[0][0]
17
+ end
18
+ }
19
+
20
+ currentTime = DateTime.now.strftime('%s')
21
+ signatureAge = currentTime.to_i - signatureHash["t"].to_i
22
+ if (tolerance < signatureAge)
23
+ raise StandardError.new "Request rejected - signature's timestamp failed against current tolerance of #{tolerance} milliseconds. Signature age: #{signatureAge} milliseconds";
24
+ end
25
+
26
+ data = signatureHash["t"] + "." + requestBody
27
+ hmac = OpenSSL::HMAC.hexdigest('sha256', signingSecret, data)
28
+
29
+ if (!signatureHash["v1"].include? hmac)
30
+ raise StandardError.new "Unverified Request Signature - FreeClimb was unable to verify that this request originated from FreeClimb. If this request was unexpected, it may be from a bad actor. Please proceed with caution. If this request was expected, to fix this issue try checking for any typos or misspelling of your signing secret.";
31
+ end
32
+ end
33
+ end
34
+ end
@@ -11,5 +11,5 @@ OpenAPI Generator version: 4.3.0-SNAPSHOT
11
11
  =end
12
12
 
13
13
  module Freeclimb
14
- VERSION = '2.2.0'
14
+ VERSION = '3.0.0'
15
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freeclimb
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenAPI-Generator
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-04 00:00:00.000000000 Z
11
+ date: 2021-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -196,6 +196,7 @@ files:
196
196
  - freeclimb-2.1.0.gem
197
197
  - freeclimb-2.1.1.gem
198
198
  - freeclimb-2.1.2.gem
199
+ - freeclimb-2.2.0.gem
199
200
  - freeclimb.gemspec
200
201
  - lib/freeclimb.rb
201
202
  - lib/freeclimb/api/default_api.rb
@@ -304,6 +305,7 @@ files:
304
305
  - lib/freeclimb/models/update_call_request.rb
305
306
  - lib/freeclimb/models/update_conference_participant_request.rb
306
307
  - lib/freeclimb/models/update_conference_request.rb
308
+ - lib/freeclimb/utils.rb
307
309
  - lib/freeclimb/version.rb
308
310
  - spec/api/default_api_spec.rb
309
311
  - spec/api/web_mocks.rb