Class: Shhh::Data::WrapperStruct

Inherits:
Struct
  • Object
show all
Defined in:
lib/shhh/data/wrapper_struct.rb

Constant Summary collapse

VERSION =
1

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(encrypted_data:, iv:, cipher_name:, salt: nil, version: VERSION, compress: Shhh::Configuration.config.compression_enabled) ⇒ WrapperStruct

Returns a new instance of WrapperStruct


17
18
19
20
21
22
23
24
25
26
# File 'lib/shhh/data/wrapper_struct.rb', line 17

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

Instance Attribute Details

#cipher_nameObject

Returns the value of attribute cipher_name

Returns:

  • (Object)

    the current value of cipher_name


4
5
6
# File 'lib/shhh/data/wrapper_struct.rb', line 4

def cipher_name
  @cipher_name
end

#compressObject

Returns the value of attribute compress

Returns:

  • (Object)

    the current value of compress


4
5
6
# File 'lib/shhh/data/wrapper_struct.rb', line 4

def compress
  @compress
end

#compressedObject

Returns the value of attribute compressed


15
16
17
# File 'lib/shhh/data/wrapper_struct.rb', line 15

def compressed
  @compressed
end

#encrypted_dataObject

Returns the value of attribute encrypted_data

Returns:

  • (Object)

    the current value of encrypted_data


4
5
6
# File 'lib/shhh/data/wrapper_struct.rb', line 4

def encrypted_data
  @encrypted_data
end

#ivObject

Returns the value of attribute iv

Returns:

  • (Object)

    the current value of iv


4
5
6
# File 'lib/shhh/data/wrapper_struct.rb', line 4

def iv
  @iv
end

#saltObject

Returns the value of attribute salt

Returns:

  • (Object)

    the current value of salt


4
5
6
# File 'lib/shhh/data/wrapper_struct.rb', line 4

def salt
  @salt
end

#versionObject

Returns the value of attribute version

Returns:

  • (Object)

    the current value of version


4
5
6
# File 'lib/shhh/data/wrapper_struct.rb', line 4

def version
  @version
end

Class Method Details

.deserialize(data) ⇒ Object


36
37
38
# File 'lib/shhh/data/wrapper_struct.rb', line 36

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

Instance Method Details

#configObject


28
29
30
# File 'lib/shhh/data/wrapper_struct.rb', line 28

def config
  Shhh::Configuration.config
end

#serializeObject


32
33
34
# File 'lib/shhh/data/wrapper_struct.rb', line 32

def serialize
  Marshal.dump(self)
end