libQuotient
A Qt library for building matrix clients
qolmutility.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
2
//
3
// SPDX-License-Identifier: LGPL-2.1-or-later
4
5
#
pragma
once
6
7
#
include
<
Quotient
/
util
.
h
>
8
9
#
include
<
olm
/
error
.
h
>
10
11
struct
OlmUtility;
12
13
namespace
Quotient {
14
15
//! Allows you to make use of crytographic hashing via SHA-2 and
16
//! verifying ed25519 signatures.
17
class
QUOTIENT_API
QOlmUtility
18
{
19
public
:
20
QOlmUtility();
21
22
//! Returns a sha256 of the supplied byte slice.
23
QString sha256Bytes(
const
QByteArray& inputBuf)
const
;
24
25
//! Convenience function that converts the UTF-8 message
26
//! to bytes and then calls `sha256Bytes()`, returning its output.
27
QString sha256Utf8Msg(
const
QString& message)
const
;
28
29
//! Verify a ed25519 signature.
30
//! \param key QByteArray The public part of the ed25519 key that signed the message.
31
//! \param message QByteArray The message that was signed.
32
//! \param signature QByteArray The signature of the message.
33
bool
ed25519Verify(
const
QByteArray& key,
const
QByteArray& message,
34
QByteArray signature)
const
;
35
36
OlmErrorCode lastErrorCode()
const
;
37
const
char
* lastError()
const
;
38
39
private
:
40
CStructPtr<OlmUtility> olmDataHolder;
41
};
42
}
// namespace Quotient
Quotient
e2ee
qolmutility.h
Generated by
1.9.1