From f1546e894b2a7550bce3e8d84067968bf5cf7087 Mon Sep 17 00:00:00 2001 From: Alexey Andreyev Date: Sun, 14 Jul 2019 02:33:39 +0300 Subject: E2EE: provide a shared header with encryption standard key names --- lib/e2ee.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lib/e2ee.h (limited to 'lib/e2ee.h') diff --git a/lib/e2ee.h b/lib/e2ee.h new file mode 100644 index 00000000..f663ddc3 --- /dev/null +++ b/lib/e2ee.h @@ -0,0 +1,21 @@ +#pragma once + +#include + +namespace QMatrixClient +{ + static const auto AlgorithmKeyL = "algorithm"_ls; + static const auto RotationPeriodMsKeyL = "rotation_period_ms"_ls; + static const auto RotationPeriodMsgsKeyL = "rotation_period_msgs"_ls; + + static const auto AlgorithmKey = QStringLiteral("algorithm"); + static const auto RotationPeriodMsKey = QStringLiteral("rotation_period_ms"); + static const auto RotationPeriodMsgsKey = QStringLiteral("rotation_period_msgs"); + + static const auto Ed25519Key = QStringLiteral("ed25519"); + static const auto Curve25519Key = QStringLiteral("curve25519"); + static const auto SignedCurve25519Key = QStringLiteral("signed_curve25519"); + static const auto OlmV1Curve25519AesSha2AlgoKey = QStringLiteral("m.olm.v1.curve25519-aes-sha2"); + static const auto MegolmV1AesSha2AlgoKey = QStringLiteral("m.megolm.v1.aes-sha2"); + static const QStringList SupportedAlgorithms = { OlmV1Curve25519AesSha2AlgoKey, MegolmV1AesSha2AlgoKey }; +} // namespace QMatrixClient -- cgit v1.2.3 From 2737dc00334ad3a56c1b311435dbe84453ee389e Mon Sep 17 00:00:00 2001 From: Alexey Andreyev Date: Sun, 14 Jul 2019 03:54:19 +0300 Subject: E2EE: introduce EncryptedEvent --- lib/e2ee.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/e2ee.h') diff --git a/lib/e2ee.h b/lib/e2ee.h index f663ddc3..4a42809d 100644 --- a/lib/e2ee.h +++ b/lib/e2ee.h @@ -4,6 +4,11 @@ namespace QMatrixClient { + static const auto CiphertextKeyL = "ciphertext"_ls; + static const auto SenderKeyKeyL = "sender_key"_ls; + static const auto DeviceIdKeyL = "device_id"_ls; + static const auto SessionIdKeyL = "session_id"_ls; + static const auto AlgorithmKeyL = "algorithm"_ls; static const auto RotationPeriodMsKeyL = "rotation_period_ms"_ls; static const auto RotationPeriodMsgsKeyL = "rotation_period_msgs"_ls; -- cgit v1.2.3 From 83453eda5dc74c64548b51860d8f7ef08123bec3 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 2 Aug 2019 14:52:25 +0900 Subject: e2ee.h: add a missing #include Revealed after reordering #includes with clang-format. --- lib/e2ee.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/e2ee.h') diff --git a/lib/e2ee.h b/lib/e2ee.h index 11f411f1..d3329def 100644 --- a/lib/e2ee.h +++ b/lib/e2ee.h @@ -1,5 +1,7 @@ #pragma once +#include "util.h" + #include namespace QMatrixClient -- cgit v1.2.3 From c05ade838f0fce81f2bbe80a3295618a8a26ff52 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 2 Aug 2019 19:59:40 +0900 Subject: Apply the new brace wrapping to source files --- lib/e2ee.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/e2ee.h') diff --git a/lib/e2ee.h b/lib/e2ee.h index d3329def..c85211be 100644 --- a/lib/e2ee.h +++ b/lib/e2ee.h @@ -4,8 +4,7 @@ #include -namespace QMatrixClient -{ +namespace QMatrixClient { static const auto CiphertextKeyL = "ciphertext"_ls; static const auto SenderKeyKeyL = "sender_key"_ls; static const auto DeviceIdKeyL = "device_id"_ls; -- cgit v1.2.3 From 27ca32a1e5a56e09b9cc1d94224d2831004dcf3d Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 7 Jul 2019 19:32:34 +0900 Subject: Namespace: QMatrixClient -> Quotient (with back comp alias) --- lib/e2ee.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/e2ee.h') diff --git a/lib/e2ee.h b/lib/e2ee.h index c85211be..5a9b83c5 100644 --- a/lib/e2ee.h +++ b/lib/e2ee.h @@ -4,7 +4,7 @@ #include -namespace QMatrixClient { +namespace Quotient { static const auto CiphertextKeyL = "ciphertext"_ls; static const auto SenderKeyKeyL = "sender_key"_ls; static const auto DeviceIdKeyL = "device_id"_ls; @@ -28,4 +28,4 @@ static const auto MegolmV1AesSha2AlgoKey = QStringLiteral("m.megolm.v1.aes-sha2"); static const QStringList SupportedAlgorithms = { OlmV1Curve25519AesSha2AlgoKey, MegolmV1AesSha2AlgoKey }; -} // namespace QMatrixClient +} // namespace Quotient -- cgit v1.2.3 From 1ece121b14ae82f7dd0b893d0dbef3de7c84d303 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 12 Aug 2019 15:47:59 +0900 Subject: e2ee.h: Make constants inline instead of static This changes from internal linkage for every translation unit including e2ee.h to external linkage across translation units but without the need to create a .cpp file just to define and init the constants. --- lib/e2ee.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'lib/e2ee.h') diff --git a/lib/e2ee.h b/lib/e2ee.h index 5a9b83c5..f49b9748 100644 --- a/lib/e2ee.h +++ b/lib/e2ee.h @@ -5,27 +5,27 @@ #include namespace Quotient { -static const auto CiphertextKeyL = "ciphertext"_ls; -static const auto SenderKeyKeyL = "sender_key"_ls; -static const auto DeviceIdKeyL = "device_id"_ls; -static const auto SessionIdKeyL = "session_id"_ls; +inline const auto CiphertextKeyL = "ciphertext"_ls; +inline const auto SenderKeyKeyL = "sender_key"_ls; +inline const auto DeviceIdKeyL = "device_id"_ls; +inline const auto SessionIdKeyL = "session_id"_ls; -static const auto AlgorithmKeyL = "algorithm"_ls; -static const auto RotationPeriodMsKeyL = "rotation_period_ms"_ls; -static const auto RotationPeriodMsgsKeyL = "rotation_period_msgs"_ls; +inline const auto AlgorithmKeyL = "algorithm"_ls; +inline const auto RotationPeriodMsKeyL = "rotation_period_ms"_ls; +inline const auto RotationPeriodMsgsKeyL = "rotation_period_msgs"_ls; -static const auto AlgorithmKey = QStringLiteral("algorithm"); -static const auto RotationPeriodMsKey = QStringLiteral("rotation_period_ms"); -static const auto RotationPeriodMsgsKey = +inline const auto AlgorithmKey = QStringLiteral("algorithm"); +inline const auto RotationPeriodMsKey = QStringLiteral("rotation_period_ms"); +inline const auto RotationPeriodMsgsKey = QStringLiteral("rotation_period_msgs"); -static const auto Ed25519Key = QStringLiteral("ed25519"); -static const auto Curve25519Key = QStringLiteral("curve25519"); -static const auto SignedCurve25519Key = QStringLiteral("signed_curve25519"); -static const auto OlmV1Curve25519AesSha2AlgoKey = +inline const auto Ed25519Key = QStringLiteral("ed25519"); +inline const auto Curve25519Key = QStringLiteral("curve25519"); +inline const auto SignedCurve25519Key = QStringLiteral("signed_curve25519"); +inline const auto OlmV1Curve25519AesSha2AlgoKey = QStringLiteral("m.olm.v1.curve25519-aes-sha2"); -static const auto MegolmV1AesSha2AlgoKey = +inline const auto MegolmV1AesSha2AlgoKey = QStringLiteral("m.megolm.v1.aes-sha2"); -static const QStringList SupportedAlgorithms = { OlmV1Curve25519AesSha2AlgoKey, +inline const QStringList SupportedAlgorithms = { OlmV1Curve25519AesSha2AlgoKey, MegolmV1AesSha2AlgoKey }; } // namespace Quotient -- cgit v1.2.3