feat(GODT-2801): Identity Service

Identity Service contains all the information related to user state,
addresses and keys.

This patch also introduces the `State` type which can be used by other
services to maintain their own copy of this state to avoid lock
contention.

Finally, there are currently no external facing methods via a CPC
interface. Those will added as needed once the refactoring of the
architecture is complete.
This commit is contained in:
Leander Beernaert
2023-07-21 16:33:35 +02:00
parent 11f6f84dd6
commit 040ddadb7a
6 changed files with 1007 additions and 1 deletions

View File

@ -0,0 +1,66 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/ProtonMail/proton-bridge/v3/internal/services/useridentity (interfaces: IdentityProvider)
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
reflect "reflect"
proton "github.com/ProtonMail/go-proton-api"
gomock "github.com/golang/mock/gomock"
)
// MockIdentityProvider is a mock of IdentityProvider interface.
type MockIdentityProvider struct {
ctrl *gomock.Controller
recorder *MockIdentityProviderMockRecorder
}
// MockIdentityProviderMockRecorder is the mock recorder for MockIdentityProvider.
type MockIdentityProviderMockRecorder struct {
mock *MockIdentityProvider
}
// NewMockIdentityProvider creates a new mock instance.
func NewMockIdentityProvider(ctrl *gomock.Controller) *MockIdentityProvider {
mock := &MockIdentityProvider{ctrl: ctrl}
mock.recorder = &MockIdentityProviderMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockIdentityProvider) EXPECT() *MockIdentityProviderMockRecorder {
return m.recorder
}
// GetAddresses mocks base method.
func (m *MockIdentityProvider) GetAddresses(arg0 context.Context) ([]proton.Address, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetAddresses", arg0)
ret0, _ := ret[0].([]proton.Address)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// GetAddresses indicates an expected call of GetAddresses.
func (mr *MockIdentityProviderMockRecorder) GetAddresses(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAddresses", reflect.TypeOf((*MockIdentityProvider)(nil).GetAddresses), arg0)
}
// GetUser mocks base method.
func (m *MockIdentityProvider) GetUser(arg0 context.Context) (proton.User, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetUser", arg0)
ret0, _ := ret[0].(proton.User)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// GetUser indicates an expected call of GetUser.
func (mr *MockIdentityProviderMockRecorder) GetUser(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUser", reflect.TypeOf((*MockIdentityProvider)(nil).GetUser), arg0)
}