pct 0.3.0 → 0.7.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 +4 -4
- data/.github/workflows/ruby.yml +20 -0
- data/lib/pct.rb +23 -1
- data/lib/pct/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b1d925d04ac1d8b7b0fbf7da432bfbbd85fe51a44206b2dd1109ce88d62df79
|
4
|
+
data.tar.gz: b3f3abfe4a490f5ad3c1998d4975fcf6d2e7b596019a9e4b13ca1086adbbe22f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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)
|
data/lib/pct/version.rb
CHANGED
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.
|
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:
|
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
|
-
|
111
|
-
rubygems_version: 2.7.6
|
111
|
+
rubygems_version: 3.0.3
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: ''
|