mirror of
https://github.com/mautrix/signal.git
synced 2025-03-14 14:15:36 +00:00
Make linting pass
This commit is contained in:
parent
6ea41df16f
commit
105a081a1b
7 changed files with 24 additions and 14 deletions
|
@ -11,6 +11,8 @@ repos:
|
|||
- repo: https://github.com/tekwizely/pre-commit-golang
|
||||
rev: v1.0.0-rc.1
|
||||
hooks:
|
||||
- id: go-imports-repo
|
||||
- id: go-imports
|
||||
exclude: "pb\\.go$"
|
||||
- id: go-vet-repo-mod
|
||||
- id: go-staticcheck-repo-mod
|
||||
#- id: go-staticcheck-repo-mod
|
||||
# TODO: reenable this and fix all the problems
|
||||
|
|
6
main.go
6
main.go
|
@ -186,16 +186,16 @@ func (br *SignalBridge) createPrivatePortalFromInvite(roomID id.RoomID, inviter
|
|||
if br.Config.Bridge.Encryption.Default || encryptionEnabled {
|
||||
_, err := intent.InviteUser(roomID, &mautrix.ReqInviteUser{UserID: br.Bot.UserID})
|
||||
if err != nil {
|
||||
portal.log.Warn().Msgf("Failed to invite bridge bot to enable e2be:", err)
|
||||
portal.log.Warn().Msgf("Failed to invite bridge bot to enable e2be: %v", err)
|
||||
}
|
||||
err = br.Bot.EnsureJoined(roomID)
|
||||
if err != nil {
|
||||
portal.log.Warn().Msgf("Failed to join as bridge bot to enable e2be:", err)
|
||||
portal.log.Warn().Msgf("Failed to join as bridge bot to enable e2be: %v", err)
|
||||
}
|
||||
if !encryptionEnabled {
|
||||
_, err = intent.SendStateEvent(roomID, event.StateEncryption, "", portal.getEncryptionEventContent())
|
||||
if err != nil {
|
||||
portal.log.Warn().Msgf("Failed to enable e2be:", err)
|
||||
portal.log.Warn().Msgf("Failed to enable e2be: %v", err)
|
||||
}
|
||||
}
|
||||
br.AS.StateStore.SetMembership(roomID, inviter.MXID, event.MembershipJoin)
|
||||
|
|
|
@ -46,8 +46,8 @@ func (pk *PrivateKey) Clone() (*PrivateKey, error) {
|
|||
|
||||
func (pk *PrivateKey) Destroy() error {
|
||||
return nil // TODO fix this
|
||||
runtime.SetFinalizer(pk, nil)
|
||||
return wrapError(C.signal_privatekey_destroy(pk.ptr))
|
||||
//runtime.SetFinalizer(pk, nil)
|
||||
//return wrapError(C.signal_privatekey_destroy(pk.ptr))
|
||||
}
|
||||
|
||||
func (pk *PrivateKey) GetPublicKey() (*PublicKey, error) {
|
||||
|
|
|
@ -28,9 +28,13 @@ func initializeSessions(t *testing.T, aliceStore, bobStore *InMemorySignalProtoc
|
|||
bobSignedPreKeyPublicSerialized, err := bobSignedPreKeyPublicKey.Serialize()
|
||||
assert.NoError(t, err)
|
||||
|
||||
bobIdentityKey, err := bobStore.GetIdentityKeyPair(ctx)
|
||||
bobIdentityKeyPair, err := bobStore.GetIdentityKeyPair(ctx)
|
||||
assert.NoError(t, err)
|
||||
bobSignedPreKeySignature, err := bobIdentityKey.GetPrivateKey().Sign(bobSignedPreKeyPublicSerialized)
|
||||
bobSignedPreKeySignature, err := bobIdentityKeyPair.GetPrivateKey().Sign(bobSignedPreKeyPublicSerialized)
|
||||
assert.NoError(t, err)
|
||||
|
||||
bobPublicIdentityKey := bobIdentityKeyPair.GetPublicKey()
|
||||
bobIdentityKey, err := libsignalgo.NewIdentityKeyFromPublicKey(bobPublicIdentityKey)
|
||||
assert.NoError(t, err)
|
||||
|
||||
var prekeyID uint32 = 4570
|
||||
|
@ -46,7 +50,7 @@ func initializeSessions(t *testing.T, aliceStore, bobStore *InMemorySignalProtoc
|
|||
signedPreKeyID,
|
||||
bobSignedPreKeyPublicKey,
|
||||
bobSignedPreKeySignature,
|
||||
bobIdentityKey.GetPublicKey(),
|
||||
bobIdentityKey,
|
||||
)
|
||||
assert.NoError(t, err)
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ func (sr *SessionRecord) Clone() (*SessionRecord, error) {
|
|||
|
||||
func (sr *SessionRecord) Destroy() error {
|
||||
return nil //TODO: fix double free
|
||||
runtime.SetFinalizer(sr, nil)
|
||||
return wrapError(C.signal_session_record_destroy(sr.ptr))
|
||||
//runtime.SetFinalizer(sr, nil)
|
||||
//return wrapError(C.signal_session_record_destroy(sr.ptr))
|
||||
}
|
||||
|
||||
func (sr *SessionRecord) ArchiveCurrentState() error {
|
||||
|
|
|
@ -67,6 +67,10 @@ func GenerateAndRegisterPreKeys(device *Device, uuidKind UUIDKind) error {
|
|||
signedId, err := signedPreKey.GetID()
|
||||
err = device.PreKeyStoreExtras.MarkSignedPreKeysAsUploaded(uuidKind, signedId)
|
||||
|
||||
if err != nil {
|
||||
log.Printf("Error marking prekeys as uploaded: %v", err)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -139,12 +139,12 @@ func (portal *Portal) UpdateBridgeInfo() {
|
|||
stateKey, content := portal.getBridgeInfo()
|
||||
_, err := portal.MainIntent().SendStateEvent(portal.MXID, event.StateBridge, stateKey, content)
|
||||
if err != nil {
|
||||
portal.log.Warn().Msgf("Failed to update m.bridge:", err)
|
||||
portal.log.Warn().Msgf("Failed to update m.bridge: %v", err)
|
||||
}
|
||||
// TODO remove this once https://github.com/matrix-org/matrix-doc/pull/2346 is in spec
|
||||
_, err = portal.MainIntent().SendStateEvent(portal.MXID, event.StateHalfShotBridge, stateKey, content)
|
||||
if err != nil {
|
||||
portal.log.Warn().Msgf("Failed to update uk.half-shot.bridge:", err)
|
||||
portal.log.Warn().Msgf("Failed to update uk.half-shot.bridge: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue