moonshot 1.1.0.beta2 → 1.1.0.beta3

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
  SHA1:
3
- metadata.gz: 47ebc9ac74a51f7c8b474a1947508d4f32d16e9d
4
- data.tar.gz: 84c3812ddc48bb7308027d442306a85288be1c94
3
+ metadata.gz: 87a9ec0c99ce38df80d130a365c6c1dc660d5b86
4
+ data.tar.gz: 2741587ad46b254631dee2819b85a2165c14221f
5
5
  SHA512:
6
- metadata.gz: 2bd8244804aa2441c7f95434f68ae5f39c8e0c9fa305d986a66e5477e0285d244a6cb196a77036d22080fe62cf4897b8438f932fba53638fe71120c1b2bc065a
7
- data.tar.gz: fb7bba6e3ae5e84e2a8f4f9c70953f1578425770fe37ea9ce2a2f2bc7f920757a31f311c7cacc3834488a3355b828871ca22a271fb385620fbb4e0a2c4935a54
6
+ metadata.gz: 902fc172728fe21adf3dac9bc21ad20a5d861d0a8dee5a3951d9cf88349ea3c99f7fc1dab8504ad2792aea9e243311fa218079c6335a794f374c09e07cc04a5b
7
+ data.tar.gz: 8df16b96b4dd1e2353fab4bf39b40204a4eef32d1ff81846611a768c0e44c118753282334f98b51ff861df1bb0b6b82298be8379d5d0b5dc1015bed52f0cedf8
@@ -1,22 +1,24 @@
1
- class EncryptedParameters
2
- # Class that manages KMS keys in AWS.
3
- class KmsKey
4
- attr_reader :arn
1
+ module Moonshot
2
+ class EncryptedParameters
3
+ # Class that manages KMS keys in AWS.
4
+ class KmsKey
5
+ attr_reader :arn
5
6
 
6
- def initialize(arn)
7
- @arn = arn
8
- @kms_client = Aws::KMS::Client.new
9
- end
7
+ def initialize(arn)
8
+ @arn = arn
9
+ @kms_client = Aws::KMS::Client.new
10
+ end
10
11
 
11
- def self.create
12
- resp = Aws::KMS::Client.new.create_key
13
- arn = resp.key_metadata.arn
12
+ def self.create
13
+ resp = Aws::KMS::Client.new.create_key
14
+ arn = resp.key_metadata.arn
14
15
 
15
- new(arn)
16
- end
16
+ new(arn)
17
+ end
17
18
 
18
- def delete
19
- @kms_client.schedule_key_deletion(key_id: @arn, pending_window_in_days: 7)
19
+ def delete
20
+ @kms_client.schedule_key_deletion(key_id: @arn, pending_window_in_days: 7)
21
+ end
20
22
  end
21
23
  end
22
24
  end
@@ -1,23 +1,24 @@
1
1
  require 'base64'
2
+ module Moonshot
3
+ class EncryptedParameters
4
+ # Class that can encrypt and decrypt parameters using KMS.
5
+ class ParameterEncrypter
6
+ # @param [String] key_arn The ARN for the KMS key.
7
+ def initialize(key_arn)
8
+ @kms_client = Aws::KMS::Client.new
9
+ @key_arn = key_arn
10
+ end
2
11
 
3
- class EncryptedParameters
4
- # Class that can encrypt and decrypt parameters using KMS.
5
- class ParameterEncrypter
6
- # @param [String] key_arn The ARN for the KMS key.
7
- def initialize(key_arn)
8
- @kms_client = Aws::KMS::Client.new
9
- @key_arn = key_arn
10
- end
11
-
12
- # Encrypt and base64 encode the parameter value.
13
- #
14
- # @param [String] param_value The parameter to encrypt.
15
- # @return [String] base64 encoded encrypted ciphertext.
16
- def encrypt(param_value)
17
- resp = @kms_client.encrypt(key_id: @key_arn, plaintext: param_value)
12
+ # Encrypt and base64 encode the parameter value.
13
+ #
14
+ # @param [String] param_value The parameter to encrypt.
15
+ # @return [String] base64 encoded encrypted ciphertext.
16
+ def encrypt(param_value)
17
+ resp = @kms_client.encrypt(key_id: @key_arn, plaintext: param_value)
18
18
 
19
- # Use strict here to avoid newlines which cause issues with parameters.
20
- Base64.strict_encode64(resp.ciphertext_blob)
19
+ # Use strict here to avoid newlines which cause issues with parameters.
20
+ Base64.strict_encode64(resp.ciphertext_blob)
21
+ end
21
22
  end
22
23
  end
23
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moonshot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.beta2
4
+ version: 1.1.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cloud Engineering <engineering@acquia.com>
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-26 00:00:00.000000000 Z
11
+ date: 2016-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk