krypton 0.1.5 → 0.1.6
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 +4 -4
- data/Gemfile.lock +3 -1
- data/README.md +29 -4
- data/bin/krypton +13 -0
- data/krypton.gemspec +1 -0
- data/lib/core.rb +1 -0
- data/lib/core/constants.rb +1 -1
- data/lib/core/text.rb +2 -0
- metadata +16 -3
- data/img/krypton-readme-header.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df8d76a7d0868d48cb51b7c73c616ca50a22d804
|
4
|
+
data.tar.gz: 114459207d514a6c5d60de262967576f5302622a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dcd5bdb5539898a6bfdc5054572ffcdc3b8a60ba85a12f8a8024466538eb0958ab4eb8ee68ec63a3bcc5e5414276ea7a821ce8bdf64ed158552ce1f907f62a0
|
7
|
+
data.tar.gz: 56923959b8abfca059c9ddbcb641fa2eb6230c66421f989737f12cc1325471e9878269e76be707160113ee69665319f2116d1a8b7422ecff35922638d80049f5
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
krypton (0.1.
|
4
|
+
krypton (0.1.5)
|
5
5
|
aes
|
6
6
|
colorize
|
7
7
|
commander
|
8
8
|
paint
|
9
|
+
rotp
|
9
10
|
|
10
11
|
GEM
|
11
12
|
remote: https://rubygems.org/
|
@@ -18,6 +19,7 @@ GEM
|
|
18
19
|
highline (1.7.10)
|
19
20
|
paint (2.0.1)
|
20
21
|
rake (10.5.0)
|
22
|
+
rotp (3.3.1)
|
21
23
|
rspec (3.8.0)
|
22
24
|
rspec-core (~> 3.8.0)
|
23
25
|
rspec-expectations (~> 3.8.0)
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
<p align="center"><img src="https://
|
1
|
+
<p align="center"><img src="https://github.com/cbrnrd/krypton/raw/88b44a70de4829c3dd77dc8fbeb0395f89668b07/img/krypton-readme-header.png"></p>
|
2
2
|
|
3
3
|
|
4
4
|
## Installation
|
@@ -13,10 +13,35 @@ Or you can install the `periodic-cli` gem:
|
|
13
13
|
|
14
14
|
## Usage
|
15
15
|
|
16
|
-
|
16
|
+
All krypton functions use the same basic syntax: `krypton [cmd] {[message/secret]{[key]}}`
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
* `encrypt` - Encrypt a string
|
19
|
+
|
20
|
+
$ krypton encrypt "mymessage" "mykey"
|
21
|
+
mymessage => ckhJWXcyTE1leENLOWpBQzJWbElMdz09Cg==
|
22
|
+
|
23
|
+
* `decrypt` - Decrypt a string
|
24
|
+
|
25
|
+
$ krypton decrypt "ckhJWXcyTE1leENLOWpBQzJWbElMdz09Cg" "mykey"
|
26
|
+
ckhJWXcyTE1leENLOWpBQzJWbElMdz09Cg => mymessage
|
27
|
+
|
28
|
+
* `hash` - Hash a string or piped data
|
29
|
+
|
30
|
+
$ krypton hash "mymessage"
|
31
|
+
mymessage => S3ONp9WM7/rCMeuUnvWDzp5dxbuSVsOV6bI5AJvRqCc=
|
32
|
+
|
33
|
+
$ echo "mymessage" | krypton hash
|
34
|
+
mymessage => S3ONp9WM7/rCMeuUnvWDzp5dxbuSVsOV6bI5AJvRqCc=
|
35
|
+
|
36
|
+
* `uuid` - Generate a secure [uuid](https://en.wikipedia.org/wiki/Universally_unique_identifier)
|
37
|
+
|
38
|
+
$ krypton uuid
|
39
|
+
b6ff36d2-3f7e-4077-8ba5-5066f0a205a5
|
40
|
+
|
41
|
+
* `totp` - Generate a [time-based one-time password](https://en.wikipedia.org/wiki/Time-based_One-time_Password_algorithm)
|
42
|
+
|
43
|
+
$ krypton totp "myawesomesecret"
|
44
|
+
myawesomesecret => 997820
|
20
45
|
|
21
46
|
## Contributing
|
22
47
|
|
data/bin/krypton
CHANGED
@@ -83,6 +83,19 @@ while (opt = ARGV.shift) do
|
|
83
83
|
exit 0
|
84
84
|
when 'uuid'
|
85
85
|
puts Paint[SecureRandom.uuid, '#2ecc71']
|
86
|
+
when 'totp'
|
87
|
+
if ARGV.length == 2
|
88
|
+
puts "You need a secret to generate a totp."
|
89
|
+
exit 1
|
90
|
+
else
|
91
|
+
secret = ARGV[ARGV.length - 1] || gets
|
92
|
+
if options[:std]
|
93
|
+
puts ROTP::TOTP.new(secret).now
|
94
|
+
else
|
95
|
+
puts "#{secret + ' => ' + Paint[ROTP::TOTP.new(secret).now,'#2ecc71']}"
|
96
|
+
end
|
97
|
+
exit 0
|
98
|
+
end
|
86
99
|
else
|
87
100
|
puts "#{opt} is not a valid action!"
|
88
101
|
exit 1
|
data/krypton.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_runtime_dependency "paint"
|
21
21
|
spec.add_runtime_dependency "aes"
|
22
22
|
spec.add_runtime_dependency "commander"
|
23
|
+
spec.add_runtime_dependency "rotp"
|
23
24
|
|
24
25
|
spec.add_development_dependency "bundler", "~> 1.16"
|
25
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/lib/core.rb
CHANGED
data/lib/core/constants.rb
CHANGED
data/lib/core/text.rb
CHANGED
@@ -8,8 +8,10 @@ TASKS_HELP =
|
|
8
8
|
decrypt Decrypt the message with the given key (AES).
|
9
9
|
hash Hash a given message with SHA256.
|
10
10
|
uuid Generate a random UUID.
|
11
|
+
totp Generate a Time-based One Time Password.
|
11
12
|
|
12
13
|
#{Paint['Examples', '#95a5a6']}
|
13
14
|
#{Paint['$ krypton encrypt "mymessage" "mykey"', '#2ecc71']} #{Paint['=> ckhJWXcyTE1leENLOWpBQzJWbElMdz09Cg==', '#95a5a6']}
|
14
15
|
#{Paint['$ krypton hash "mymessage"', '#2ecc71']} => #{Paint['S3ONp9WM7/rCMeuUnvWDzp5dxbuSVsOV6bI5AJvRqCc=', '#95a5a6']}
|
16
|
+
#{Paint['$ krypton totp "mygreatsecret"']} => #{Paint['778501', '#95a5a6']}
|
15
17
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: krypton
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cbrnrd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rotp
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: bundler
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,7 +143,6 @@ files:
|
|
129
143
|
- bin/console
|
130
144
|
- bin/krypton
|
131
145
|
- bin/setup
|
132
|
-
- img/krypton-readme-header.png
|
133
146
|
- krypton.gemspec
|
134
147
|
- lib/core.rb
|
135
148
|
- lib/core/aes.rb
|
Binary file
|