Sha256: 17ea0ea604693f90b3b1b8d96c33a184411569295c5a3d09653c53c343cd6cd4

Contents?: true

Size: 724 Bytes

Versions: 5

Compression:

Stored size: 724 Bytes

Contents

module Rmega
  module Nodes
    module Expandable
      include Uploadable

      def create_folder(name)
        node_key = NodeKey.random

        # encrypt attributes
        _attr = serialize_attributes(:n => name.strip)
        _attr = aes_cbc_encrypt(node_key.aes_key, _attr)

        # Encrypt node key
        encrypted_key = aes_ecb_encrypt(session.master_key, node_key.aes_key)

        n = [{h: 'xxxxxxxx', t: 1, a: Utils.base64urlencode(_attr), k: Utils.base64urlencode(encrypted_key)}]
        data = session.request(a: 'p', t: handle, n: n)
        return Folder.new(session, data['f'][0])
      end

      def upload_url(filesize)
        session.request(a: 'u', s: filesize)['p']
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rmega-0.2.6 lib/rmega/nodes/expandable.rb
rmega-0.2.5 lib/rmega/nodes/expandable.rb
rmega-0.2.4 lib/rmega/nodes/expandable.rb
rmega-0.2.2 lib/rmega/nodes/expandable.rb
rmega-0.2.1 lib/rmega/nodes/expandable.rb