yopass-cli 1.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.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/.gemspec +16 -0
  3. data/README.md +21 -0
  4. data/bin/yopass +55 -0
  5. metadata +47 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: da8712a9b6ae01a820e5d5bad0bc02e8ccf7439c
4
+ data.tar.gz: 106e8cb7255f4624e0dd6f1f88da21d849e14874
5
+ SHA512:
6
+ metadata.gz: 71fcc6af409ca0ae76f4aa599f77b7c4d1f84f1d10eba13a38b93118a3cb66a0a713823e9b367e57b9d54dec0c2614cc597a942ee2c52fd3c8e3ffad57143eb2
7
+ data.tar.gz: 997d2e584524853ce2f924c8964aeee5c95e971a0f8f9ed5ff4e47d4daae7ed833db5c9b8d73232f6b5b337890532e6ba2e877e754752ca395ee6d6a46218a24
data/.gemspec ADDED
@@ -0,0 +1,16 @@
1
+ # -*- encoding: utf-8 -*-
2
+ Gem::Specification.new do |s|
3
+ s.name = 'yopass-cli'
4
+ s.version = '1.0.0'
5
+ s.author = 'Johan Haals'
6
+ s.email = 'johan@haals.se'
7
+ s.homepage = 'https://github.com/jhaals/yopass-cli'
8
+ s.summary = 'CLI for yopass'
9
+ s.description = 'Yopass is a simple and secure service for sharing secrets'
10
+ s.license = 'Apache 2.0'
11
+ s.files = `git ls-files`.split("\n")
12
+ s.require_paths = ['bin']
13
+ s.executables ='yopass'
14
+ s.required_ruby_version = '>= 1.9.3'
15
+ end
16
+
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # yopass-cli
2
+ This is a command line interface for [yopass](https://yopass.se)
3
+
4
+ ## Installation
5
+
6
+ gem install yopass-cli
7
+
8
+ ## Usage
9
+ Set the `YOPASS_URL` environment variable pointing to your yopass instance or https://yopass.se
10
+
11
+ $ export YOPASS_URL='https://yopass.se'
12
+
13
+ $ yopass 'hello world'
14
+ Full URL: https://yopass.se/#/s/60e4ac0bd2530adf86d97b614f37f7f0/3cb801231
15
+ Short URL: https://yopass.se/#/s/60e4ac0bd2530adf86d97b614f37f7f0
16
+ Decryption Key: 3cb801231
17
+
18
+ $ cat passwords.txt | yopass
19
+ Full URL: https://yopass.se/#/s/530fa7faff9243847e716b56d46af66e/95b8f396c
20
+ Short URL: https://yopass.se/#/s/530fa7faff9243847e716b56d46af66e
21
+ Decryption Key: 95b8f396c
data/bin/yopass ADDED
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env ruby
2
+ require 'json'
3
+ require 'uri'
4
+ require 'net/http'
5
+
6
+ args = ARGV[0]
7
+ if args == '-h' || args == '--help'
8
+ puts 'Usage:'
9
+ puts 'echo "hello world" | yopass'
10
+ puts 'yopass "Hello World"'
11
+ exit 0
12
+ end
13
+
14
+ if ENV['YOPASS_URL'].nil?
15
+ puts 'Error: make sure YOPASS_URL is set in your environment variables'
16
+ exit 1
17
+ end
18
+
19
+ secret = args if args
20
+ begin
21
+ secret = ARGF.read
22
+ rescue Errno::ENOENT
23
+ end
24
+
25
+ url = ENV['YOPASS_URL']
26
+ uri = URI.parse(url)
27
+ http = Net::HTTP.new(uri.host, uri.port)
28
+ http.use_ssl = true if uri.scheme == 'https'
29
+ request = Net::HTTP::Post.new('/v1/secret')
30
+ request.add_field('Content-Type', 'application/json')
31
+ request.body = JSON.dump({'secret' => secret})
32
+
33
+ begin
34
+ response = http.request(request)
35
+ rescue SocketError
36
+ puts "Failed to contact #{ENV['YOPASS_URL']}"
37
+ exit 1
38
+ end
39
+
40
+ begin
41
+ r = JSON.parse(response.body)
42
+ rescue JSON::ParserError
43
+ puts "Failed to parse server response from #{ENV['YOPASS_URL']}. Something is broken!"
44
+ exit 1
45
+ end
46
+
47
+ if response.code != "200"
48
+ puts r['message']
49
+ exit 1
50
+ end
51
+
52
+ base_url = File.join(url, '#/s', r['key'])
53
+ puts "Full URL: #{File.join(base_url, r['decryption_key'])}"
54
+ puts "Short URL: #{base_url}"
55
+ puts "Decryption Key: #{r['decryption_key']}"
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yopass-cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Johan Haals
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-14 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Yopass is a simple and secure service for sharing secrets
14
+ email: johan@haals.se
15
+ executables:
16
+ - yopass
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gemspec"
21
+ - README.md
22
+ - bin/yopass
23
+ homepage: https://github.com/jhaals/yopass-cli
24
+ licenses:
25
+ - Apache 2.0
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - bin
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 1.9.3
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.2.2
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: CLI for yopass
47
+ test_files: []