pws 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -17,9 +17,18 @@ Run `$ pws --help` for usage information.
17
17
 
18
18
  On Linux, please make sure you've got `xclip` or `xsel` installed (clipboard).
19
19
 
20
- On MacOS, the KDF might be generated pretty slow. You can work around this issue by using less iterations (see help) or [solving this problem](https://github.com/janlelis/pws/issues/7).
21
20
 
22
- Updating from 0.9
21
+ OpenSSL 1.0
22
+ ---
23
+ You should use a Ruby built with bindings to an openssl version >= 1.0. If not, pws will fall back to a Ruby-only version of the PBKDF2 function. If using openssl 1.0 is not possible for you, you can work around the issue by using the `--iterations` option with a value < 75\_000 (see help). If you have problems using openssl 1.0 with your Ruby, please look for a solution in [this github issue](https://github.com/janlelis/pws/issues/7).
24
+
25
+
26
+ Using a .pws file in the current working directory
27
+ ---
28
+ Besides using the `--filename path/to/safe` option, you can shortly call `pws --cwd` for using a `.pws` file in the current directory.
29
+
30
+
31
+ Updating from pws 0.9
23
32
  ---
24
33
  The 0.9 password files are not compatible with that version, however, you can convert your safe with:
25
34
  `$ pws resave --in 0.9 --out 1.0`
@@ -30,13 +39,13 @@ Reading the source
30
39
  Trust the code by reading the source! It's originally based on [this tutorial](http://rbjl.net/41-tutorial-build-your-own-password-safe-with-ruby). You might want to start reading in the [0.9.2 tag](https://github.com/janlelis/pws/tree/0.9.2), because it's got less features and therefore is less code.
31
40
 
32
41
 
33
- Contributions by
42
+ Contributors
34
43
  ---
35
44
  * [namelessjon](https://github.com/namelessjon)
36
45
  * [brianewing](https://github.com/brianewing/)
37
46
  * [dquimper](https://github.com/dquimper/)
38
47
  * [grapz](https://github.com/grapz/)
39
- * Cucumber specs loosely based on [the ones](https://github.com/thecatwasnot/passwordsafe/blob/master/features/) by [thecatwasnot](https://github.com/thecatwasnot/)
48
+ * [thecatwasnot](https://github.com/thecatwasnot/) (cucumber specs loosely based on [these](https://github.com/thecatwasnot/passwordsafe/blob/master/features/))
40
49
 
41
50
 
42
51
  Copyright
@@ -36,3 +36,10 @@ Feature: Misc
36
36
  And the output should contain "J-_-L"
37
37
  And the output should contain "github"
38
38
 
39
+ Scenario: I want to use a .pws file in the current directory
40
+ When I run `pws --cwd ls` interactively
41
+ And I type "123"
42
+ And I type "456"
43
+ Then the output should contain the current path
44
+ And the output should contain ".pws"
45
+ And the output should contain "The passwords don't match!"
@@ -76,6 +76,10 @@ Then /^the output from "([^"]*)" should not contain the current date$/ do |cmd|
76
76
  assert_no_partial_output(Time.now.strftime('%y-%m-%d'), output_from(cmd))
77
77
  end
78
78
 
79
+ Then /^the output should contain the current path$/ do
80
+ assert_partial_output(FileUtils.pwd, all_output)
81
+ end
82
+
79
83
  When /^I set env variable "(\w+)" to "([^"]*)"$/ do |var, value|
80
84
  ENV[var] = value
81
85
  end
data/lib/pws.rb CHANGED
@@ -20,7 +20,7 @@ class PWS
20
20
  # You can pass the master password as third parameter (not recommended)
21
21
  def initialize(options)
22
22
  collect_options(options)
23
- @filename = File.expand_path(@options[:filename])
23
+ @filename = @options[:cwd] ? File.join(FileUtils.pwd, '.pws') : File.expand_path(@options[:filename])
24
24
  @filename << '-' << @options[:namespace] if @options[:namespace]
25
25
 
26
26
  read_safe(options[:password])
@@ -155,6 +155,7 @@ class PWS
155
155
  OpenSSL::PKCS5::pbkdf2_hmac("","",2,512,OpenSSL::Digest::SHA512.new)
156
156
  rescue NotImplementedError
157
157
  alias kdf kdf_ruby
158
+ warn "[pws slow] https://github.com/janlelis/pws#openssl-10"
158
159
  else
159
160
  alias kdf kdf_openssl
160
161
  end
@@ -17,6 +17,8 @@ module PWS::Runner
17
17
  # ignore
18
18
  when /^--(help|version)$/
19
19
  return [$1.to_sym, [], {}]
20
+ when /^--(cwd)/ # special single options
21
+ options[$1.to_sym] = true
20
22
  when /^--/
21
23
  # parse option in next iteration
22
24
  when /^-([^-].*)$/
@@ -111,6 +113,10 @@ module PWS::Runner
111
113
  #{Paint['--filename', :bold]}
112
114
  Path to the password safe to use. Overrides usual path and any namespaces.
113
115
 
116
+ #{Paint['--cwd', :bold]}
117
+ Use a .pws file in the current directory instead of the one specified in
118
+ ENV['PWS'] or with --filename.
119
+
114
120
  #{Paint['--iterations', :bold]}
115
121
  Sets the number of sha iterations used to transform your password into the
116
122
  encryption key (pbkdf2). A higher number takes longer to compute, but makes
@@ -1,3 +1,3 @@
1
1
  class PWS
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pws
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-31 00:00:00.000000000 Z
12
+ date: 2012-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: clipboard