rcredstash 1.1.0 → 2.0.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
  SHA256:
3
- metadata.gz: 67d409c186f9c7006ef72dca4f1f60aa350fb868dfd1057c98be393d8f2c37cb
4
- data.tar.gz: 0af15c57f304ae9ad1227b3a014f3f966880b7b688d749fb26dcf858153794c0
3
+ metadata.gz: f5b4072a6a3800e27a23712bb59ee8df5b4ec5be248acd94dbd0711fec3f4f54
4
+ data.tar.gz: 9d3eafb59ea8a166a66a4a79ccf6ed3c93ddfbe110b51ca5accb61d215a79070
5
5
  SHA512:
6
- metadata.gz: 0a54e33b123c10b28858e73705a6dafe3fca7e47f7c74d74c171cf5ae49763ebddd620c2ac550b095bd08bdcc7938bdf68940c7e3e1eb34b4398dcc233b889b9
7
- data.tar.gz: 89a073eaa083fa4b000d422a9b9887c23ceffc5b1a7ba59662633f482597e896bcd28d25b5f7cc4429c011955ac4eea095055bb75516977f1c3be5e8c1d26027
6
+ metadata.gz: 3e011ab87a68a9022ebca726c4ee7316d2abaa39a5de721112f74199324b7fb4b5091393f70976c5947f9cf45581831bd2e5e9c035f614d838f71d793310f486
7
+ data.tar.gz: 5d19538fb21c39cdee4906cb447bb49846d3c7111d22afbe66d011846b688b8464c1d65ce1e0a214977f491e7c15d116098daf8a51da2b1ba4e8c5977449ff94
@@ -0,0 +1,28 @@
1
+ name: Ruby CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+
13
+ strategy:
14
+ matrix:
15
+ # Currently supported Ruby versions as of 2024-04-03.
16
+ # See for current status: https://www.ruby-lang.org/en/downloads/branches/
17
+ ruby-version: ['3.3', '3.2', '3.1']
18
+
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - name: Set up Ruby ${{ matrix.ruby-version }}
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby-version }}
25
+ - name: Install dependencies
26
+ run: bundle install
27
+ - name: Run tests
28
+ run: AWS_REGION=us-east-1 bundle exec rake
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in rcredstash.gemspec
4
4
  gemspec
5
+
6
+ # Needed to run tests.
7
+ # Could be any of ox, oga, libxml, nokogiri or rexml
8
+ gem 'rexml'
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # RCredStash [![Build Status](https://travis-ci.org/adorechic/rcredstash.svg?branch=master)](https://travis-ci.org/adorechic/rcredstash)
1
+ # RCredStash ![Build Status](https://github.com/adorechic/rcredstash/actions/workflows/ruby.yml/badge.svg)
2
2
 
3
3
  RCredStash is a ruby port of [CredStash](https://github.com/fugue/credstash)
4
4
 
@@ -56,6 +56,10 @@ RCredStash uses [aws-sdk v2](https://github.com/aws/aws-sdk-ruby), so configurat
56
56
  ```ruby
57
57
  CredStash.configure do |config|
58
58
  config.table_name = 'your_dynamodb_table_name'
59
+
60
+ # Optional, if you want to modify them, like for Localstack.
61
+ config.dynamo_client = Aws::DynamoDB::Client.new
62
+ config.kms_client = Aws::KMS::Client.new
59
63
  end
60
64
  ```
61
65
 
@@ -5,7 +5,7 @@ class CredStash::CipherKey
5
5
 
6
6
  attr_reader :data_key, :hmac_key, :wrapped_key
7
7
 
8
- def self.generate(client: Aws::KMS::Client.new, kms_key_id: nil,
8
+ def self.generate(client: CredStash.config.kms_client, kms_key_id: nil,
9
9
  context: {})
10
10
  res = client.generate_data_key(
11
11
  key_id: kms_key_id || DEFAULT_KMS_KEY_ID,
@@ -19,7 +19,7 @@ class CredStash::CipherKey
19
19
  )
20
20
  end
21
21
 
22
- def self.decrypt(wrapped_key, client: Aws::KMS::Client.new, context: {})
22
+ def self.decrypt(wrapped_key, client: CredStash.config.kms_client, context: {})
23
23
  res = client.decrypt(ciphertext_blob: wrapped_key, encryption_context: context)
24
24
  new(
25
25
  data_key: res.plaintext[0...32],
@@ -10,7 +10,7 @@ module CredStash
10
10
  end
11
11
 
12
12
  class Config
13
- attr_accessor :table_name, :storage
13
+ attr_accessor :table_name, :storage, :kms_client, :dynamo_client
14
14
 
15
15
  def initialize
16
16
  reset!
@@ -19,6 +19,8 @@ module CredStash
19
19
  def reset!
20
20
  @table_name = 'credential-store'
21
21
  @storage = :dynamodb
22
+ @kms_client = Aws::KMS::Client.new
23
+ @dynamo_client = Aws::DynamoDB::Client.new
22
24
  end
23
25
  end
24
26
  end
@@ -1,7 +1,7 @@
1
1
  module CredStash::Repository
2
2
  class DynamoDB
3
3
  def initialize(client: nil)
4
- @client = client || Aws::DynamoDB::Client.new
4
+ @client = client || CredStash.config.dynamo_client
5
5
  end
6
6
 
7
7
  def get(name, version: nil)
@@ -1,3 +1,3 @@
1
1
  module CredStash
2
- VERSION = "1.1.0"
2
+ VERSION = "2.0.0"
3
3
  end
data/rcredstash.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_dependency 'aws-sdk-dynamodb'
24
24
  spec.add_dependency 'thor'
25
25
 
26
- spec.add_development_dependency "bundler", "~> 2.4"
27
- spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "bundler"
27
+ spec.add_development_dependency "rake"
28
28
  spec.add_development_dependency "rspec", "~> 3.0"
29
29
  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: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - adorechic
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-22 00:00:00.000000000 Z
11
+ date: 2024-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-kms
@@ -56,30 +56,30 @@ dependencies:
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '2.4'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '2.4'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '10.0'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '10.0'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -102,9 +102,9 @@ executables:
102
102
  extensions: []
103
103
  extra_rdoc_files: []
104
104
  files:
105
+ - ".github/workflows/ruby.yml"
105
106
  - ".gitignore"
106
107
  - ".rspec"
107
- - ".travis.yml"
108
108
  - Gemfile
109
109
  - README.md
110
110
  - Rakefile
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.3.1
5
- - 2.2.5
6
- before_install: gem install bundler -v 1.12.5