encrypt_data 0.1.0 → 0.1.1

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: 5988dbbf9e4a3893db46498222effc8eec6873d83e5c4c51a02f30a44a36fa19
4
- data.tar.gz: 643d72f5196c744819dc72c9fabd8dd399ed0d02301bd017cea3025ce0e82efc
3
+ metadata.gz: a58f4be24fabaa819d3b2fb0d2f5f7ed3c631fd5ae80161b4922165b6e1bf5d7
4
+ data.tar.gz: 418aea6b3b3bc13fa45b7bdf1db7329d512c34a1982b05fdc16836f48d99b4d7
5
5
  SHA512:
6
- metadata.gz: 63b829ad931b3345f36dfbdd4a083f463f546d750f18adf8167f62d8eb4f31175c47e6906fa3fe6225921eba77d2c130256af0b56564f64575ae42de6d6ce6a8
7
- data.tar.gz: e5b21faa8b4012594b704259d92d15d3b81ef9639d0e909007d47126959648cb0c92466db74939ba9fceb88e31bf6f3b7eaa27dd7177e84ca14502a338b2e384
6
+ metadata.gz: 419f742587c91dec40712954ed642582c05a4895ce48ae4a6bba981e0207e04712e37229dc69e1c6ad9f7dcd1d215de58d7f9af92b3f3889624e41ffc7db3e27
7
+ data.tar.gz: 1a6781679ecea70753fcc3ff4ef395c0bf509b2cefdb4a59e939ea09e0570379f05b192cb221884970d64e5d64bdbb0586f584c1c49c020ad45dbd8835574bca
data/lib/encrypt_data.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "encrypt_data/version"
2
+ require "encrypt_data/configuration"
2
3
  require "encrypt_data/crypt"
3
4
  require 'base64'
4
5
  require 'openssl'
@@ -32,4 +33,20 @@ module EncryptData
32
33
  end
33
34
  end
34
35
  end
36
+
37
+ class << self
38
+ attr_accessor :configuration
39
+ end
40
+
41
+ def self.configuration
42
+ @configuration ||= Configuration.new
43
+ end
44
+
45
+ def self.reset
46
+ @configuration = Configuration.new
47
+ end
48
+
49
+ def self.configure
50
+ yield(configuration)
51
+ end
35
52
  end
@@ -0,0 +1,9 @@
1
+ module EncryptData
2
+ class Configuration
3
+ attr_accessor :master_key
4
+
5
+ def initialize
6
+ @master_key = nil
7
+ end
8
+ end
9
+ end
@@ -12,7 +12,8 @@ module EncryptData
12
12
  end
13
13
 
14
14
  def encryption_key
15
- @key || ENV['EncryptDataKey']
15
+ @master_key = ENV['EncryptDataKey'].nil? ? EncryptData.configuration.master_key : ENV['EncryptDataKey']
16
+ @key || @master_key
16
17
  end
17
18
 
18
19
  ALGO = 'aes-256-cbc'.freeze
@@ -1,3 +1,3 @@
1
1
  module EncryptData
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: encrypt_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shubham Prajapat
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-31 00:00:00.000000000 Z
11
+ date: 2021-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -47,6 +47,7 @@ extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
49
  - lib/encrypt_data.rb
50
+ - lib/encrypt_data/configuration.rb
50
51
  - lib/encrypt_data/crypt.rb
51
52
  - lib/encrypt_data/version.rb
52
53
  homepage: https://github.com/shubhamprajapat1/encrypt_data