secrit 0.0.1

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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/secrit.rb +20 -0
  3. metadata +58 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 765d7680b4162ac03c9d9bb9f88fa66829f170aa2e70090ecfa730cd3fdf89df
4
+ data.tar.gz: 2f79ca43194f3a8f710eb4e8ef3d865809a12bc65aa98e49e726bfc6df59ce6e
5
+ SHA512:
6
+ metadata.gz: 0d217eeea81f4b42a0db3cde13f666fb57b523d62a64f77331ec14459dc34d10700db662f7fc7aa3eb5a96ce3ae5e360ab9f9ff5abfc57fe7f24d4d1264b5347
7
+ data.tar.gz: 221837fc110d7993fb80799602abbc6c73b1f8c5d3f03807ad6d7df7b7ea7aa2a6953ded6863977afd84e82e17076623be8321144491ec7fb3ee17dd642222a6
data/lib/secrit.rb ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+ require 'gpgme'
3
+
4
+ PASSWORD_STORE_PATH = File.expand_path("~/.password-store/")
5
+
6
+ class Secrit
7
+ def self.get(entry_path)
8
+ full_path = File.join(PASSWORD_STORE_PATH, "#{entry_path}.gpg")
9
+
10
+ # Ensure the file exists
11
+ raise "File not found: #{full_path}" unless File.exist?(full_path)
12
+
13
+ # Decrypt the file
14
+ crypto = GPGME::Crypto.new
15
+ decrypted_data = crypto.decrypt(File.open(full_path))
16
+
17
+ # Return the decrypted content
18
+ decrypted_data.to_s.strip
19
+ end
20
+ end
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: secrit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Simpthy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-08-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gpgme
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.22
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.0.22
27
+ description: 'This gem provides a method to decrypt and retrieve secrets from Password-Store
28
+ (''pass'' cli tool; see: https://www.passwordstore.org/).'
29
+ email:
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - lib/secrit.rb
35
+ homepage: https://github.com/hard-simp/secrit.rb
36
+ licenses:
37
+ - MIT
38
+ metadata: {}
39
+ post_install_message:
40
+ rdoc_options: []
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ requirements: []
54
+ rubygems_version: 3.3.5
55
+ signing_key:
56
+ specification_version: 4
57
+ summary: Decrypt passwords in Password-Store ('pass')
58
+ test_files: []