From b46bfcfaed199f85eca9f1ee3259f40370c55f97 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Wed, 25 Oct 2023 15:57:38 +0200 Subject: [PATCH 01/11] 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 df301b2cec288007f53e1a7e7d5f672e55487306 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Wed, 25 Oct 2023 16:04:43 +0200 Subject: [PATCH 02/11] 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 e9d50df1e2fd2caacb4860451488f135a725ff72 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Wed, 25 Oct 2023 16:13:11 +0200 Subject: [PATCH 03/11] XIVY-12667 Added password annotation to privatekey --- threema-connector/config/variables.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/threema-connector/config/variables.yaml b/threema-connector/config/variables.yaml index 40307c2..10ad5cf 100644 --- a/threema-connector/config/variables.yaml +++ b/threema-connector/config/variables.yaml @@ -10,4 +10,5 @@ Variables: secret: '' # Your private key associated with your Threema.Gateway ID + # [password] privateKey: '' From 22c0131ca1b5430cb07bab4901b1aa9ba3440d4c Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Wed, 25 Oct 2023 17:03:45 +0200 Subject: [PATCH 04/11] 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 f2e0a5cbaaafb1d66c767bf47bba1d4fc8a83aac Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Wed, 25 Oct 2023 17:05:52 +0200 Subject: [PATCH 05/11] 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 2ec9a202b6a4a259a577badf007f1b32bcfb87af Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Wed, 25 Oct 2023 17:15:42 +0200 Subject: [PATCH 06/11] 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 a3894ff6f6ad6dd9fd23e792a9ba0ca5f80f9ea7 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 26 Oct 2023 08:48:14 +0200 Subject: [PATCH 07/11] 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 cd824cd9761dd617819831930e3e1f3c889617fe Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 26 Oct 2023 08:48:41 +0200 Subject: [PATCH 08/11] XIVY-12667 removed password annotation form threemaId --- threema-connector/config/variables.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/threema-connector/config/variables.yaml b/threema-connector/config/variables.yaml index 10ad5cf..e4fd1d0 100644 --- a/threema-connector/config/variables.yaml +++ b/threema-connector/config/variables.yaml @@ -2,7 +2,6 @@ Variables: threemaConnector: # Your Threema.Gateway ID - # [password] threemaId: '' # Your Threema.Gateway Secret From 823c2d5a19e5934d61e2227bd393e502d8f99bcb Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 26 Oct 2023 08:49:01 +0200 Subject: [PATCH 09/11] 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 e058ea40d99f86c379b90dfb046b7f8aafbeb649 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 10/11] 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 edad32dd94ec8e6aeffbcdb98875d14d956eefda 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 11/11] 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: ```