bigbluebutton-api-ruby 1.8.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/bigbluebutton-api-ruby.gemspec +1 -1
- data/lib/bigbluebutton_api.rb +7 -2
- data/spec/bigbluebutton_api_spec.rb +28 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0441812c16477d28d431e085349d9b41dbb2487fa2714658d0f4257bfbfc696
|
4
|
+
data.tar.gz: d6ef204678952d1890225b2e66dd17e7aafb2a20733ffd2733b6a99c3a9383f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a62b74b9922d8eae4ad5f28be54e5975c0bbc7e267a7da457f3c307ca3199a3bf82f6acc2361e419df9c7a3277882e66cf10ba9cd52f60f23f6a3a8a8e88faa
|
7
|
+
data.tar.gz: 8630d39007e82a5d3e0fd0ea623e51138a62726e1778170d03db1150220196906b7665d9caab3e4cf9b85eeebf11445ae7302670048ee8eee4fc7f7e2773235b
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [1.9.0] - 2022-05-03
|
4
|
+
* [#56] Add support for checksum using SHA256
|
5
|
+
|
6
|
+
[#56]: https://github.com/mconf/bigbluebutton-api-ruby/pull/56
|
7
|
+
[1.9.0]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.8.0...v1.9.0
|
8
|
+
|
3
9
|
## [1.8.0] - 2021-12-06
|
4
10
|
* [#43] Add keys to every `BigBlueButtonException`, to better identify them.
|
5
11
|
* [#42] Change `BigBlueButtonException` to inherit from `StandardError` instead of `Exception`.
|
data/Gemfile.lock
CHANGED
@@ -2,7 +2,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "bigbluebutton-api-ruby"
|
5
|
-
s.version = "1.
|
5
|
+
s.version = "1.9.0"
|
6
6
|
s.licenses = ["MIT"]
|
7
7
|
s.extra_rdoc_files = ["README.md", "LICENSE", "LICENSE_003", "CHANGELOG.md"]
|
8
8
|
s.summary = "BigBlueButton integration for ruby"
|
data/lib/bigbluebutton_api.rb
CHANGED
@@ -2,6 +2,7 @@ require 'net/http'
|
|
2
2
|
require 'cgi'
|
3
3
|
require 'rexml/document'
|
4
4
|
require 'digest/sha1'
|
5
|
+
require 'digest/sha2'
|
5
6
|
require 'rubygems'
|
6
7
|
require 'bigbluebutton_hash_to_xml'
|
7
8
|
require 'bigbluebutton_exception'
|
@@ -68,13 +69,17 @@ module BigBlueButton
|
|
68
69
|
# url:: URL to a BigBlueButton server (e.g. http://demo.bigbluebutton.org/bigbluebutton/api)
|
69
70
|
# secret:: Shared secret for this server
|
70
71
|
# version:: API version e.g. 0.81
|
71
|
-
|
72
|
+
# logger:: Logger object to log actions (so apps can use their own loggers)
|
73
|
+
# sha256:: Flag to use sha256 when hashing url contents for checksum
|
74
|
+
def initialize(url, secret, version=nil, logger=nil, sha256=false)
|
72
75
|
@supported_versions = ['0.8', '0.81', '0.9', '1.0']
|
73
76
|
@url = url
|
74
77
|
@secret = secret
|
75
78
|
@timeout = 10 # default timeout for api requests
|
76
79
|
@request_headers = {} # http headers sent in all requests
|
77
80
|
@logger = logger
|
81
|
+
@sha256 = sha256
|
82
|
+
# If logger is not informed, it defaults to STDOUT with INFO level
|
78
83
|
if logger.nil?
|
79
84
|
@logger = Logger.new(STDOUT)
|
80
85
|
@logger.level = Logger::INFO
|
@@ -680,7 +685,7 @@ module BigBlueButton
|
|
680
685
|
# checksum calc
|
681
686
|
checksum_param = params_string + @secret
|
682
687
|
checksum_param = method.to_s + checksum_param
|
683
|
-
checksum = Digest::SHA1.hexdigest(checksum_param)
|
688
|
+
checksum = @sha256 ? Digest::SHA256.hexdigest(checksum_param) : Digest::SHA1.hexdigest(checksum_param)
|
684
689
|
|
685
690
|
if method == :setConfigXML
|
686
691
|
params_string = "checksum=#{checksum}&#{params_string}"
|
@@ -474,17 +474,34 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
474
474
|
end
|
475
475
|
|
476
476
|
context "includes the checksum" do
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
477
|
+
context "when @sha256 is false or nil" do
|
478
|
+
let(:params) { { param1: "value1", param2: "value2" } }
|
479
|
+
let(:checksum) {
|
480
|
+
# the hash can be sorted differently depending on the ruby version
|
481
|
+
if params.map{ |k, v| k }.join =~ /^param1/
|
482
|
+
"67882ae54f49600f56f358c10d24697ef7d8c6b2"
|
483
|
+
else
|
484
|
+
"85a54e28e4ec18bfdcb214a73f74d35b09a84176"
|
485
|
+
end
|
486
|
+
}
|
487
|
+
subject { api.get_url(:join, params)[0] }
|
488
|
+
it('uses SHA1') { subject.should match(/checksum=#{checksum}$/) }
|
489
|
+
end
|
490
|
+
|
491
|
+
context "when @sha256 flag is true" do
|
492
|
+
let(:api) { BigBlueButton::BigBlueButtonApi.new(url, secret, version, logger, true) }
|
493
|
+
let(:params) { { param1: "value1", param2: "value2" } }
|
494
|
+
let(:checksum) {
|
495
|
+
# the hash can be sorted differently depending on the ruby version
|
496
|
+
if params.map{ |k,v| k }.join =~ /^param1/
|
497
|
+
"0e7b1611809fad890a114dddae1a37fecf14c28971afc10ee3eac432da5b8b41"
|
498
|
+
else
|
499
|
+
"21bf2d24c27251c4b2b2f0d5dd4b966a2f16fbfc7882e102b44c6d67f728f0c8"
|
500
|
+
end
|
501
|
+
}
|
502
|
+
subject { api.get_url(:join, params)[0] }
|
503
|
+
it('uses SHA256') { subject.should match(/checksum=#{checksum}$/) }
|
504
|
+
end
|
488
505
|
end
|
489
506
|
end
|
490
507
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bigbluebutton-api-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mconf
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-05-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: childprocess
|