Sha256: 5a287a8992a1c3a1b968aef2b55b18d190e810a790596d489f564958d76c1bd5

Contents?: true

Size: 1.29 KB

Versions: 10

Compression:

Stored size: 1.29 KB

Contents

require_relative '../errors'
module Sym
  module Data
    class WrapperStruct < Struct.new(
      :encrypted_data,        # [Blob] Binary encrypted data (possibly compressed)
      :iv,                    # [String] IV used to encrypt the data
      :cipher_name,           # [String] Name of the cipher used
      :salt,                  # [Integer] For password-encrypted data this is the salt
      :version,               # [Integer] Version of the cipher used
      :compress               # [Boolean] indicates if compression should be applied
      )

      VERSION = 1

      attr_accessor :compressed

      def initialize(
        encrypted_data:, # [Blob] Binary encrypted data (possibly compressed)
        iv:, # [String] IV used to encrypt the data
        cipher_name:, # [String] Name of the cipher used
        salt: nil, # [Integer] For password-encrypted data this is the salt
        version: VERSION, # [Integer] Version of the cipher used
        compress: Sym::Configuration.config.compression_enabled
      )
        super(encrypted_data, iv, cipher_name, salt, version, compress)
      end

      def config
        Sym::Configuration.config
      end

      def serialize
        Marshal.dump(self)
      end

      def self.deserialize(data)
        Marshal.load(data)
      end
    end
  end
end


Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
sym-2.3.0 lib/sym/data/wrapper_struct.rb
sym-2.2.1 lib/sym/data/wrapper_struct.rb
sym-2.2.0 lib/sym/data/wrapper_struct.rb
sym-2.1.2 lib/sym/data/wrapper_struct.rb
sym-2.1.1 lib/sym/data/wrapper_struct.rb
sym-2.1.0 lib/sym/data/wrapper_struct.rb
sym-2.0.3 lib/sym/data/wrapper_struct.rb
sym-2.0.2 lib/sym/data/wrapper_struct.rb
sym-2.0.1 lib/sym/data/wrapper_struct.rb
sym-2.0.0 lib/sym/data/wrapper_struct.rb