mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 22:35:52 +01:00
WIP: verification: add log of master key
Signed-off-by: Sumner Evans <sumner@beeper.com>
This commit is contained in:
parent
bb6c88faf3
commit
bcd01e0a3f
1 changed files with 7 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ package verificationhelper
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
|
||||
"golang.org/x/exp/slices"
|
||||
|
|
@ -60,8 +61,7 @@ func (vh *VerificationHelper) HandleScannedQRData(ctx context.Context, data []by
|
|||
}
|
||||
|
||||
// Verify the master key is correct
|
||||
crossSigningPubkeys := vh.mach.GetOwnCrossSigningPublicKeys(ctx)
|
||||
if bytes.Equal(crossSigningPubkeys.MasterKey.Bytes(), qrCode.Key1[:]) {
|
||||
if bytes.Equal(vh.mach.GetOwnCrossSigningPublicKeys(ctx).MasterKey.Bytes(), qrCode.Key1[:]) {
|
||||
log.Info().Msg("Verified that the other device has the same master key")
|
||||
} else {
|
||||
return fmt.Errorf("the master key does not match")
|
||||
|
|
@ -100,6 +100,11 @@ func (vh *VerificationHelper) HandleScannedQRData(ctx context.Context, data []by
|
|||
}
|
||||
|
||||
// Verify that what they think the master key is is correct.
|
||||
log.Info().
|
||||
Stringer("master_key", vh.mach.GetOwnCrossSigningPublicKeys(ctx).MasterKey).
|
||||
Str("key2", base64.StdEncoding.EncodeToString(qrCode.Key2[:])).
|
||||
Msg("verifying master key")
|
||||
|
||||
if bytes.Equal(vh.mach.GetOwnCrossSigningPublicKeys(ctx).MasterKey.Bytes(), qrCode.Key2[:]) {
|
||||
log.Info().Msg("Verified that the other device has the correct master key")
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue