mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
fixup! (DO NOT MERGE) crypto: allow run goolm side-by-side with libolm
Some checks failed
Some checks failed
Signed-off-by: Sumner Evans <me@sumnerevans.com>
This commit is contained in:
parent
63d6d1715b
commit
a8730c9adf
2 changed files with 6 additions and 10 deletions
|
|
@ -413,8 +413,10 @@ func (store *SQLCryptoStore) GetGroupSession(ctx context.Context, roomID id.Room
|
|||
Reason: withheldReason.String,
|
||||
}
|
||||
}
|
||||
fmt.Printf("got here 1\n")
|
||||
libolmIgs, goolmIgs, chains, rs, err := store.postScanInboundGroupSession(sessionBytes, ratchetSafetyBytes, forwardingChains.String)
|
||||
if err != nil {
|
||||
fmt.Printf("got here 2 %+v\n", err)
|
||||
return nil, err
|
||||
}
|
||||
return &InboundGroupSession{
|
||||
|
|
@ -527,7 +529,7 @@ func (store *SQLCryptoStore) GetWithheldGroupSession(ctx context.Context, roomID
|
|||
|
||||
func (store *SQLCryptoStore) postScanInboundGroupSession(sessionBytes, ratchetSafetyBytes []byte, forwardingChains string) (igs olm.InboundGroupSession, igsGoolm olm.InboundGroupSession, chains []string, safety RatchetSafety, err error) {
|
||||
igs = libolm.NewBlankInboundGroupSession()
|
||||
err = igs.Unpickle(sessionBytes, store.PickleKey)
|
||||
err = igs.Unpickle(bytes.Clone(sessionBytes), store.PickleKey)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,9 +158,7 @@ func TestStoreMegolmSession(t *testing.T) {
|
|||
acc := NewOlmAccount()
|
||||
|
||||
internal, err := libolm.InboundGroupSessionFromPickled([]byte(groupSession), []byte("test"))
|
||||
if err != nil {
|
||||
t.Fatalf("Error creating internal inbound group session: %v", err)
|
||||
}
|
||||
require.NoError(t, err, "Error creating internal inbound group session")
|
||||
|
||||
internalGoolm, err := session.MegolmInboundSessionFromPickled([]byte(groupSession), []byte("test"))
|
||||
require.NoError(t, err)
|
||||
|
|
@ -174,14 +172,10 @@ func TestStoreMegolmSession(t *testing.T) {
|
|||
}
|
||||
|
||||
err = store.PutGroupSession(context.TODO(), igs)
|
||||
if err != nil {
|
||||
t.Errorf("Error storing inbound group session: %v", err)
|
||||
}
|
||||
require.NoError(t, err, "Error storing inbound group session")
|
||||
|
||||
retrieved, err := store.GetGroupSession(context.TODO(), "room1", igs.ID())
|
||||
if err != nil {
|
||||
t.Errorf("Error retrieving inbound group session: %v", err)
|
||||
}
|
||||
require.NoError(t, err, "Error retrieving inbound group session")
|
||||
|
||||
pickled, err := retrieved.InternalLibolm.Pickle([]byte("test"))
|
||||
require.NoError(t, err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue