From d2f49d36d753102638b348f18bec40f7ea396ef1 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 16 Jul 2018 15:29:50 +0100 Subject: can edit text files --- geheim.rb | 11 +++++++++-- 1 file 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 -- cgit v1.2.3