aboutsummaryrefslogtreecommitdiff
path: root/plugins/signal-protocol
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/signal-protocol')
-rw-r--r--plugins/signal-protocol/src/simple_iks.vala6
-rw-r--r--plugins/signal-protocol/src/store.vala8
-rw-r--r--plugins/signal-protocol/tests/common.vala4
-rw-r--r--plugins/signal-protocol/vapi/signal-protocol-public.vapi16
4 files changed, 22 insertions, 12 deletions
diff --git a/plugins/signal-protocol/src/simple_iks.vala b/plugins/signal-protocol/src/simple_iks.vala
index 1e575515..5247c455 100644
--- a/plugins/signal-protocol/src/simple_iks.vala
+++ b/plugins/signal-protocol/src/simple_iks.vala
@@ -3,8 +3,8 @@ using Gee;
namespace Signal {
public class SimpleIdentityKeyStore : IdentityKeyStore {
- public override uint8[] identity_key_private { get; set; }
- public override uint8[] identity_key_public { get; set; }
+ public override Bytes identity_key_private { get; set; }
+ public override Bytes identity_key_public { get; set; }
public override uint32 local_registration_id { get; set; }
private Map<string, Map<int, IdentityKeyStore.TrustedIdentity>> trusted_identities = new HashMap<string, Map<int, IdentityKeyStore.TrustedIdentity>>();
@@ -37,4 +37,4 @@ public class SimpleIdentityKeyStore : IdentityKeyStore {
}
}
-} \ No newline at end of file
+}
diff --git a/plugins/signal-protocol/src/store.vala b/plugins/signal-protocol/src/store.vala
index 2e277478..632ff8cc 100644
--- a/plugins/signal-protocol/src/store.vala
+++ b/plugins/signal-protocol/src/store.vala
@@ -1,8 +1,8 @@
namespace Signal {
public abstract class IdentityKeyStore : Object {
- public abstract uint8[] identity_key_private { get; set; }
- public abstract uint8[] identity_key_public { get; set; }
+ public abstract Bytes identity_key_private { get; set; }
+ public abstract Bytes identity_key_public { get; set; }
public abstract uint32 local_registration_id { get; set; }
public signal void trusted_identity_added(TrustedIdentity id);
@@ -112,8 +112,8 @@ public class Store : Object {
static int iks_get_identity_key_pair(out Buffer public_data, out Buffer private_data, void* user_data) {
Store store = (Store) user_data;
- public_data = new Buffer.from(store.identity_key_store.identity_key_public);
- private_data = new Buffer.from(store.identity_key_store.identity_key_private);
+ public_data = new Buffer.from(store.identity_key_store.identity_key_public.get_data());
+ private_data = new Buffer.from(store.identity_key_store.identity_key_private.get_data());
return 0;
}
diff --git a/plugins/signal-protocol/tests/common.vala b/plugins/signal-protocol/tests/common.vala
index 26e90185..9bb9b1dc 100644
--- a/plugins/signal-protocol/tests/common.vala
+++ b/plugins/signal-protocol/tests/common.vala
@@ -15,8 +15,8 @@ Store setup_test_store_context(Context global_context) {
store.identity_key_store.local_registration_id = (Random.next_int() % 16380) + 1;
ECKeyPair key_pair = global_context.generate_key_pair();
- store.identity_key_store.identity_key_private = key_pair.private.serialize();
- store.identity_key_store.identity_key_public = key_pair.public.serialize();
+ store.identity_key_store.identity_key_private = new Bytes(key_pair.private.serialize());
+ store.identity_key_store.identity_key_public = new Bytes(key_pair.public.serialize());
} catch (Error e) {
fail_if_reached();
}
diff --git a/plugins/signal-protocol/vapi/signal-protocol-public.vapi b/plugins/signal-protocol/vapi/signal-protocol-public.vapi
index 0a4456ad..1952beb1 100644
--- a/plugins/signal-protocol/vapi/signal-protocol-public.vapi
+++ b/plugins/signal-protocol/vapi/signal-protocol-public.vapi
@@ -218,9 +218,14 @@ namespace Signal {
[CCode (instance_pos = 1, cname = "ec_public_key_serialize")]
private int serialize_([CCode (pos = 0)] out Buffer buffer);
[CCode (cname = "ec_public_key_serialize_")]
- public uint8[] serialize() throws GLib.Error {
+ public uint8[] serialize() {
Buffer buffer;
- throw_by_code(serialize_(out buffer));
+ try {
+ throw_by_code(serialize_(out buffer));
+ } catch (GLib.Error e) {
+ // Can only throw for invalid arguments or out of memory.
+ GLib.assert_not_reached();
+ }
return buffer.data;
}
public int compare(ECPublicKey other);
@@ -235,7 +240,12 @@ namespace Signal {
[CCode (cname = "ec_private_key_serialize_")]
public uint8[] serialize() throws GLib.Error {
Buffer buffer;
- throw_by_code(serialize_(out buffer));
+ try {
+ throw_by_code(serialize_(out buffer));
+ } catch (GLib.Error e) {
+ // Can only throw for invalid arguments or out of memory.
+ GLib.assert_not_reached();
+ }
return buffer.data;
}
public int compare(ECPublicKey other);