eon_crypt 0.1.0
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 +7 -0
- data/.rubocop.yml +13 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +21 -0
- data/README.md +32 -0
- data/Rakefile +16 -0
- data/eon-0.1.0.gem +0 -0
- data/eon.gemspec +42 -0
- data/lib/eon/eon.rb +29 -0
- data/lib/eon/version.rb +5 -0
- data/lib/eon.rb +44 -0
- data/sig/eon.rbs +4 -0
- metadata +70 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6e8dfaf77a77617fc9e782300ed26e654ef93e185eacbdafd867f010f1206f5c
|
4
|
+
data.tar.gz: 037d29ec0fc7d6fd20b36c43616a58bb06763dcf45e0360b8e733c2aa8eccdcb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 58b786f51b8c5b15ab1610bd45b2273c19c625f7df409c5d3eade5ec1796d9164e90a89adbeba77a24cfee7158bd2f1157b81418f23485bbf8d6868fb4364bda
|
7
|
+
data.tar.gz: 906ee35ab384bcba0de77033da256afed462b76feb1f4ee2951dfc222c67a6cf77bcf67d4ca3739e5d782a0832cc5ec6ddcd7c2e61029eefa41b99f46a9f0ac6
|
data/.rubocop.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Travis Fantina
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Eon 🗝
|
2
|
+
|
3
|
+
Eon is a tool for encrypting and decrypting short text files on the fly. It's primary goal is to provide a secure way to encrypt `.env` files so that they can be checked into version control.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Eventually I'd like to publish Eon as a Homebrew formula so that it can be quickly installed and used without hassle. However for the time being you need to add the `/bin/eon` to your
|
8
|
+
`$PATH`. This can be done by editing your `.zshrc` or `.bashrc` with this line: `export PATH="~/eon/lib/eon:$PATH"` (of course the path needs to be relative to wherever you have the Eon folder).
|
9
|
+
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
At the moment Eon has three commands:
|
14
|
+
|
15
|
+
`eon.rb generate` which creates a new `eon_aes.key` this is a secret aes key used for encrypting and decrypting files. Keep this key with your project but **DO NOT** check it into version control.
|
16
|
+
`.gitignore` `eon_aes.key`! For any developers working on the project who need access to encrypted .env files give them a copy of this file using a secure service such as Keybase.
|
17
|
+
|
18
|
+
`eon.rb encrypt file destination` `encrypt` takes two argements the first is an unencrypted file `.env` for example, and the second is a destination where a new encrypted file will be created: `.env.encrypted`
|
19
|
+
|
20
|
+
`eon.rb decrypt file destination` `decrypt` takes two arguments, the first is an encrypted file `.env.encrypted` for examople, and the second is a destination where the decrypted file will live: `.env`
|
21
|
+
|
22
|
+
## Development
|
23
|
+
|
24
|
+
I'm still working on this, I haven't quite figured out how to create Homebrew formula, I'm open to PRs.
|
25
|
+
|
26
|
+
## Contributing
|
27
|
+
|
28
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/tfantina/eon.
|
29
|
+
|
30
|
+
## License
|
31
|
+
|
32
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << "test"
|
8
|
+
t.libs << "lib"
|
9
|
+
t.test_files = FileList["test/**/test_*.rb"]
|
10
|
+
end
|
11
|
+
|
12
|
+
require "rubocop/rake_task"
|
13
|
+
|
14
|
+
RuboCop::RakeTask.new
|
15
|
+
|
16
|
+
task default: %i[test rubocop]
|
data/eon-0.1.0.gem
ADDED
Binary file
|
data/eon.gemspec
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/eon/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "eon_crypt"
|
7
|
+
spec.version = Eon::VERSION
|
8
|
+
spec.authors = ["Travis Fantina"]
|
9
|
+
spec.email = ["travis@objective.dev"]
|
10
|
+
|
11
|
+
spec.summary = "Tool for encrypting and decrpyting .env files"
|
12
|
+
spec.description = "Pass around AES keys then check .env.encrypted into your repo"
|
13
|
+
spec.homepage = "https://objective.dev"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = ">= 2.6.0"
|
16
|
+
|
17
|
+
#spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
18
|
+
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
#spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
|
21
|
+
#spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(__dir__) do
|
26
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
(File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor])
|
28
|
+
end
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
|
35
|
+
# Uncomment to register a new dependency of your gem
|
36
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
37
|
+
|
38
|
+
# For more information and examples about making a new gem, check out our
|
39
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
40
|
+
|
41
|
+
spec.add_runtime_dependency "thor"
|
42
|
+
end
|
data/lib/eon/eon.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "thor"
|
4
|
+
require "eon"
|
5
|
+
|
6
|
+
module Eon
|
7
|
+
class CLI < Thor
|
8
|
+
def self.exit_on_failure?
|
9
|
+
true
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "generate", "Creats a new AES Key"
|
13
|
+
def generate
|
14
|
+
Eon.generate
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "encrypt", "Encrypts with an eon_aes.key"
|
18
|
+
def encrypt(target, destination)
|
19
|
+
Eon.encrypt_file(target, destination)
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "decrypt", "Decrypts with an eon_aes.key"
|
23
|
+
def decrypt(target, destination)
|
24
|
+
Eon.decrypt_file(target, destination)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
Eon::CLI.start
|
data/lib/eon/version.rb
ADDED
data/lib/eon.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "eon/version"
|
4
|
+
require "openssl"
|
5
|
+
require "base64"
|
6
|
+
|
7
|
+
module Eon
|
8
|
+
def self.encrypt_file(target, destination)
|
9
|
+
encoded_key = IO.read("eon_aes.key")
|
10
|
+
cipher = OpenSSL::Cipher.new("aes-256-cbc")
|
11
|
+
cipher.encrypt
|
12
|
+
cipher.key = Base64.decode64(encoded_key)
|
13
|
+
data = IO.read(target)
|
14
|
+
encrypted = cipher.update(data)
|
15
|
+
encrypted << cipher.final
|
16
|
+
IO.write(destination, Base64.encode64(encrypted))
|
17
|
+
puts "Successfully encrypted #{target} here: #{destination}"
|
18
|
+
rescue StandardError
|
19
|
+
puts "Error encountered"
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.decrypt_file(target, destination)
|
23
|
+
encoded_key = IO.read("eon_aes.key")
|
24
|
+
cipher = OpenSSL::Cipher.new("aes-256-cbc")
|
25
|
+
cipher.decrypt
|
26
|
+
cipher.key = Base64.decode64(encoded_key)
|
27
|
+
data = IO.read(target)
|
28
|
+
data = Base64.decode64(data)
|
29
|
+
decrypted = cipher.update(data)
|
30
|
+
decrypted << cipher.final
|
31
|
+
IO.write(destination, decrypted)
|
32
|
+
puts "Successfully decrypted #{target} here: #{destination}"
|
33
|
+
rescue StandardError
|
34
|
+
puts "Error encountered"
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.generate
|
38
|
+
cypher = OpenSSL::Cipher.new("aes-256-cbc")
|
39
|
+
cypher.encrypt
|
40
|
+
key = Base64.encode64(cypher.random_key)
|
41
|
+
IO.write("eon_aes.key", key)
|
42
|
+
puts "Success"
|
43
|
+
end
|
44
|
+
end
|
data/sig/eon.rbs
ADDED
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: eon_crypt
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Travis Fantina
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-05-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Pass around AES keys then check .env.encrypted into your repo
|
28
|
+
email:
|
29
|
+
- travis@objective.dev
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".rubocop.yml"
|
35
|
+
- CHANGELOG.md
|
36
|
+
- Gemfile
|
37
|
+
- LICENSE.txt
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- eon-0.1.0.gem
|
41
|
+
- eon.gemspec
|
42
|
+
- lib/eon.rb
|
43
|
+
- lib/eon/eon.rb
|
44
|
+
- lib/eon/version.rb
|
45
|
+
- sig/eon.rbs
|
46
|
+
homepage: https://objective.dev
|
47
|
+
licenses:
|
48
|
+
- MIT
|
49
|
+
metadata:
|
50
|
+
homepage_uri: https://objective.dev
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 2.6.0
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubygems_version: 3.4.8
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: Tool for encrypting and decrpyting .env files
|
70
|
+
test_files: []
|