mautrix-go/crypto/keyexport_test.go
Tulir Asokan 72f6229f40
Some checks are pending
Go / Lint (latest) (push) Waiting to run
Go / Build (old, libolm) (push) Waiting to run
Go / Build (latest, libolm) (push) Waiting to run
Go / Build (old, goolm) (push) Waiting to run
Go / Build (latest, goolm) (push) Waiting to run
crypto: fix key export test
2025-05-06 23:18:23 +03:00

35 lines
850 B
Go

// Copyright (c) 2024 Tulir Asokan
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package crypto_test
import (
"testing"
"github.com/stretchr/testify/assert"
"go.mau.fi/util/exerrors"
"go.mau.fi/util/exfmt"
"maunium.net/go/mautrix/crypto"
"maunium.net/go/mautrix/crypto/olm"
)
func TestExportKeys(t *testing.T) {
acc := crypto.NewOlmAccount()
sess := exerrors.Must(crypto.NewInboundGroupSession(
acc.IdentityKey(),
acc.SigningKey(),
"!room:example.com",
exerrors.Must(olm.NewOutboundGroupSession()).Key(),
7*exfmt.Day,
100,
false,
))
data, err := crypto.ExportKeys("meow", []*crypto.InboundGroupSession{sess})
assert.NoError(t, err)
assert.Len(t, data, 836)
}