self_crypto 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/self_crypto/account.c +2 -9
- data/lib/self_crypto/version.rb +1 -1
- data/test/spec/test_account.rb +10 -0
- data/test/unit/test_account_methods.rb +0 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c80522a003146eb903859a9fc2007546dc76ff94e599b3eaceccbe328b753fbb
|
4
|
+
data.tar.gz: a1a7eb743ed6b4c22d0a9b70c33f9aba491d6bf88a02bba32dbbb4659c570621
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8bf46420a38dda34c0574ecbc9ee785290dd2d3bcd94db3513547e65fe750c9cec0c835da24043224fb3d08bb318b47263e5753ff43d6ab55569cafd8ae4f3b
|
7
|
+
data.tar.gz: 785ee198c7345c1fa6ead3df9211181de418045cc33979c414b2f150d73f43b8303edc0be6469179c3f03e4acbe262d33834be3fcec5ba371fee41fada314ef7
|
data/ext/self_crypto/account.c
CHANGED
@@ -46,24 +46,17 @@ static VALUE initialize(int argc, VALUE *argv, VALUE self)
|
|
46
46
|
}
|
47
47
|
|
48
48
|
if(pickle != Qnil){
|
49
|
-
|
50
49
|
if(olm_unpickle_account(this, RSTRING_PTR(password), RSTRING_LEN(password), RSTRING_PTR(dup_string(pickle)), RSTRING_LEN(pickle)) == olm_error()){
|
51
|
-
|
52
50
|
raise_olm_error(olm_account_last_error(this));
|
53
51
|
}
|
54
|
-
}
|
55
|
-
if(seed != Qnil){
|
52
|
+
} else if(seed != Qnil){
|
56
53
|
if(olm_create_account_derrived_keys(this, RSTRING_PTR(seed), RSTRING_LEN(seed)) == olm_error()){
|
57
|
-
|
58
54
|
raise_olm_error(olm_account_last_error(this));
|
59
55
|
}
|
60
|
-
}
|
61
|
-
else{
|
62
|
-
|
56
|
+
} else {
|
63
57
|
size = olm_create_account_random_length(this);
|
64
58
|
|
65
59
|
if(olm_create_account(this, RSTRING_PTR(get_random(size)), size) == olm_error()){
|
66
|
-
|
67
60
|
raise_olm_error(olm_account_last_error(this));
|
68
61
|
}
|
69
62
|
}
|
data/lib/self_crypto/version.rb
CHANGED
data/test/spec/test_account.rb
CHANGED
@@ -95,6 +95,16 @@ describe "Account" do
|
|
95
95
|
|
96
96
|
end
|
97
97
|
|
98
|
+
describe "#inbound_session from pickled account" do
|
99
|
+
|
100
|
+
let(:remote_session){ remote.outbound_session(account.ik['curve25519'], account.otk['curve25519'].values.first) }
|
101
|
+
let(:remote_message){ remote_session.encrypt("hello") }
|
102
|
+
let(:pickled_account){ account.to_pickle("test") }
|
103
|
+
let(:unpickled_account){ SelfCrypto::Account.from_pickle(pickled_account, "test") }
|
104
|
+
it("creates session") { _(unpickled_account.inbound_session(remote_message, remote.ik['curve25519'])).must_be_kind_of SelfCrypto::Session }
|
105
|
+
|
106
|
+
end
|
107
|
+
|
98
108
|
end
|
99
109
|
|
100
110
|
end
|
@@ -25,10 +25,6 @@ class TestAccount < Minitest::Test
|
|
25
25
|
assert_equal OlmError::SUCCESS, @state.last_error
|
26
26
|
end
|
27
27
|
|
28
|
-
def test_sign
|
29
|
-
assert_instance_of String, @state.sign("hello")
|
30
|
-
end
|
31
|
-
|
32
28
|
def test_mark_keys_as_published
|
33
29
|
assert_equal @state, @state.mark_keys_as_published
|
34
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: self_crypto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Bevan
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-10-
|
12
|
+
date: 2020-10-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake-compiler
|