rcredstash 0.8.0 → 0.9.0

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: 0c503a48bd56dbfee13222514549626a636005dd
4
- data.tar.gz: f664fc01a74b9ae7e9914338dc590377d47746d4
3
+ metadata.gz: 400e378c187be7aabf11ec9b40c30481a28c7f7b
4
+ data.tar.gz: b30e9a9d3c57aa482e566b992c5f4522ce81fc79
5
5
  SHA512:
6
- metadata.gz: 1f387818f34421f318e478f98908467723e43c817e50fb47dcdc375de21166864b587f4676e0eef904bc80aa6bac5211436eaabfe4b79e228b91939a4c7c8cd4
7
- data.tar.gz: 30df72810770015138b66e23c0fada77aa1a9b247ac913f9337ce83d8f95ade4e75aa87459e1d0bcf53568f1a5eeacf12bde50d97670c599041866ec7ad3ac3c
6
+ metadata.gz: 59f2ca9b2e3359f05bf0131b02e5bdc7faefb568205f28b445b048d9807e4c3f492e35608c580000dcda3a0690b28db5cd368c22d97286653ec4ad4d9af21183
7
+ data.tar.gz: 630d47addd867cc9fd1e58d05bb642b7bf6a52857df2c26fef98eee6b6a23c05f17d6a3c7f725dae90f33f115f965a61335137e4812929f2a83060d84b671fd9
data/lib/cred_stash.rb CHANGED
@@ -16,9 +16,9 @@ module CredStash
16
16
  nil
17
17
  end
18
18
 
19
- def put(name, value, context: {})
19
+ def put(name, value, kms_key_id: nil, context: {})
20
20
  secret = Secret.new(name: name, value: value, context: context)
21
- secret.encrypt!
21
+ secret.encrypt!(kms_key_id: kms_key_id)
22
22
  secret.save
23
23
  end
24
24
 
@@ -1,9 +1,12 @@
1
1
  class CredStash::CipherKey
2
+ DEFAULT_KMS_KEY_ID = "alias/credstash".freeze
3
+
2
4
  attr_reader :data_key, :hmac_key, :wrapped_key
3
5
 
4
- def self.generate(client: Aws::KMS::Client.new, context: {})
6
+ def self.generate(client: Aws::KMS::Client.new, kms_key_id: nil,
7
+ context: {})
5
8
  res = client.generate_data_key(
6
- key_id: 'alias/credstash',
9
+ key_id: kms_key_id || DEFAULT_KMS_KEY_ID,
7
10
  number_of_bytes: 64,
8
11
  encryption_context: context
9
12
  )
@@ -10,8 +10,8 @@ class CredStash::Secret
10
10
  @context = context
11
11
  end
12
12
 
13
- def encrypt!
14
- @key = CredStash::CipherKey.generate(context: @context)
13
+ def encrypt!(kms_key_id: nil)
14
+ @key = CredStash::CipherKey.generate(kms_key_id: kms_key_id, context: @context)
15
15
  @encrypted_value = @key.encrypt(@value)
16
16
  @hmac = @key.hmac(@encrypted_value)
17
17
  end
@@ -1,3 +1,3 @@
1
1
  module CredStash
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rcredstash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - adorechic
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-14 00:00:00.000000000 Z
11
+ date: 2017-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk