From e8270422c40134dcbacbe13e9ec0754db1a10007 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Wed, 25 Oct 2023 15:57:38 +0200 Subject: [PATCH 1/9] XIVY-12667 removed dropin installer as it is not needed --- threema-connector-product/product.json | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/threema-connector-product/product.json b/threema-connector-product/product.json index 13070f6..97d486b 100644 --- a/threema-connector-product/product.json +++ b/threema-connector-product/product.json @@ -44,27 +44,6 @@ } ] } - }, - { - "id": "maven-dropins", - "data": { - "dependencies": [ - { - "groupId": "com.axonivy.connector.threema", - "artifactId": "threema-connector", - "version": "${version}" - } - ], - "repositories": [ - { - "id": "maven.axonivy.com", - "url": "https://maven.axonivy.com", - "snapshots": { - "enabled": "true" - } - } - ] - } } ] } From 07f56ab5cf503594182943c3d82af5debfbf840b Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Wed, 25 Oct 2023 16:04:43 +0200 Subject: [PATCH 2/9] XIVY-12667 Added Maven ant execution to delete zip-archive --- threema-connector/pom.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/threema-connector/pom.xml b/threema-connector/pom.xml index 0278c8f..fa47fdd 100644 --- a/threema-connector/pom.xml +++ b/threema-connector/pom.xml @@ -52,6 +52,18 @@ + + delete-threema-msgapi-tool-archive + validate + + run + + + + + + + From 21997064924c48afc63eb30418a9f05a03727d0e Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Wed, 25 Oct 2023 17:03:45 +0200 Subject: [PATCH 3/9] XIVY-12667 Added process to generate keypair --- .../connector/createKeyPairData.ivyClass | 6 + .../processes/createKeyPair.p.json | 67 +++++++++++ .../src/util/KeyPairGenerator.java | 19 +++ .../connector/KeyPair/KeyPair.rddescriptor | 7 ++ .../threema/connector/KeyPair/KeyPair.xhtml | 35 ++++++ .../connector/KeyPair/KeyPairData.ivyClass | 4 + .../connector/KeyPair/KeyPairProcess.p.json | 52 +++++++++ .../webContent/layouts/frame-10.xhtml | 60 ++++++++++ .../layouts/includes/exception-details.xhtml | 109 ++++++++++++++++++ .../layouts/includes/exception.xhtml | 47 ++++++++ .../webContent/layouts/includes/footer.xhtml | 18 +++ .../layouts/includes/progress-loader.xhtml | 15 +++ 12 files changed, 439 insertions(+) create mode 100644 threema-connector/dataclasses/threema/connector/createKeyPairData.ivyClass create mode 100644 threema-connector/processes/createKeyPair.p.json create mode 100644 threema-connector/src/util/KeyPairGenerator.java create mode 100644 threema-connector/src_hd/threema/connector/KeyPair/KeyPair.rddescriptor create mode 100644 threema-connector/src_hd/threema/connector/KeyPair/KeyPair.xhtml create mode 100644 threema-connector/src_hd/threema/connector/KeyPair/KeyPairData.ivyClass create mode 100644 threema-connector/src_hd/threema/connector/KeyPair/KeyPairProcess.p.json create mode 100644 threema-connector/webContent/layouts/frame-10.xhtml create mode 100644 threema-connector/webContent/layouts/includes/exception-details.xhtml create mode 100644 threema-connector/webContent/layouts/includes/exception.xhtml create mode 100644 threema-connector/webContent/layouts/includes/footer.xhtml create mode 100644 threema-connector/webContent/layouts/includes/progress-loader.xhtml diff --git a/threema-connector/dataclasses/threema/connector/createKeyPairData.ivyClass b/threema-connector/dataclasses/threema/connector/createKeyPairData.ivyClass new file mode 100644 index 0000000..5e2b755 --- /dev/null +++ b/threema-connector/dataclasses/threema/connector/createKeyPairData.ivyClass @@ -0,0 +1,6 @@ +createKeyPairData #class +threema.connector #namespace +privateKey String #field +privateKey PERSISTENT #fieldModifier +publicKey String #field +publicKey PERSISTENT #fieldModifier diff --git a/threema-connector/processes/createKeyPair.p.json b/threema-connector/processes/createKeyPair.p.json new file mode 100644 index 0000000..9427be7 --- /dev/null +++ b/threema-connector/processes/createKeyPair.p.json @@ -0,0 +1,67 @@ +{ + "format" : "10.0.0", + "id" : "18B67537F65B8CEE", + "config" : { + "data" : "threema.connector.createKeyPairData" + }, + "elements" : [ { + "id" : "f0", + "type" : "RequestStart", + "name" : "start.ivp", + "config" : { + "callSignature" : "start", + "outLink" : "start.ivp" + }, + "visual" : { + "at" : { "x" : 96, "y" : 64 } + }, + "connect" : { "id" : "f4", "to" : "f3" } + }, { + "id" : "f1", + "type" : "TaskEnd", + "visual" : { + "at" : { "x" : 696, "y" : 64 } + } + }, { + "id" : "f3", + "type" : "Script", + "name" : "generateKeyPair", + "config" : { + "output" : { + "code" : [ + "import util.KeyPairGenerator;", + "import util.KeyPairGenerator.KeyPair;", + "", + "KeyPair keys = KeyPairGenerator.generate();", + "", + "out.publicKey = keys.publicKey();", + "out.privateKey = keys.privateKey();" + ] + } + }, + "visual" : { + "at" : { "x" : 320, "y" : 64 } + }, + "connect" : { "id" : "f6", "to" : "f5" } + }, { + "id" : "f5", + "type" : "DialogCall", + "name" : "KeyPair", + "config" : { + "dialogId" : "threema.connector.KeyPair", + "startMethod" : "start(threema.connector.createKeyPairData)", + "call" : { + "params" : [ + { "name" : "createKeyPairData", "type" : "threema.connector.createKeyPairData" } + ], + "map" : { + "param.createKeyPairData" : "in" + } + } + }, + "visual" : { + "at" : { "x" : 508, "y" : 64 } + }, + "connect" : { "id" : "f2", "to" : "f1" } + } ] +} \ No newline at end of file diff --git a/threema-connector/src/util/KeyPairGenerator.java b/threema-connector/src/util/KeyPairGenerator.java new file mode 100644 index 0000000..1b12c98 --- /dev/null +++ b/threema-connector/src/util/KeyPairGenerator.java @@ -0,0 +1,19 @@ +package util; + +import javax.xml.bind.DatatypeConverter; + +import ch.threema.apitool.CryptTool; + +public class KeyPairGenerator { + + public record KeyPair(String publicKey, String privateKey) {} + + public static KeyPair generate() { + byte[] publicKey = new byte[32]; + byte[] privateKey = new byte[32]; + + CryptTool.generateKeyPair(publicKey, privateKey); + return new KeyPair(DatatypeConverter.printHexBinary(publicKey), DatatypeConverter.printHexBinary(privateKey)); + } + +} diff --git a/threema-connector/src_hd/threema/connector/KeyPair/KeyPair.rddescriptor b/threema-connector/src_hd/threema/connector/KeyPair/KeyPair.rddescriptor new file mode 100644 index 0000000..ae605f0 --- /dev/null +++ b/threema-connector/src_hd/threema/connector/KeyPair/KeyPair.rddescriptor @@ -0,0 +1,7 @@ + + + + viewTechnology + JSF + + diff --git a/threema-connector/src_hd/threema/connector/KeyPair/KeyPair.xhtml b/threema-connector/src_hd/threema/connector/KeyPair/KeyPair.xhtml new file mode 100644 index 0000000..ff800ef --- /dev/null +++ b/threema-connector/src_hd/threema/connector/KeyPair/KeyPair.xhtml @@ -0,0 +1,35 @@ + + + + KeyPair + + +

Newly generated Keypair

+ + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+ + \ No newline at end of file diff --git a/threema-connector/src_hd/threema/connector/KeyPair/KeyPairData.ivyClass b/threema-connector/src_hd/threema/connector/KeyPair/KeyPairData.ivyClass new file mode 100644 index 0000000..b47ddd9 --- /dev/null +++ b/threema-connector/src_hd/threema/connector/KeyPair/KeyPairData.ivyClass @@ -0,0 +1,4 @@ +KeyPairData #class +threema.connector.KeyPair #namespace +createKeyPairData threema.connector.createKeyPairData #field +createKeyPairData PERSISTENT #fieldModifier diff --git a/threema-connector/src_hd/threema/connector/KeyPair/KeyPairProcess.p.json b/threema-connector/src_hd/threema/connector/KeyPair/KeyPairProcess.p.json new file mode 100644 index 0000000..d7e4795 --- /dev/null +++ b/threema-connector/src_hd/threema/connector/KeyPair/KeyPairProcess.p.json @@ -0,0 +1,52 @@ +{ + "format" : "10.0.0", + "id" : "18B675A6BCE832D1", + "kind" : "HTML_DIALOG", + "config" : { + "data" : "threema.connector.KeyPair.KeyPairData" + }, + "elements" : [ { + "id" : "f0", + "type" : "HtmlDialogStart", + "name" : "start(createKeyPairData)", + "config" : { + "callSignature" : "start", + "input" : { + "params" : [ + { "name" : "createKeyPairData", "type" : "threema.connector.createKeyPairData" } + ], + "map" : { + "out.createKeyPairData" : "param.createKeyPairData" + } + }, + "guid" : "18B675A6BCFECF51" + }, + "visual" : { + "at" : { "x" : 96, "y" : 64 } + }, + "connect" : { "id" : "f2", "to" : "f1" } + }, { + "id" : "f1", + "type" : "HtmlDialogEnd", + "visual" : { + "at" : { "x" : 224, "y" : 64 } + } + }, { + "id" : "f3", + "type" : "HtmlDialogEventStart", + "name" : "close", + "config" : { + "guid" : "18B675A6BD2AE7CB" + }, + "visual" : { + "at" : { "x" : 96, "y" : 160 } + }, + "connect" : { "id" : "f5", "to" : "f4" } + }, { + "id" : "f4", + "type" : "HtmlDialogExit", + "visual" : { + "at" : { "x" : 224, "y" : 160 } + } + } ] +} \ No newline at end of file diff --git a/threema-connector/webContent/layouts/frame-10.xhtml b/threema-connector/webContent/layouts/frame-10.xhtml new file mode 100644 index 0000000..936a73b --- /dev/null +++ b/threema-connector/webContent/layouts/frame-10.xhtml @@ -0,0 +1,60 @@ + + + + + + + + + + <ui:insert name="title">Ivy Html Dialog</ui:insert> + + + + + + + + + +
+ + default content + +
+ + + + + + + +
+ \ No newline at end of file diff --git a/threema-connector/webContent/layouts/includes/exception-details.xhtml b/threema-connector/webContent/layouts/includes/exception-details.xhtml new file mode 100644 index 0000000..bbc3cce --- /dev/null +++ b/threema-connector/webContent/layouts/includes/exception-details.xhtml @@ -0,0 +1,109 @@ + + + + + + +

+ +

+ + +

Error id

+

#{errorPage.exceptionId}

+

Error Timestamp

+

#{errorPage.createdAt}

+
+ + + + +

Attributes

+
+ + + + + + + + + + + + + + + +
NameValue
+
+
+

Thrown by

+

Process: + +
Element: + +

+
+ + +

Process call stack

+ +
#{caller.callerElement}
+
+
+ +

Technical cause

+
#{causedBy.class.simpleName}: #{causedBy.message.trim()}
+
+
+ +

Request Uri

+

#{errorPage.getRequestUri()}

+
+

Servlet

+

#{errorPage.getServletName()}

+
+ +

Application

+

#{errorPage.applicationName}

+
+ + +

Thread local values

+
+ + + + + + + + + + + + + + + +
KeyValue
+
+
+
+ +

Stack-Trace

+
#{errorPage.getStackTrace()}
+
+ diff --git a/threema-connector/webContent/layouts/includes/exception.xhtml b/threema-connector/webContent/layouts/includes/exception.xhtml new file mode 100644 index 0000000..1b255a2 --- /dev/null +++ b/threema-connector/webContent/layouts/includes/exception.xhtml @@ -0,0 +1,47 @@ + + + + + + + + + +
+
+ + +
+ + + + + + + + + +
+ + \ No newline at end of file diff --git a/threema-connector/webContent/layouts/includes/footer.xhtml b/threema-connector/webContent/layouts/includes/footer.xhtml new file mode 100644 index 0000000..f21699e --- /dev/null +++ b/threema-connector/webContent/layouts/includes/footer.xhtml @@ -0,0 +1,18 @@ + + + +
+ + #{ivyAdvisor.applicationName} + + +
+
+ + \ No newline at end of file diff --git a/threema-connector/webContent/layouts/includes/progress-loader.xhtml b/threema-connector/webContent/layouts/includes/progress-loader.xhtml new file mode 100644 index 0000000..0d68a75 --- /dev/null +++ b/threema-connector/webContent/layouts/includes/progress-loader.xhtml @@ -0,0 +1,15 @@ + + + + +
+
+
Loading...
+
+
+ + + +
+
\ No newline at end of file From abf23380f12bb1dd3fcc21148df57ba534ffb216 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Wed, 25 Oct 2023 17:05:52 +0200 Subject: [PATCH 4/9] XIVY-12667 Updated README to include new process for key generation --- threema-connector-product/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/threema-connector-product/README.md b/threema-connector-product/README.md index 23f3305..8d89bea 100644 --- a/threema-connector-product/README.md +++ b/threema-connector-product/README.md @@ -13,8 +13,9 @@ Credentials and credits are required to send messages. The credentials can be cr ## Setup This Connector requires an "End-to-End Threema ID". [Request new ID](https://gateway.threema.ch/en/id-request)
-For generating the keys and requesting a new Threema.Gateway ID refer to [Generate keys](https://gateway.threema.ch/en/developer/howto/create-keys/php). +To request a new Threema.Gateway ID refer to [Generate keys](https://gateway.threema.ch/en/developer/howto/create-keys/php). +For generating the keys you can use the "createKeyPair" process. To use the Threema Connector, add the following variables to your Axon Ivy Project: ``` From 3dd36b5ee298dd772e83ea09123f428a4fe38f0d Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Wed, 25 Oct 2023 17:15:42 +0200 Subject: [PATCH 5/9] XIVY-12667 Added test for KeyPairGenerator --- .../test/util/KeyPairGeneratorTest.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 threema-connector-test/src_test/threema/connector/test/util/KeyPairGeneratorTest.java diff --git a/threema-connector-test/src_test/threema/connector/test/util/KeyPairGeneratorTest.java b/threema-connector-test/src_test/threema/connector/test/util/KeyPairGeneratorTest.java new file mode 100644 index 0000000..5bb233a --- /dev/null +++ b/threema-connector-test/src_test/threema/connector/test/util/KeyPairGeneratorTest.java @@ -0,0 +1,22 @@ +package threema.connector.test.util; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; + +import util.KeyPairGenerator; +import util.KeyPairGenerator.KeyPair; + +public class KeyPairGeneratorTest { + + @Test + void generateKeyPair() { + KeyPair keys = KeyPairGenerator.generate(); + assertThat(keys.publicKey()).isNotEmpty(); + assertThat(keys.privateKey()).isNotEmpty(); + + assertThat(keys.publicKey().length()).isEqualTo(64); + assertThat(keys.privateKey().length()).isEqualTo(64); + } + +} From 577760bbf9a7d4c984cb96595dd791e032bafde2 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 26 Oct 2023 08:48:14 +0200 Subject: [PATCH 6/9] XIVY-12667 Added step by step instructions --- threema-connector-product/README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/threema-connector-product/README.md b/threema-connector-product/README.md index 8d89bea..1f00c97 100644 --- a/threema-connector-product/README.md +++ b/threema-connector-product/README.md @@ -11,12 +11,10 @@ Credentials and credits are required to send messages. The credentials can be cr ![Result screen](./images/resultScreen.png) ## Setup -This Connector requires an "End-to-End Threema ID". [Request new ID](https://gateway.threema.ch/en/id-request) -
+1. Create "End-to-End Threema ID" at: [Request new ID](https://gateway.threema.ch/en/id-request) To request a new Threema.Gateway ID refer to [Generate keys](https://gateway.threema.ch/en/developer/howto/create-keys/php). - -For generating the keys you can use the "createKeyPair" process. -To use the Threema Connector, add the following variables to your Axon Ivy Project: +2. Generate a new key pair using the "createKeyPair" process. +3. Add the following variables to your Axon Ivy Project: ``` @variables.yaml@ From 548273c39759b333827ddcbb4bdd64a7bd166380 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 26 Oct 2023 08:49:01 +0200 Subject: [PATCH 7/9] XIVY-12667 Combined 3 execution steps into 1 --- threema-connector/pom.xml | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/threema-connector/pom.xml b/threema-connector/pom.xml index fa47fdd..5abdc54 100644 --- a/threema-connector/pom.xml +++ b/threema-connector/pom.xml @@ -32,38 +32,16 @@ - - - - - extract-threema-msgapi-tool - validate - - run - - - + dest="${project.basedir}/lib/threema-msgapi-tool.zip"/> - + + - - delete-threema-msgapi-tool-archive - validate - - run - - - - - - - From cf752ec943085171f206abdc22fcd8d3e13c2e46 Mon Sep 17 00:00:00 2001 From: ivy-fhe <146715063+ivy-fhe@users.noreply.github.com> Date: Thu, 26 Oct 2023 08:52:05 +0200 Subject: [PATCH 8/9] Update README.md --- threema-connector-product/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/threema-connector-product/README.md b/threema-connector-product/README.md index 1f00c97..781c8e8 100644 --- a/threema-connector-product/README.md +++ b/threema-connector-product/README.md @@ -11,7 +11,7 @@ Credentials and credits are required to send messages. The credentials can be cr ![Result screen](./images/resultScreen.png) ## Setup -1. Create "End-to-End Threema ID" at: [Request new ID](https://gateway.threema.ch/en/id-request) +1. Create "End-to-End Threema ID" at: [Request new ID](https://gateway.threema.ch/en/id-request)
To request a new Threema.Gateway ID refer to [Generate keys](https://gateway.threema.ch/en/developer/howto/create-keys/php). 2. Generate a new key pair using the "createKeyPair" process. 3. Add the following variables to your Axon Ivy Project: From d0aab780dfa05e0c64d9ec23aa61bc88135643ff Mon Sep 17 00:00:00 2001 From: ivy-fhe <146715063+ivy-fhe@users.noreply.github.com> Date: Thu, 26 Oct 2023 08:53:30 +0200 Subject: [PATCH 9/9] Update README.md --- threema-connector-product/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/threema-connector-product/README.md b/threema-connector-product/README.md index 781c8e8..b8b02a3 100644 --- a/threema-connector-product/README.md +++ b/threema-connector-product/README.md @@ -11,9 +11,8 @@ Credentials and credits are required to send messages. The credentials can be cr ![Result screen](./images/resultScreen.png) ## Setup -1. Create "End-to-End Threema ID" at: [Request new ID](https://gateway.threema.ch/en/id-request)
-To request a new Threema.Gateway ID refer to [Generate keys](https://gateway.threema.ch/en/developer/howto/create-keys/php). -2. Generate a new key pair using the "createKeyPair" process. +1. Generate a new key pair using the "createKeyPair" process. +2. Create "End-to-End Threema ID" at: [Request new ID](https://gateway.threema.ch/en/id-request)
3. Add the following variables to your Axon Ivy Project: ```