summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2018-07-16 15:29:50 +0100
committerPaul Buetow <paul@buetow.org>2018-07-16 15:29:50 +0100
commitd2f49d36d753102638b348f18bec40f7ea396ef1 (patch)
tree597e7b06ced56b2f1cba6b52fa385df2da797886
parent7050182d32cea58440b240cbcb2dc5cd1264e0ea (diff)
can edit text files
-rwxr-xr-xgeheim.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/geheim.rb b/geheim.rb
index 2d0f3bc..c08d411 100755
--- a/geheim.rb
+++ b/geheim.rb
@@ -74,7 +74,7 @@ module Encryption
input = ENV['PIN']
else
print "PIN: "
- input = $stdin.gets.chomp
+ input = STDIN.noecho(&:gets).chomp
end
iv = input * 2 + "Hello world" + input * 2
@@iv = iv[0..15]
@@ -182,6 +182,11 @@ class GeheimData < CommitFile
end
end
+ def reimport_after_export
+ @data = File.read(@exported_path)
+ commit(force: true)
+ end
+
def commit(force: false)
commit_content(file: @data_path, content: encrypt(plain: @data), force: force)
end
@@ -270,7 +275,9 @@ class Geheim
destination_file = File.basename(index.description)
data = index.get_data
data.export(destination_file: destination_file)
- shred_file(file: edit_exported(file: destination_file))
+ exported_file = edit_exported(file: destination_file)
+ data.reimport_after_export
+ shred_file(file: exported_file)
end
end
end