helpema 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 075bc5dabffd6842dd979dff8d7efe2373f9d49c
4
+ data.tar.gz: 86b1dc960893ac34a82bf410b74a75247806e697
5
+ SHA512:
6
+ metadata.gz: 345ec41ea1c2f23040a310ca1c2f5614dacb69996f54a0ec71b7d29ec420fa7eab6e37570ea14d85ea4ee3551b13619726aed226a501e9ea0199998d50277910
7
+ data.tar.gz: 4569bac7e04c332de5b09ce18179e95733d3b008309b562cb6af9422bf8ebe50f8bfc0df6921fca73fa24e5aabbb3bd89d2fa8e8a28670c89fbaaabfce74fef7
data/README.rdoc ADDED
@@ -0,0 +1,44 @@
1
+ = helpema
2
+
3
+ == DESCRIPTION:
4
+
5
+ Some wrappers on the following linux commands: ssss-split, ssss-combine, zbarcam.
6
+
7
+ More later.
8
+
9
+ == SYNOPSIS:
10
+
11
+ === Helpema::SSSS.split( secret, threshold, shares)
12
+
13
+ === Helpema::SSSS.combine( *shared_secrets )
14
+
15
+ === Helpema::ZBar.qrcode( timeout=3 )
16
+
17
+ == INSTALL:
18
+
19
+ $ sudo gem install helpema
20
+
21
+ == LICENSE:
22
+
23
+ (The MIT License)
24
+
25
+ Copyright (c) 2014 carlosjhr64
26
+
27
+ Permission is hereby granted, free of charge, to any person obtaining
28
+ a copy of this software and associated documentation files (the
29
+ 'Software'), to deal in the Software without restriction, including
30
+ without limitation the rights to use, copy, modify, merge, publish,
31
+ distribute, sublicense, and/or sell copies of the Software, and to
32
+ permit persons to whom the Software is furnished to do so, subject to
33
+ the following conditions:
34
+
35
+ The above copyright notice and this permission notice shall be
36
+ included in all copies or substantial portions of the Software.
37
+
38
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
39
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
40
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
41
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
42
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
43
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
44
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,26 @@
1
+ module Helpema
2
+ module SSSS
3
+
4
+ def self.split(pwd, t, n)
5
+ raise "Need t of n (n>t)." unless n>t
6
+ pwds = nil
7
+ Open3.popen3("ssss-split -Q -t #{t} -n #{n}") do |stdin, stdout, stderr|
8
+ stdin.puts pwd
9
+ stdin.close
10
+ pwds = stdout.read.strip.split
11
+ end
12
+ return pwds
13
+ end
14
+
15
+ def self.combine(*pwds)
16
+ pwd = ''
17
+ Open3.popen3("ssss-combine -Q -t #{pwds.length}") do |stdin, stdout, stderr|
18
+ pwds.each{|p| stdin.puts p}
19
+ stdin.close
20
+ pwd = stderr.read.strip.split.last
21
+ end
22
+ return pwd
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ module Helpema
2
+ VERSION = '0.0.0'
3
+ end
@@ -0,0 +1,21 @@
1
+ module Helpema
2
+ module ZBar
3
+
4
+ def self.qrcode(timeout=3)
5
+ qrcode = nil
6
+ IO.popen('zbarcam --nodisplay --raw --prescale=800x800', 'r') do |io|
7
+ begin
8
+ Timeout.timeout(timeout) do
9
+ qrcode = io.gets.strip
10
+ end
11
+ rescue Timeout::Error
12
+ $stderr.puts $!
13
+ ensure
14
+ Process.kill('INT', io.pid)
15
+ end
16
+ end
17
+ qrcode
18
+ end
19
+
20
+ end
21
+ end
data/lib/helpema.rb ADDED
@@ -0,0 +1,14 @@
1
+ # Standard Libraries
2
+ require 'open3'
3
+ require 'timeout'
4
+
5
+ # This Gem
6
+ require 'helpema/version.rb'
7
+ require 'helpema/ssss.rb'
8
+ require 'helpema/zbar.rb'
9
+
10
+ # Requires:
11
+ #`ruby`
12
+ #`ssss-split`
13
+ #`ssss-combine`
14
+ #`zbarcam`
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: helpema
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - carlosjhr64
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-13 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: |
14
+ Some wrappers on the following linux commands: ssss-split, ssss-combine, zbarcam.
15
+
16
+ More later.
17
+ email: carlosjhr64@gmail.com
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files:
21
+ - README.rdoc
22
+ files:
23
+ - README.rdoc
24
+ - lib/helpema.rb
25
+ - lib/helpema/ssss.rb
26
+ - lib/helpema/version.rb
27
+ - lib/helpema/zbar.rb
28
+ homepage: https://github.com/carlosjhr64/helpema
29
+ licenses:
30
+ - MIT
31
+ metadata: {}
32
+ post_install_message:
33
+ rdoc_options:
34
+ - "--main"
35
+ - README.rdoc
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements:
49
+ - 'ruby: ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]'
50
+ - 'ssss-split: 0.5'
51
+ - 'ssss-combine: 0.5'
52
+ - 'zbarcam: 0.10'
53
+ rubyforge_project:
54
+ rubygems_version: 2.4.1
55
+ signing_key:
56
+ specification_version: 4
57
+ summary: 'Some wrappers on the following linux commands: ssss-split, ssss-combine,
58
+ zbarcam.'
59
+ test_files: []
60
+ has_rdoc: