secrit 0.0.1 → 0.0.3
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/test/secrit_test.rb +33 -0
- metadata +32 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81e5366cff5b66415ad96ac3f99c8f26c11d67078a260cdc01c22f069c7df742
|
4
|
+
data.tar.gz: 379f7d527cb4af8459daf8818a5c28498b403f48678166abd85baa48d2200245
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b7d0553d3e3b1a84d057b23eb25d47ff2db4d6e389755b39d922127d650fa60b526e7e3d8840a08cfbecc3071e08d371530ee600160de909517351e0b191f2d
|
7
|
+
data.tar.gz: 7c44c255c7c7274f6b3784f0d2162141c2b26bced3f47306a21bdde4c619a786a6a14cc8ce818a1148c6b6d5da92ffbd356de596d5ac00dad3908799278cddf4
|
data/test/secrit_test.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'minitest/autorun'
|
3
|
+
require 'mocha/minitest'
|
4
|
+
require_relative '../lib/secrit'
|
5
|
+
|
6
|
+
class SecritTest < Minitest::Test
|
7
|
+
def test_successful_decryption
|
8
|
+
# Mocking the file existence check
|
9
|
+
File.stubs(:exist?).returns(true)
|
10
|
+
|
11
|
+
# Mocking the file reading
|
12
|
+
encrypted_file = StringIO.new("encrypted content")
|
13
|
+
File.stubs(:open).returns(encrypted_file)
|
14
|
+
|
15
|
+
# Mocking the decryption
|
16
|
+
decrypted_data = GPGME::Data.new("decrypted content")
|
17
|
+
GPGME::Crypto.any_instance.stubs(:decrypt).returns(decrypted_data)
|
18
|
+
|
19
|
+
# Testing the get method
|
20
|
+
result = Secrit.get('valid_entry_path')
|
21
|
+
assert_equal 'decrypted content', result
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_file_not_found
|
25
|
+
# Mocking the file existence check to return false
|
26
|
+
File.stubs(:exist?).returns(false)
|
27
|
+
|
28
|
+
# Testing the get method to ensure it raises the correct error
|
29
|
+
assert_raises(RuntimeError, "File not found: #{File.join(PASSWORD_STORE_PATH, 'non_existent_file.gpg')}") do
|
30
|
+
Secrit.get('non_existent_file')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: secrit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simpthy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gpgme
|
@@ -24,6 +24,34 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.0.22
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mocha
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.11'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.11'
|
27
55
|
description: 'This gem provides a method to decrypt and retrieve secrets from Password-Store
|
28
56
|
(''pass'' cli tool; see: https://www.passwordstore.org/).'
|
29
57
|
email:
|
@@ -32,6 +60,7 @@ extensions: []
|
|
32
60
|
extra_rdoc_files: []
|
33
61
|
files:
|
34
62
|
- lib/secrit.rb
|
63
|
+
- test/secrit_test.rb
|
35
64
|
homepage: https://github.com/hard-simp/secrit.rb
|
36
65
|
licenses:
|
37
66
|
- MIT
|
@@ -54,5 +83,5 @@ requirements: []
|
|
54
83
|
rubygems_version: 3.3.5
|
55
84
|
signing_key:
|
56
85
|
specification_version: 4
|
57
|
-
summary:
|
86
|
+
summary: Use Password-Store ('pass') managed secrets in your Ruby
|
58
87
|
test_files: []
|