hmac 1.0.0 → 2.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: 0da92960c7fa56af039d5ff4422bf8639e3cabafd4a948bfafb5106c61f6370a
4
- data.tar.gz: 9d060d4d8289a347d5ec042596c522080456fb48869a5827efb4cb6be9609820
3
+ metadata.gz: b341ba62c9eaddb7ec4b369cdfb13557a4b5ff7aac0e3c5c4d1c6f99fc60bfd4
4
+ data.tar.gz: 9e6d858c85ff46d7ed1678db9d3d4a97307d7b52a56ecb18f9dc12974e0b1588
5
5
  SHA512:
6
- metadata.gz: 24ebf43647946a309f3538f4d1f379acc9687922de50500c77199e1faac1d07b7f6c81d7cba6e9eecf3de3880bdd06573cdb9b437f6e3bff6a0b45d8e69a2daa
7
- data.tar.gz: d595bc49f1742dfaae7f8f3e2dc1ae931caf3cac3946503ccc08c2a8b9473aa91739bfd9d4718b3a25e9927866eb65636676828cbd68f6e70936d6f074ab6927
6
+ metadata.gz: 7a82f8525db4569fb753d198d0ab90c4c9f117f071792938a0927e5613377e84521753a4c25c6931a2941a67621687ebc2e3a30a70115b3901c7105f8663f196
7
+ data.tar.gz: 7b59569d8bd181c819ee8661a549177b66710454ae22bf366df3117bcafe3e9871a2d1590e831d4e3ef0671bed5f71847d78332f65e22ef23d7537f909cf202a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [2.0.0] - 2022-04-13
4
+
5
+ - Add a configuration class and remove direct env var access
6
+
3
7
  ## [1.0.0] - 2022-04-13
4
8
 
5
9
  - Initial release
data/Gemfile CHANGED
@@ -5,7 +5,6 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in hmac.gemspec
6
6
  gemspec
7
7
 
8
- gem "climate_control", "~> 1.0"
9
8
  gem "rake", "~> 13.0"
10
9
  gem "rspec", "~> 3.11"
11
10
  gem "rubocop", "~> 1.7"
data/Gemfile.lock CHANGED
@@ -1,13 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hmac (1.0.0)
4
+ hmac (2.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  ast (2.4.2)
10
- climate_control (1.0.1)
11
10
  diff-lcs (1.5.0)
12
11
  parallel (1.22.1)
13
12
  parser (3.1.2.0)
@@ -52,7 +51,6 @@ PLATFORMS
52
51
  x86_64-darwin-21
53
52
 
54
53
  DEPENDENCIES
55
- climate_control (~> 1.0)
56
54
  hmac!
57
55
  rake (~> 13.0)
58
56
  rspec (~> 3.11)
@@ -4,7 +4,7 @@ module HMAC
4
4
  @context = context
5
5
  @public = public
6
6
  @digest = OpenSSL::Digest.new("SHA256")
7
- @hmac_key = ENV.fetch("HMAC_SECRET")
7
+ @hmac_key = HMAC.configuration.secret
8
8
  end
9
9
 
10
10
  def generate(id:)
data/lib/hmac/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HMAC
4
- VERSION = "1.0.0"
4
+ VERSION = "2.0.0"
5
5
  end
data/lib/hmac.rb CHANGED
@@ -1,6 +1,20 @@
1
- # frozen_string_literal: true
1
+ module HMAC
2
+ class << self
3
+ def configure(&block)
4
+ block.call(configuration)
5
+ end
2
6
 
3
- module HMAC; end
7
+ def configuration
8
+ @configuration ||= HMACConfiguration.new
9
+ end
10
+
11
+ def clear_configuration
12
+ @configuration = nil
13
+ end
14
+ end
15
+
16
+ HMACConfiguration = Struct.new("HMACConfiguration", :secret)
17
+ end
4
18
 
5
19
  require_relative "hmac/generator"
6
20
  require_relative "hmac/validator"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hmac
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliot Crosby-McCullough
@@ -41,7 +41,7 @@ metadata:
41
41
  allowed_push_host: https://rubygems.org
42
42
  homepage_uri: https://github.com/SmartCasual/hmac
43
43
  source_code_uri: https://github.com/SmartCasual/hmac
44
- changelog_uri: https://github.com/SmartCasual/hmac/blob/1.0.0/CHANGELOG.md
44
+ changelog_uri: https://github.com/SmartCasual/hmac/blob/2.0.0/CHANGELOG.md
45
45
  rubygems_mfa_required: 'true'
46
46
  post_install_message:
47
47
  rdoc_options: []