pct 0.3.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee452e3c06feccbfb13bde1e96c48ae01cee39bd3f5ff59fda297c27f4392cfb
4
- data.tar.gz: 0f03dd5fa069655cd278ad5143157a01b0a658aab2e4d2c49132cc6ac1098499
3
+ metadata.gz: 6b1d925d04ac1d8b7b0fbf7da432bfbbd85fe51a44206b2dd1109ce88d62df79
4
+ data.tar.gz: b3f3abfe4a490f5ad3c1998d4975fcf6d2e7b596019a9e4b13ca1086adbbe22f
5
5
  SHA512:
6
- metadata.gz: c10e48e2a83e9cf6fed37868dced4ce3051e3df1da38643401fad9b6b316b94eab33f15213898566826bad3a9e875573feaefe38df98af83b89b4f1c61b50178
7
- data.tar.gz: f31c5372ad61952280198a852853bf0a80809af6c15354adac8bb3b2968b6288e74bf1ca1bcc5b2b6449957f79db48d8c89923d9d7fd14df3c2caec7d7f60c25
6
+ metadata.gz: ae6ee4eb117ce0a177f0307309f121603b9f0909ac9db690454eb420668a4b44f880151d946db93a123e6cb5f0e93b9422b4d6ba713aa089eea3cb839a89adbd
7
+ data.tar.gz: 64ab350a8cd1e8f725b2f6a84feeb24576741e3cc5b6f429517837080b4f1c06d55b58eb70a1a0339472a1305c919d3b2cc42079cfa10118805c10ed6fbd544b
@@ -0,0 +1,20 @@
1
+ name: Ruby
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@v1
12
+ - name: Set up Ruby 2.6
13
+ uses: actions/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.6.x
16
+ - name: Build and test with Rspec
17
+ run: |
18
+ gem install bundler
19
+ bundle install --jobs 4 --retry 3
20
+ bundle exec rspec
data/lib/pct.rb CHANGED
@@ -7,6 +7,18 @@ require 'aws-sdk-kms'
7
7
  module Pct
8
8
  class Error < StandardError; end
9
9
 
10
+ class Decryptable
11
+ def initialize(crypted)
12
+ @crypted = crypted
13
+ end
14
+
15
+ def decrypted
16
+ @decrypted ||= Pct.client.decrypt({
17
+ ciphertext_blob: Base64.decode64(@crypted)
18
+ }).plaintext
19
+ end
20
+ end
21
+
10
22
  DEFAULT = <<~EOS
11
23
  configuration:
12
24
  example_key: "some value that should be encrypted"
@@ -25,7 +37,17 @@ module Pct
25
37
 
26
38
  def self.load_config(path)
27
39
  config = YAML.load(File.read(path))
28
- to_decrypted(config['configuration'])
40
+ to_usable(config['configuration'])
41
+ end
42
+
43
+ def self.to_usable(configuration)
44
+ Hash[configuration.map do |k, v|
45
+ if v.is_a?(Hash)
46
+ [k, to_usable(v)]
47
+ else
48
+ [k, Decryptable.new(v)]
49
+ end
50
+ end]
29
51
  end
30
52
 
31
53
  def self.encrypt(value, key)
@@ -1,3 +1,3 @@
1
1
  module Pct
2
- VERSION = "0.3.0"
2
+ VERSION = "0.7.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emily Dobervich
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-18 00:00:00.000000000 Z
11
+ date: 2020-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -74,6 +74,7 @@ executables:
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
+ - ".github/workflows/ruby.yml"
77
78
  - ".gitignore"
78
79
  - ".rspec"
79
80
  - ".travis.yml"
@@ -107,8 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
108
  - !ruby/object:Gem::Version
108
109
  version: '0'
109
110
  requirements: []
110
- rubyforge_project:
111
- rubygems_version: 2.7.6
111
+ rubygems_version: 3.0.3
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: ''