rmega 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 461e31696b324da1fdd11d8164b9284f9d0ead32
4
- data.tar.gz: 6edaa46bdd45cee1447af2bd569bdd812fddb207
3
+ metadata.gz: 1de0443e3d865f515533f1110ba81e188b50c82f
4
+ data.tar.gz: dcfa1879ea580bba7ed15fb6838084fc2ff3fb28
5
5
  SHA512:
6
- metadata.gz: 7c38cbd4d4510fa270bf269f57fe3d6fef4730ed421065ffee8d0762ecbd8d47acd2a84311f699193635b7cb6a1bc31c5519778cd1c2f4ac3c9779035ebfe2dd
7
- data.tar.gz: 1d731406b6c5096f9cb12240ce3af9016b2fd5d728e2594af69156d559c557f7581b0d6c08b566b6a4a98c206bba6dbcd3c1fb40b4c6fcd7c7cd8ddd39a9fd1e
6
+ metadata.gz: 0d393bdf468cc8f99f58a742be0e82eb9aab70479450fedb4e63f2f1d72aa15dd205860fbf01bbbac1c23e03a427538d9a84533a6c968b5aabe8b686f7eadf05
7
+ data.tar.gz: 905433bb7362720a3cdaa5753aee2f7a7a34f6c4f8ce6654efa4fcd75502176fbc8008b29b4dea61a89784a85644adc0d4761f32fdfa69ff5c0a856396bdacdd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.7
2
+
3
+ * \#9 Fixed decryption of nodes shared by you to others
4
+
1
5
  ## 0.1.6
2
6
 
3
7
  ### New Features
data/lib/rmega/storage.rb CHANGED
@@ -6,6 +6,8 @@ module Rmega
6
6
 
7
7
  attr_reader :session
8
8
 
9
+ delegate :master_key, :shared_keys, to: :session
10
+
9
11
  def initialize(session)
10
12
  @session = session
11
13
  end
@@ -23,9 +25,11 @@ module Rmega
23
25
  end
24
26
 
25
27
  def nodes
26
- results = session.request(a: 'f', c: 1)['f']
28
+ results = session.request(a: 'f', c: 1)
29
+
30
+ store_shared_keys(results['ok'] || [])
27
31
 
28
- results.map do |node_data|
32
+ (results['f'] || []).map do |node_data|
29
33
  node = Nodes::Factory.build(session, node_data)
30
34
  node.process_shared_key if node.shared_root?
31
35
  node
@@ -51,5 +55,13 @@ module Rmega
51
55
  def download(public_url, path)
52
56
  Nodes::Factory.build_from_url(session, public_url).download(path)
53
57
  end
58
+
59
+ private
60
+
61
+ def store_shared_keys(list)
62
+ list.each do |hash|
63
+ shared_keys[hash['h']] = Crypto.decrypt_key(master_key, Utils.base64_to_a32(hash['k']))
64
+ end
65
+ end
54
66
  end
55
67
  end
data/lib/rmega/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rmega
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rmega
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniele Molteni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-22 00:00:00.000000000 Z
11
+ date: 2014-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry