Sha256: d1b6b364d26b5b345270fd2cafeb3502ba7dc827b7af9b20cf993f611dbd8fa3

Contents?: true

Size: 1.3 KB

Versions: 10

Compression:

Stored size: 1.3 KB

Contents

require_relative '../errors'
module Shhh
  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: Shhh::Configuration.config.compression_enabled
      )
        super(encrypted_data, iv, cipher_name, salt, version, compress)
      end

      def config
        Shhh::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
shhh-1.7.0 lib/shhh/data/wrapper_struct.rb
shhh-1.6.5 lib/shhh/data/wrapper_struct.rb
shhh-1.6.4 lib/shhh/data/wrapper_struct.rb
shhh-1.6.3 lib/shhh/data/wrapper_struct.rb
shhh-1.6.2 lib/shhh/data/wrapper_struct.rb
shhh-1.6.1 lib/shhh/data/wrapper_struct.rb
shhh-1.5.4 lib/shhh/data/wrapper_struct.rb
shhh-1.4.1 lib/shhh/data/wrapper_struct.rb
shhh-1.4.0 lib/shhh/data/wrapper_struct.rb
shhh-1.3.0 lib/shhh/data/wrapper_struct.rb