From 837de4063dbe398735a5b1d35bde1821c177b555 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sat, 11 May 2019 09:39:02 -0600 Subject: OMEMO: Move files to fitting subdirectory --- plugins/omemo/src/bundle.vala | 88 ------------------------------------------- 1 file changed, 88 deletions(-) delete mode 100644 plugins/omemo/src/bundle.vala (limited to 'plugins/omemo/src/bundle.vala') diff --git a/plugins/omemo/src/bundle.vala b/plugins/omemo/src/bundle.vala deleted file mode 100644 index 9b01f299..00000000 --- a/plugins/omemo/src/bundle.vala +++ /dev/null @@ -1,88 +0,0 @@ -using Gee; -using Signal; -using Xmpp; - -namespace Dino.Plugins.Omemo { - -public class Bundle { - private StanzaNode? node; - - public Bundle(StanzaNode? node) { - this.node = node; - assert(Plugin.ensure_context()); - } - - public int32 signed_pre_key_id { owned get { - if (node == null) return -1; - string? id = ((!)node).get_deep_attribute("signedPreKeyPublic", "signedPreKeyId"); - if (id == null) return -1; - return int.parse((!)id); - }} - - public ECPublicKey? signed_pre_key { owned get { - if (node == null) return null; - string? key = ((!)node).get_deep_string_content("signedPreKeyPublic"); - if (key == null) return null; - try { - return Plugin.get_context().decode_public_key(Base64.decode((!)key)); - } catch (Error e) { - return null; - } - }} - - public uint8[]? signed_pre_key_signature { owned get { - if (node == null) return null; - string? sig = ((!)node).get_deep_string_content("signedPreKeySignature"); - if (sig == null) return null; - return Base64.decode((!)sig); - }} - - public ECPublicKey? identity_key { owned get { - if (node == null) return null; - string? key = ((!)node).get_deep_string_content("identityKey"); - if (key == null) return null; - try { - return Plugin.get_context().decode_public_key(Base64.decode((!)key)); - } catch (Error e) { - return null; - } - }} - - public ArrayList pre_keys { owned get { - ArrayList list = new ArrayList(); - if (node == null || ((!)node).get_subnode("prekeys") == null) return list; - ((!)node).get_deep_subnodes("prekeys", "preKeyPublic") - .filter((node) => ((!)node).get_attribute("preKeyId") != null) - .map(PreKey.create) - .foreach((key) => list.add(key)); - return list; - }} - - public class PreKey { - private StanzaNode node; - - public static PreKey create(owned StanzaNode node) { - return new PreKey(node); - } - - public PreKey(StanzaNode node) { - this.node = node; - } - - public int32 key_id { owned get { - return int.parse(node.get_attribute("preKeyId") ?? "-1"); - }} - - public ECPublicKey? key { owned get { - string? key = node.get_string_content(); - if (key == null) return null; - try { - return Plugin.get_context().decode_public_key(Base64.decode((!)key)); - } catch (Error e) { - return null; - } - }} - } -} - -} \ No newline at end of file -- cgit v1.2.3-70-g09d2