ncypher 1.1.0 → 1.3.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: 4f5677085002a6face9c3bd0fc903a133083a78ef690e960fc24c8386e8061b8
4
- data.tar.gz: 3e834ad55b6e82f468a386b8bb1b882dff6867b45c0890ed1d232b9c7c82ada5
3
+ metadata.gz: 77245507ddd567cc836702a8a3bef443a6c8a935f1609c5c2cde7dce87ac14ca
4
+ data.tar.gz: 905b47d4f2cbe7b795d0434fd7acf26ad9961e0c11d8bcc7c0b87813ceed951b
5
5
  SHA512:
6
- metadata.gz: 9ac7263205dc795be80d00b3f6afc8e61bd27fb184b06adf041e9d11e79a789a25c15d803c8e1dcb351a32a797b41858893a338be66eb55ce8cff02f68c0a094
7
- data.tar.gz: c33dded92dd324931b7d945c27473065687a1009a584db95fa4b7c79aaf77eb8f33e8429dc2f8a17c446d3d9203d73a2c69c093d41eb77f99b935736ddb863b5
6
+ metadata.gz: d8309bcfe3731ff257c75e6a4d6ef7688b9d81cb5352d25d4c36576a8cca4a61cf25eceba4e22b8d5c1ed44f46c7f8d056339829116db54b1200531bdc2250a8
7
+ data.tar.gz: 5373a0ebe1771ceb457806773a4947fd183eed235de9f359eb8c52ab6cfc2f208a7be3ef41e3d86ded6f16be2de69fb10e8aba31081884ea7ed93bed68129b24
@@ -0,0 +1,44 @@
1
+ name: Ruby CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ tags:
7
+ - v*
8
+ pull_request:
9
+ branches: [ master ]
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-20.04
14
+
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+
18
+ - name: Install bundler
19
+ run: sudo gem install bundler -v 2.0
20
+
21
+ - name: Install dependencies
22
+ run: |
23
+ sudo apt-get update -y
24
+ sudo apt-get install -y libsodium23
25
+ bundle install
26
+
27
+ - name: Run tests
28
+ run: bundle exec rake
29
+
30
+ deploy:
31
+ needs: test
32
+ runs-on: ubuntu-20.04
33
+ if: startsWith(github.ref, 'refs/tags/')
34
+
35
+ steps:
36
+ - uses: actions/checkout@v2
37
+
38
+ - name: Build and publish gem
39
+ env:
40
+ GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
41
+ run: |
42
+ gem build ncypher.gemspec
43
+ gem push ncypher-*.gem
44
+
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # Ncypher
5
5
 
6
- Ncypher is a gem to help you to encrypt your credentials in your ruby apps in a safe manner.
6
+ Ncypher is a gem to help you to encrypt your credentials in your projects in a safe manner.
7
7
 
8
8
  ## Upgrade from versions before 1.0
9
9
  Versions before 1.0 were using rbnacl-libsodium gem which is now deprecated.
@@ -40,8 +40,8 @@ You can also set the env variable `NCYPHER_KEY` to that generated key (i.e `expo
40
40
 
41
41
  To encrypt a new password (or anything else), ncypher supports stdin. So you can do:
42
42
  ```
43
- $> cat secret_file | ncypher encrypt > secret_file.encrypted
44
- $> cat secret_file.encrypted | ncypher decrypt > secret_file
43
+ $> ncypher encrypt < secret_file > secret_file.encrypted
44
+ $> ncypher decrypt < secret_file.encrypted > secret_file
45
45
  $> ncypher encrypt
46
46
  mypassword
47
47
  <CTRL+D>
@@ -69,7 +69,7 @@ p4$$w0rd
69
69
 
70
70
  :)
71
71
 
72
- And Ncypher::Ncypher.decrypt will magically use your key in `.ncypher_key` to decrypt that password at runtime.
72
+ And if you are using ruby, Ncypher::Ncypher.decrypt will magically use your key in `.ncypher_key` to decrypt that password at runtime.
73
73
  Now you can directy put in your .yaml files:
74
74
  ```
75
75
  defaults: &defaults
@@ -94,8 +94,14 @@ $> ncypher derive_key p4$$w0rd > .ncypher_key
94
94
  SALT: WKCAkJcS65nx3lA/w1BmBw==
95
95
  ```
96
96
 
97
- Then you have the ncypher\_key in .ncypher\_key. Be sure to save the salt if you want to be able to derive back the exact same key in the future.
97
+ Then you have the ncypher\_key in .ncypher\_key. Be sure to save the salt if you want to be able to derive back the exact same key in the future.
98
+ The derive_key command also listen to stdin so for safety you can instead do:
98
99
 
100
+ ```
101
+ $> ncypher derive_key > .ncypher_key
102
+ ```
103
+
104
+ And enter your password then CTRL+D.
99
105
 
100
106
  ## Contributing
101
107
 
data/exe/ncypher CHANGED
@@ -7,8 +7,6 @@ rescue NameError
7
7
  require "bundler/setup"
8
8
  end
9
9
 
10
- SUB_COMMANDS = %w(generate_key encrypt decrypt)
11
-
12
10
  if ARGV.empty?
13
11
  STDERR.puts "Ncypher a credential encryption tool"
14
12
  STDERR.puts "usage: ncypher generate_key"
@@ -24,11 +22,11 @@ case cmd
24
22
  when "generate_key"
25
23
  puts Ncypher::Ncypher.new.generate_key
26
24
  when "derive_key"
27
- password = ARGV.shift
25
+ password = (ARGV.shift || STDIN.read)
28
26
  unless password
29
27
  abort "ncypher derive_key <password> [salt]"
30
28
  end
31
- salt = File.exists?(".ncypher_salt") ? File.read(".ncypher_salt")&.strip : ARGV.shift
29
+ salt = File.exist?(".ncypher_salt") ? File.read(".ncypher_salt")&.strip : ARGV.shift
32
30
  key, used_salt = Ncypher::Ncypher.new.derive_key(password.strip, salt)
33
31
  STDOUT.puts key
34
32
  STDERR.puts "SALT: #{used_salt}" # Put salt on stderr so we can do ncypher deriver_key password > .ncypher_key
@@ -1,3 +1,3 @@
1
1
  module Ncypher
2
- VERSION = "1.1.0"
2
+ VERSION = "1.3.1"
3
3
  end
data/lib/ncypher.rb CHANGED
@@ -20,7 +20,8 @@ module Ncypher
20
20
  end
21
21
 
22
22
  def generate_key
23
- generated_key = RbNaCl::Random.random_bytes(RbNaCl::SecretBox.key_bytes)
23
+ digest_size = 32 # RbNaCl::SecretBox.key_bytes
24
+ generated_key = RbNaCl::Random.random_bytes(digest_size)
24
25
  Base64.strict_encode64(generated_key)
25
26
  end
26
27
 
data/ncypher.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.license = 'WTFPL'
21
21
 
22
22
  spec.add_development_dependency "bundler", "~> 2.0"
23
- spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rake", "~> 12.3.3"
24
24
  spec.add_development_dependency "minitest", "~> 5.0"
25
25
 
26
26
  spec.add_dependency 'rbnacl', '~> 7.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ncypher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Hagege
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-15 00:00:00.000000000 Z
11
+ date: 2023-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.3.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -74,6 +74,7 @@ executables:
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
+ - ".github/workflows/main.yml"
77
78
  - ".gitignore"
78
79
  - ".travis.yml"
79
80
  - CODE_OF_CONDUCT.md
@@ -106,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
107
  - !ruby/object:Gem::Version
107
108
  version: '0'
108
109
  requirements: []
109
- rubygems_version: 3.0.6
110
+ rubygems_version: 3.1.2
110
111
  signing_key:
111
112
  specification_version: 4
112
113
  summary: Ncypher lets you encrypt/decrypt credentials in a safe and transparent way