Class: Eth::Key::Decrypter

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/eth/key/decrypter.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils

#base256_to_int, #bin_to_hex, #bin_to_prefixed_hex, #format_address, #hash160, #hex_to_bin, #int_to_base256, #keccak256, #keccak256_rlp, #keccak512, #normalize_address, #prefix_hex, #prefix_message, #public_key_to_address, #remove_hex_prefix, #ripemd160, #sha256, #v_r_s_for, #valid_address?, #zpad, #zpad_hex, #zpad_int, #zunpad

Constructor Details

#initialize(data, password) ⇒ Decrypter

Returns a new instance of Decrypter.



11
12
13
14
# File 'lib/eth/key/decrypter.rb', line 11

def initialize(data, password)
  @data = JSON.parse(data)
  @password = password
end

Class Method Details

.perform(data, password) ⇒ Object



7
8
9
# File 'lib/eth/key/decrypter.rb', line 7

def self.perform(data, password)
  new(data, password).perform
end

Instance Method Details

#performObject



16
17
18
19
20
# File 'lib/eth/key/decrypter.rb', line 16

def perform
  derive_key password
  check_macs
  bin_to_hex decrypted_data
end