Sha256: ba2fdc18ba4f4dc3cb0c815c0806dcbeeadbc87b271909575c33a323a93354d4
Contents?: true
Size: 849 Bytes
Versions: 10
Compression:
Stored size: 849 Bytes
Contents
require 'sym' require 'sym/application' require 'sym/app/args' module Sym # 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 Sym 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 = Sym::Application.new(self.app_args) end def read @content = application.execute! unless @content @content end def write Sym::Application.new(file: file, key_type => key_id, encrypt: true, output: file).execute end end end
Version data entries
10 entries across 10 versions & 1 rubygems