selfsdk 0.0.141 → 0.0.142

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
  SHA256:
3
- metadata.gz: 1fc84c8ad47b159c7f07f33226c1273bf30202f3b999ceba02ef51f6b35763fb
4
- data.tar.gz: 4c88fbad5ffa05cc69977554d454ca7fcc796663400f2e74b770879afe05c2a7
3
+ metadata.gz: b831656c278b883faa5a7831e39965964e87a7b2739257954ac29154d0374923
4
+ data.tar.gz: ed0231cd3e9fdd9525fa08a4119a3aee26e3146d2ed65c18b09c540c542ebce4
5
5
  SHA512:
6
- metadata.gz: c5f9b8cf446fb87a089d2094449691cd73806af84ce5d3f712a0357a0bdc5c4b2f7fef0dd6552591d56c4c5dd07fcaadcad02173b67b500f07ae80aec519fc2f
7
- data.tar.gz: ee291b8ca0f22787067ae2edca5a59fee3fea4950a06cfd921c00c9d283d7c769cefeac7dd8bcee0bd2eeee7784fab307a52919d81f87942b8c8ccd4eff6d045
6
+ metadata.gz: 745da1e65693ecb6e3e4946d799104cab2365e54af7faf3dfa1c0996825453e98507c4e536bc3c2690a67601e2bc565590ca71529ba53999fe6340cb48e79b8c
7
+ data.tar.gz: 0225bdfb29c5efbeb1501b7dcf144cbd09e87ab81d68c8b44a8ec5daa8cf4f08a2f24b7c1b59c356dde50cb696d1be17b02eb605ee5080ad033c6f06881c0aaf
@@ -55,9 +55,6 @@ module SelfSDK
55
55
 
56
56
  # 2b-iv) create the session with bob
57
57
  session_with_bob = @account.outbound_session(curve25519_identity_key, one_time_key)
58
-
59
- # 2b-v) store the session to a file
60
- File.write(session_file_name, session_with_bob.to_pickle(@storage_key))
61
58
  end
62
59
 
63
60
  # 3) create a group session and set the identity of the account youre using
@@ -67,7 +64,12 @@ module SelfSDK
67
64
  gs.add_participant("#{recipient}:#{recipient_device}", session_with_bob)
68
65
 
69
66
  # 5) encrypt a message
70
- gs.encrypt(message).to_s
67
+ ct = gs.encrypt(message).to_s
68
+
69
+ # 6) store the session to a file
70
+ File.write(session_file_name, session_with_bob.to_pickle(@storage_key))
71
+
72
+ ct
71
73
  end
72
74
 
73
75
  def decrypt(message, sender, sender_device)
@@ -84,9 +86,6 @@ module SelfSDK
84
86
 
85
87
  # 7b-ii) use the initial message to create a session for bob or carol
86
88
  session_with_bob = @account.inbound_session(m)
87
-
88
- # 7b-iii) store the session to a file
89
- File.write(session_file_name, session_with_bob.to_pickle(@storage_key))
90
89
  end
91
90
 
92
91
  # 8) create a group session and set the identity of the account you're using
@@ -96,7 +95,12 @@ module SelfSDK
96
95
  gs.add_participant("#{sender}:#{sender_device}", session_with_bob)
97
96
 
98
97
  # 10) decrypt the message ciphertext
99
- gs.decrypt("#{sender}:#{sender_device}", message).to_s
98
+ pt = gs.decrypt("#{sender}:#{sender_device}", message).to_s
99
+
100
+ # 11) store the session to a file
101
+ File.write(session_file_name, session_with_bob.to_pickle(@storage_key))
102
+
103
+ pt
100
104
  end
101
105
 
102
106
  private
@@ -11,7 +11,7 @@ module SelfSDK
11
11
  body = if input.is_a? String
12
12
  input
13
13
  else
14
- issuer = input.recipient.split(":")
14
+ issuer = input.sender.split(":")
15
15
  messaging.encryption_client.decrypt(input.ciphertext, issuer.first, issuer.last)
16
16
  end
17
17
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selfsdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.141
4
+ version: 0.0.142
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aldgate Ventures