fixup! (DO NOT MERGE) crypto: allow run goolm side-by-side with libolm
Some checks failed
Go / Lint (latest) (push) Has been cancelled
Go / Build (old, libolm) (push) Has been cancelled
Go / Build (latest, libolm) (push) Has been cancelled
Go / Build (old, goolm) (push) Has been cancelled
Go / Build (latest, goolm) (push) Has been cancelled

Signed-off-by: Sumner Evans <me@sumnerevans.com>
This commit is contained in:
Sumner Evans 2025-08-02 11:17:41 -06:00
commit a8730c9adf
No known key found for this signature in database
GPG key ID: 8904527AB50022FD
2 changed files with 6 additions and 10 deletions

View file

@ -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
}

View file

@ -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)