Sha256: 178d57832b26d16506595595693e4329f5b493f3daae2a55a11f2db80eb15de8
Contents?: true
Size: 856 Bytes
Versions: 3
Compression:
Stored size: 856 Bytes
Contents
require 'shhh' require 'shhh/application' require 'shhh/app/args' module Shhh # This class provides a convenience wrapper for opening and reading # encrypted files as they were regular files, and then possibly writing # changes to them later. class EncryptedFile include Shhh attr_reader :application, :file, :key_id, :key_type, :app_args def initialize(file:, key_id:, key_type:) @file = file @key_id = key_id @key_type = key_type.to_sym @app_args = { file: file, key_type => key_id, decrypt: true } @application = Shhh::Application.new(self.app_args) end def read @content = application.execute! unless @content @content end def write Shhh::Application.new(file: file, key_type => key_id, encrypt: true, output: file).execute end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
shhh-1.7.0 | lib/shhh/encrypted_file.rb |
shhh-1.6.5 | lib/shhh/encrypted_file.rb |
shhh-1.6.4 | lib/shhh/encrypted_file.rb |