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 +4 -4
- data/lib/crypto.rb +12 -8
- data/lib/messages/message.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b831656c278b883faa5a7831e39965964e87a7b2739257954ac29154d0374923
|
4
|
+
data.tar.gz: ed0231cd3e9fdd9525fa08a4119a3aee26e3146d2ed65c18b09c540c542ebce4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 745da1e65693ecb6e3e4946d799104cab2365e54af7faf3dfa1c0996825453e98507c4e536bc3c2690a67601e2bc565590ca71529ba53999fe6340cb48e79b8c
|
7
|
+
data.tar.gz: 0225bdfb29c5efbeb1501b7dcf144cbd09e87ab81d68c8b44a8ec5daa8cf4f08a2f24b7c1b59c356dde50cb696d1be17b02eb605ee5080ad033c6f06881c0aaf
|
data/lib/crypto.rb
CHANGED
@@ -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
|
data/lib/messages/message.rb
CHANGED