crypto: log active driver

This commit is contained in:
Tulir Asokan 2025-09-11 14:12:35 +03:00
commit 69869f7cb5
4 changed files with 8 additions and 0 deletions

View file

@ -16,6 +16,8 @@ import (
)
func init() {
olm.Driver = "goolm"
olm.GetVersion = func() (major, minor, patch uint8) {
return 3, 2, 15
}

View file

@ -12,6 +12,8 @@ import (
var pickleKey = []byte("maunium.net/go/mautrix/crypto/olm")
func init() {
olm.Driver = "libolm"
olm.GetVersion = func() (major, minor, patch uint8) {
C.olm_get_library_version(
(*C.uint8_t)(unsafe.Pointer(&major)),

View file

@ -19,6 +19,7 @@ import (
"go.mau.fi/util/exzerolog"
"maunium.net/go/mautrix"
"maunium.net/go/mautrix/crypto/olm"
"maunium.net/go/mautrix/crypto/ssss"
"maunium.net/go/mautrix/event"
"maunium.net/go/mautrix/id"
@ -159,6 +160,7 @@ func (mach *OlmMachine) Load(ctx context.Context) (err error) {
zerolog.Ctx(ctx).Debug().
Str("machine_ptr", fmt.Sprintf("%p", mach)).
Str("account_ptr", fmt.Sprintf("%p", mach.account.Internal)).
Str("olm_driver", olm.Driver).
Msg("Loaded olm account")
return nil
}

View file

@ -87,6 +87,8 @@ type Account interface {
RemoveOneTimeKeys(s Session) error
}
var Driver = "none"
var InitBlankAccount func() Account
var InitNewAccount func() (Account, error)
var InitNewAccountFromPickled func(pickled, key []byte) (Account, error)