diff --git a/go.mod b/go.mod index e40e63bf..a19af8f3 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( github.com/uptrace/bun/driver/pgdriver v1.1.16 github.com/waku-org/go-waku v0.8.0 github.com/xmtp/go-msgio v0.2.1-0.20220510223757-25a701b79cd3 - github.com/xmtp/proto/v3 v3.32.1-0.20231026053711-5efc208e3135 + github.com/xmtp/proto/v3 v3.36.1-0.20231219054634-2ff03b7d5090 github.com/yoheimuta/protolint v0.39.0 go.uber.org/zap v1.24.0 golang.org/x/sync v0.3.0 diff --git a/go.sum b/go.sum index 7ce0b101..6afd506a 100644 --- a/go.sum +++ b/go.sum @@ -1164,6 +1164,8 @@ github.com/xmtp/proto/v3 v3.29.1-0.20231025220423-87413e63f3ab h1:hWBftgxB7QWXDO github.com/xmtp/proto/v3 v3.29.1-0.20231025220423-87413e63f3ab/go.mod h1:NF2zAjtNpVIhS4tFG19g4L1tJcPZHm81oeDFXltmOiY= github.com/xmtp/proto/v3 v3.32.1-0.20231026053711-5efc208e3135 h1:MpeptLshF0T8ikwmVQI1mnlp5fXkbyUc+9FpyzFdsbo= github.com/xmtp/proto/v3 v3.32.1-0.20231026053711-5efc208e3135/go.mod h1:NF2zAjtNpVIhS4tFG19g4L1tJcPZHm81oeDFXltmOiY= +github.com/xmtp/proto/v3 v3.36.1-0.20231219054634-2ff03b7d5090 h1:+0KTgQiUfu5UxgLjP18VL4BtG6hJMJYL0n1mVXtf3Ss= +github.com/xmtp/proto/v3 v3.36.1-0.20231219054634-2ff03b7d5090/go.mod h1:NF2zAjtNpVIhS4tFG19g4L1tJcPZHm81oeDFXltmOiY= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/yoheimuta/go-protoparser/v4 v4.6.0 h1:uvz1e9/5Ihsm4Ku8AJeDImTpirKmIxubZdSn0QJNdnw= github.com/yoheimuta/go-protoparser/v4 v4.6.0/go.mod h1:AHNNnSWnb0UoL4QgHPiOAg2BniQceFscPI5X/BZNHl8= diff --git a/pkg/api/message/v3/service.go b/pkg/api/message/v3/service.go index e3d4140d..3c1a6154 100644 --- a/pkg/api/message/v3/service.go +++ b/pkg/api/message/v3/service.go @@ -54,10 +54,10 @@ func (s *Service) RegisterInstallation(ctx context.Context, req *proto.RegisterI } installationId := results[0].InstallationId - walletAddress := results[0].WalletAddress + accountAddress := results[0].AccountAddress credentialIdentity := results[0].CredentialIdentity - if err = s.mlsStore.CreateInstallation(ctx, installationId, walletAddress, req.LastResortKeyPackage.KeyPackageTlsSerialized, credentialIdentity); err != nil { + if err = s.mlsStore.CreateInstallation(ctx, installationId, accountAddress, req.LastResortKeyPackage.KeyPackageTlsSerialized, credentialIdentity); err != nil { return nil, err } @@ -203,15 +203,15 @@ func (s *Service) GetIdentityUpdates(ctx context.Context, req *proto.GetIdentity return nil, err } - walletAddresses := req.WalletAddresses - updates, err := s.mlsStore.GetIdentityUpdates(ctx, req.WalletAddresses, int64(req.StartTimeNs)) + accountAddresses := req.AccountAddresses + updates, err := s.mlsStore.GetIdentityUpdates(ctx, req.AccountAddresses, int64(req.StartTimeNs)) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get identity updates: %s", err) } - resUpdates := make([]*proto.GetIdentityUpdatesResponse_WalletUpdates, len(walletAddresses)) - for i, walletAddress := range walletAddresses { - walletUpdates := updates[walletAddress] + resUpdates := make([]*proto.GetIdentityUpdatesResponse_WalletUpdates, len(accountAddresses)) + for i, accountAddress := range accountAddresses { + walletUpdates := updates[accountAddress] resUpdates[i] = &proto.GetIdentityUpdatesResponse_WalletUpdates{ Updates: []*proto.GetIdentityUpdatesResponse_Update{}, @@ -289,7 +289,7 @@ func validateUploadKeyPackagesRequest(req *proto.UploadKeyPackagesRequest) error } func validateGetIdentityUpdatesRequest(req *proto.GetIdentityUpdatesRequest) error { - if req == nil || len(req.WalletAddresses) == 0 { + if req == nil || len(req.AccountAddresses) == 0 { return status.Errorf(codes.InvalidArgument, "no wallet addresses to get updates for") } return nil diff --git a/pkg/api/message/v3/service_test.go b/pkg/api/message/v3/service_test.go index a2d61679..ec068399 100644 --- a/pkg/api/message/v3/service_test.go +++ b/pkg/api/message/v3/service_test.go @@ -43,11 +43,11 @@ func newMockedValidationService() *mockedMLSValidationService { return new(mockedMLSValidationService) } -func (m *mockedMLSValidationService) mockValidateKeyPackages(installationId []byte, walletAddress string) *mock.Call { +func (m *mockedMLSValidationService) mockValidateKeyPackages(installationId []byte, accountAddress string) *mock.Call { return m.On("ValidateKeyPackages", mock.Anything, mock.Anything).Return([]mlsvalidate.IdentityValidationResult{ { InstallationId: installationId, - WalletAddress: walletAddress, + AccountAddress: accountAddress, CredentialIdentity: []byte("test"), }, }, nil) @@ -97,9 +97,9 @@ func TestRegisterInstallation(t *testing.T) { defer cleanup() installationId := test.RandomBytes(32) - walletAddress := test.RandomString(32) + accountAddress := test.RandomString(32) - mlsValidationService.mockValidateKeyPackages(installationId, walletAddress) + mlsValidationService.mockValidateKeyPackages(installationId, accountAddress) res, err := svc.RegisterInstallation(ctx, &proto.RegisterInstallationRequest{ LastResortKeyPackage: &proto.KeyPackageUpload{ @@ -115,7 +115,7 @@ func TestRegisterInstallation(t *testing.T) { require.NoError(t, err) require.Len(t, installations, 1) - require.Equal(t, walletAddress, installations[0].WalletAddress) + require.Equal(t, accountAddress, installations[0].WalletAddress) } func TestRegisterInstallationError(t *testing.T) { @@ -140,9 +140,9 @@ func TestUploadKeyPackages(t *testing.T) { defer cleanup() installationId := test.RandomBytes(32) - walletAddress := test.RandomString(32) + accountAddress := test.RandomString(32) - mlsValidationService.mockValidateKeyPackages(installationId, walletAddress) + mlsValidationService.mockValidateKeyPackages(installationId, accountAddress) res, err := svc.RegisterInstallation(ctx, &proto.RegisterInstallationRequest{ LastResortKeyPackage: &proto.KeyPackageUpload{ @@ -172,9 +172,9 @@ func TestConsumeKeyPackages(t *testing.T) { defer cleanup() installationId1 := test.RandomBytes(32) - walletAddress1 := test.RandomString(32) + accountAddress1 := test.RandomString(32) - mockCall := mlsValidationService.mockValidateKeyPackages(installationId1, walletAddress1) + mockCall := mlsValidationService.mockValidateKeyPackages(installationId1, accountAddress1) res, err := svc.RegisterInstallation(ctx, &proto.RegisterInstallationRequest{ LastResortKeyPackage: &proto.KeyPackageUpload{ @@ -186,10 +186,10 @@ func TestConsumeKeyPackages(t *testing.T) { // Add a second key package installationId2 := test.RandomBytes(32) - walletAddress2 := test.RandomString(32) + accountAddress2 := test.RandomString(32) // Unset the original mock so we can set a new one mockCall.Unset() - mlsValidationService.mockValidateKeyPackages(installationId2, walletAddress2) + mlsValidationService.mockValidateKeyPackages(installationId2, accountAddress2) res, err = svc.RegisterInstallation(ctx, &proto.RegisterInstallationRequest{ LastResortKeyPackage: &proto.KeyPackageUpload{ @@ -268,9 +268,9 @@ func TestGetIdentityUpdates(t *testing.T) { defer cleanup() installationId := test.RandomBytes(32) - walletAddress := test.RandomString(32) + accountAddress := test.RandomString(32) - mockCall := mlsValidationService.mockValidateKeyPackages(installationId, walletAddress) + mockCall := mlsValidationService.mockValidateKeyPackages(installationId, accountAddress) _, err := svc.RegisterInstallation(ctx, &proto.RegisterInstallationRequest{ LastResortKeyPackage: &proto.KeyPackageUpload{ @@ -280,7 +280,7 @@ func TestGetIdentityUpdates(t *testing.T) { require.NoError(t, err) identityUpdates, err := svc.GetIdentityUpdates(ctx, &proto.GetIdentityUpdatesRequest{ - WalletAddresses: []string{walletAddress}, + AccountAddresses: []string{accountAddress}, }) require.NoError(t, err) require.NotNil(t, identityUpdates) @@ -295,7 +295,7 @@ func TestGetIdentityUpdates(t *testing.T) { } mockCall.Unset() - mlsValidationService.mockValidateKeyPackages(test.RandomBytes(32), walletAddress) + mlsValidationService.mockValidateKeyPackages(test.RandomBytes(32), accountAddress) _, err = svc.RegisterInstallation(ctx, &proto.RegisterInstallationRequest{ LastResortKeyPackage: &proto.KeyPackageUpload{ KeyPackageTlsSerialized: []byte("test"), @@ -304,7 +304,7 @@ func TestGetIdentityUpdates(t *testing.T) { require.NoError(t, err) identityUpdates, err = svc.GetIdentityUpdates(ctx, &proto.GetIdentityUpdatesRequest{ - WalletAddresses: []string{walletAddress}, + AccountAddresses: []string{accountAddress}, }) require.NoError(t, err) require.Len(t, identityUpdates.Updates, 1) diff --git a/pkg/mlsvalidate/service.go b/pkg/mlsvalidate/service.go index 686e533e..bdf0679b 100644 --- a/pkg/mlsvalidate/service.go +++ b/pkg/mlsvalidate/service.go @@ -10,7 +10,7 @@ import ( ) type IdentityValidationResult struct { - WalletAddress string + AccountAddress string InstallationId []byte CredentialIdentity []byte } @@ -55,7 +55,7 @@ func (s *MLSValidationServiceImpl) ValidateKeyPackages(ctx context.Context, keyP return nil, fmt.Errorf("validation failed with error %s", response.ErrorMessage) } out[i] = IdentityValidationResult{ - WalletAddress: response.WalletAddress, + AccountAddress: response.AccountAddress, InstallationId: response.InstallationId, CredentialIdentity: response.CredentialIdentityBytes, } diff --git a/pkg/mlsvalidate/service_test.go b/pkg/mlsvalidate/service_test.go index 9613eb98..33b5cb95 100644 --- a/pkg/mlsvalidate/service_test.go +++ b/pkg/mlsvalidate/service_test.go @@ -42,7 +42,7 @@ func TestValidateKeyPackages(t *testing.T) { firstResponse := svc.ValidateKeyPackagesResponse_ValidationResponse{ IsOk: true, - WalletAddress: "0x123", + AccountAddress: "0x123", InstallationId: []byte("123"), CredentialIdentityBytes: []byte("456"), ErrorMessage: "", @@ -55,7 +55,7 @@ func TestValidateKeyPackages(t *testing.T) { res, err := service.ValidateKeyPackages(ctx, nil) assert.NoError(t, err) assert.Equal(t, 1, len(res)) - assert.Equal(t, "0x123", res[0].WalletAddress) + assert.Equal(t, "0x123", res[0].AccountAddress) assert.Equal(t, []byte("123"), res[0].InstallationId) assert.Equal(t, []byte("456"), res[0].CredentialIdentity) }