Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
nheko
Commits
cd43147b
Commit
cd43147b
authored
4 years ago
by
Nicolas Werner
Browse files
Options
Downloads
Patches
Plain Diff
Implement signature upload for own master key
parent
7b6fab33
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CMakeLists.txt
+1
-1
1 addition, 1 deletion
CMakeLists.txt
io.github.NhekoReborn.Nheko.json
+1
-1
1 addition, 1 deletion
io.github.NhekoReborn.Nheko.json
src/Cache.cpp
+1
-0
1 addition, 0 deletions
src/Cache.cpp
src/DeviceVerificationFlow.cpp
+49
-0
49 additions, 0 deletions
src/DeviceVerificationFlow.cpp
with
52 additions
and
2 deletions
CMakeLists.txt
+
1
−
1
View file @
cd43147b
...
...
@@ -341,7 +341,7 @@ if(USE_BUNDLED_MTXCLIENT)
FetchContent_Declare
(
MatrixClient
GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git
GIT_TAG
f84611f129b46746a4b586acaba54fc31a303bc6
GIT_TAG
ad5575bc24089dc385e97d9ace026414b618775c
)
FetchContent_MakeAvailable
(
MatrixClient
)
else
()
...
...
This diff is collapsed.
Click to expand it.
io.github.NhekoReborn.Nheko.json
+
1
−
1
View file @
cd43147b
...
...
@@ -146,7 +146,7 @@
"name"
:
"mtxclient"
,
"sources"
:
[
{
"commit"
:
"
f84611f129b46746a4b586acaba54fc31a303bc6
"
,
"commit"
:
"
ad5575bc24089dc385e97d9ace026414b618775c
"
,
"type"
:
"git"
,
"url"
:
"https://github.com/Nheko-Reborn/mtxclient.git"
}
...
...
This diff is collapsed.
Click to expand it.
src/Cache.cpp
+
1
−
0
View file @
cd43147b
...
...
@@ -3591,6 +3591,7 @@ init(const QString &user_id)
qRegisterMetaType
<
QMap
<
QString
,
RoomInfo
>>
();
qRegisterMetaType
<
std
::
map
<
QString
,
RoomInfo
>>
();
qRegisterMetaType
<
std
::
map
<
QString
,
mtx
::
responses
::
Timeline
>>
();
qRegisterMetaType
<
mtx
::
responses
::
QueryKeys
>
();
instance_
=
std
::
make_unique
<
Cache
>
(
user_id
);
}
...
...
This diff is collapsed.
Click to expand it.
src/DeviceVerificationFlow.cpp
+
49
−
0
View file @
cd43147b
...
...
@@ -234,6 +234,55 @@ DeviceVerificationFlow::DeviceVerificationFlow(QObject *,
}
if
(
msg
.
keys
==
macs
.
keys
)
{
mtx
::
requests
::
KeySignaturesUpload
req
;
if
(
utils
::
localUser
().
toStdString
()
==
this
->
toClient
.
to_string
())
{
// self verification, sign master key with device key, if we
// verified it
for
(
const
auto
&
mac
:
msg
.
mac
)
{
if
(
their_keys
.
master_keys
.
keys
.
count
(
mac
.
first
))
{
json
j
=
their_keys
.
master_keys
;
j
.
erase
(
"signatures"
);
j
.
erase
(
"unsigned"
);
mtx
::
crypto
::
CrossSigningKeys
master_key
=
j
;
master_key
.
signatures
[
utils
::
localUser
().
toStdString
()]
[
"ed25519:"
+
http
::
client
()
->
device_id
()]
=
olm
::
client
()
->
sign_message
(
j
.
dump
());
req
.
signatures
[
utils
::
localUser
().
toStdString
()]
[
master_key
.
keys
.
at
(
mac
.
first
)]
=
master_key
;
}
}
// TODO(Nico): Sign their device key with self signing key
}
else
{
// TODO(Nico): Sign their master key with user signing key
}
if
(
!
req
.
signatures
.
empty
())
{
http
::
client
()
->
keys_signatures_upload
(
req
,
[](
const
mtx
::
responses
::
KeySignaturesUpload
&
res
,
mtx
::
http
::
RequestErr
err
)
{
if
(
err
)
{
nhlog
::
net
()
->
error
(
"failed to upload signatures: {},{}"
,
err
->
matrix_error
.
errcode
,
static_cast
<
int
>
(
err
->
status_code
));
}
for
(
const
auto
&
[
user_id
,
tmp
]
:
res
.
errors
)
for
(
const
auto
&
[
key_id
,
e
]
:
tmp
)
nhlog
::
net
()
->
error
(
"signature error for user {} and key "
"id {}: {}, {}"
,
user_id
,
key_id
,
e
.
errcode
,
e
.
error
);
});
}
this
->
isMacVerified
=
true
;
this
->
acceptDevice
();
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment