lib/megar/session.rb
# Command: decrypt/decode the login +response_data+ received from Mega
#
decrypt/decode the login +response_data+ received from Mega
decrypt / decode the login + response_data + received from Mega
def handle_files_response(response_data,reset=true)
    reset_files! if reset
    response_data['f'].each do |f|
      item_attributes = {id: f['h'], payload: f.dup, type: f['t'] }
      case f['t']
      when 0 
        item_attributes[:key] = k = decrypt_file_key(f)
        item_attributes[:decomposed_key] = key = decompose_file_key(k)
        item_attributes[:attributes] = decrypt_file_attributes(f['a'],key)
        files.add(item_attributes)
      when 1 
        item_attributes[:key] = k = decrypt_file_key(f)
        item_attributes[:attributes] = decrypt_file_attributes(f['a'],k)
        folders.add(item_attributes)
      when 2,3,4 
        folders.add(item_attributes)
      end
    end
    true
  end
def handle_files_response ( response_data , reset = true ) reset_files! if reset response_data [ 'f' ] . each do | f | item_attributes = { id : f [ 'h' ] , payload : f . dup , type : f [ 't' ] } case f [ 't' ] when 0 item_attributes [ :key ] = k = decrypt_file_key ( f ) item_attributes [ :decomposed_key ] = key = decompose_file_key ( k ) item_attributes [ :attributes ] = decrypt_file_attributes ( f [ 'a' ] , key ) files . add ( item_attributes ) when 1 item_attributes [ :key ] = k = decrypt_file_key ( f ) item_attributes [ :attributes ] = decrypt_file_attributes ( f [ 'a' ] , k ) folders . add ( item_attributes ) when 2 , 3 , 4 folders . add ( item_attributes ) end end true end
Command: decrypt/decode the login +response_data+ received from Mega
Command : decrypt / decode the login + response_data + received from Mega
# File # Folder # Root, Inbox, Trash Bin
response_data
reset