Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
Fix tests (note: tests are still failing due to prekey null thing)
Browse files Browse the repository at this point in the history
  • Loading branch information
smweber committed Jul 26, 2023
1 parent b0bd6e8 commit d1a2146
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pkg/libsignalgo/inmemorystore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,24 @@ func (ps *InMemorySignalProtocolStore) GetLocalRegistrationID(ctx context.Contex
return ps.registrationID, nil
}

func (ps *InMemorySignalProtocolStore) SaveIdentityKey(address *libsignalgo.Address, identityKey *libsignalgo.IdentityKey, ctx context.Context) error {
func (ps *InMemorySignalProtocolStore) SaveIdentityKey(address *libsignalgo.Address, identityKey *libsignalgo.IdentityKey, ctx context.Context) (bool, error) {
log.Debug().Msg("SaveIdentityKey called")
name, err := address.Name()
if err != nil {
return err
return false, err
}
deviceID, err := address.DeviceID()
if err != nil {
return err
return false, err
}
replacing := false
oldKey := ps.identityKeyMap[AddressKey{name, deviceID}]
if oldKey != nil {
keysMatch, _ := oldKey.Equal(identityKey)
replacing = !keysMatch
}
ps.identityKeyMap[AddressKey{name, deviceID}] = identityKey
return err
return replacing, err
}

func (ps *InMemorySignalProtocolStore) GetIdentityKey(address *libsignalgo.Address, ctx context.Context) (*libsignalgo.IdentityKey, error) {
Expand Down

0 comments on commit d1a2146

Please sign in to comment.