arcanus 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3046fa13db4b1d93dadc5adeb696c2c7b5281e12
4
- data.tar.gz: 0059c2568c2cf03204ffaf9f06d4aa7b4ef65bd8
3
+ metadata.gz: 2fb8869826196e49c619322eb2f20bfc525cdd56
4
+ data.tar.gz: 0195c1a11109ef5321c07abcab57b39cf526c9e8
5
5
  SHA512:
6
- metadata.gz: fa0afca95a568dc275976b64cb1f77556a5f59525382c81df0c6a14ebaab91fa9b03b9ac6c5b4b4b7cf095e03d2c6fb6d91ff04709b2a006f72ad673ea5a36be
7
- data.tar.gz: 5d8443ac96685dfbdc90d4fa0622451ea1f3875f6419be4f4a586f7a0fb07427fa270bda3fcb58ace75fc91f97ca97d8b81320a276be44e3caa41359b2a8255c
6
+ metadata.gz: fa848a90874f1a862f16cf66f6c0cf7885f08cf6d79274a147e6f68e4f7e16b4166c94ae641a4614161dbddcbd18a965a7362ee6045405c9d59e5cfd9a0375b7
7
+ data.tar.gz: 55041de90f9a2dc0e511565bb591f69a15fb106c4593d331a7ac64aa28ac3f7f4fddfafd14139df103735c4b0919234b34e1e209b4cf6292e7e7303fe62b1d6a
@@ -6,9 +6,6 @@ module Arcanus::Command
6
6
  return unless has_chest?
7
7
  return if already_unlocked?
8
8
 
9
- ui.print "This repository's Arcanus key is locked by a password."
10
- ui.print "Until you unlock it, you won't be able to view/edit secrets."
11
-
12
9
  unlock_key
13
10
 
14
11
  ui.success "Key unlocked and saved in #{repo.unlocked_key_path}"
@@ -42,6 +39,17 @@ module Arcanus::Command
42
39
  end
43
40
 
44
41
  def unlock_key
42
+ if ENV.key?('ARCANUS_PASSWORD')
43
+ unlock_key_via_env
44
+ else
45
+ unlock_key_interactive
46
+ end
47
+ end
48
+
49
+ def unlock_key_interactive
50
+ ui.print "This repository's Arcanus key is locked by a password."
51
+ ui.print "Until you unlock it, you won't be able to view/edit secrets."
52
+
45
53
  loop do
46
54
  ui.print 'Enter password: ', newline: false
47
55
  password = ui.secret_user_input
@@ -56,5 +64,17 @@ module Arcanus::Command
56
64
  end
57
65
  end
58
66
  end
67
+
68
+ def unlock_key_via_env
69
+ ui.print 'ARCANUS_PASSWORD environment variable detected. Attempting to unlock chest...'
70
+ begin
71
+ key = Arcanus::Key.from_protected_file(repo.locked_key_path, ENV['ARCANUS_PASSWORD'])
72
+ key.save(key_file_path: repo.unlocked_key_path)
73
+ ui.success 'Chest unlocked!'
74
+ rescue Arcanus::Errors::DecryptionError => ex
75
+ ui.error 'Unable to unlock key using the ARCANUS_PASSWORD environment variable provided!'
76
+ ui.error ex.message
77
+ end
78
+ end
59
79
  end
60
80
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module Arcanus
5
- VERSION = '0.11.0'.freeze
5
+ VERSION = '0.12.0'.freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arcanus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane da Silva
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-10 00:00:00.000000000 Z
11
+ date: 2016-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: childprocess