diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 96e9acc6..c0d8bbf5 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -10,7 +10,7 @@ permissions: contents: write pull-requests: write statuses: write - + jobs: cla-check: uses: anyproto/open/.github/workflows/cla.yml@main diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index db553ef2..d0a0f751 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -3,75 +3,13 @@ on: branches: - main +name: coverage + permissions: contents: write pull-requests: write jobs: - test: - runs-on: ubuntu-latest - strategy: - matrix: - go-version: - - '1.21' - env: - GOPRIVATE: github.com/anyproto - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 - with: - go-version: '${{ matrix.go-version }}' - check-latest: true - - - name: git config - run: git config --global url.https://${{ secrets.ANYTYPE_PAT }}@github.com/.insteadOf https://github.com/ - - - name: Setup license repository - uses: actions/checkout@master - with: - repository: anyproto/open - ref: refs/heads/main - path: ./open - - name: Check licenses - run: | - cd open - python3 tools/generate.py --platform golang - cd .. - sudo gem install license_finder - license_finder inherited_decisions add open/decisions.yml - license_finder --enabled-package-managers gomodules - - - name: deps - run: make deps - - - name: unit tests - run: make test - - - name: Quality Gate - Test coverage shall be above threshold - env: - TESTCOVERAGE_THRESHOLD: 0 - run: | - go test ./... -coverprofile coverage.out -covermode count - - generated_pattern='^\/\/ Code generated .* DO NOT EDIT\.$' - files_list=$(grep -rl "$generated_pattern" . | grep '\.go$' | sed 's/^\.\///') - - for file in $files_list; do - echo "Removing $file from coverage report" - grep -v "$file" coverage.out > temp_file - mv temp_file coverage.out - done - - go tool cover -func coverage.out - echo "Quality Gate: checking test coverage is above threshold ..." - echo "Threshold : $TESTCOVERAGE_THRESHOLD %" - totalCoverage=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+'` - echo "Current test coverage : $totalCoverage %" - if (( $(echo "$totalCoverage $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 > $2)}') )); then - echo "OK" - else - echo "Current test coverage is below threshold. Please add more unit tests or adjust threshold to a lower value." - echo "Failed" - exit 1 - fi - - uses: seriousben/go-patch-cover-action@v1 + release-reusable: + uses: anyproto/any-sync-node/.github/workflows/coverage-reusable.yml@main + secrets: inherit # pass all secrets diff --git a/Makefile b/Makefile index bec7eb0b..efb263a0 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,7 @@ proto: protoc --gogofaster_out=$(PKGMAP):. --go-drpc_out=protolib=github.com/gogo/protobuf:. commonfile/fileproto/protos/*.proto protoc --gogofaster_out=$(PKGMAP):. --go-drpc_out=protolib=github.com/gogo/protobuf:. net/streampool/testservice/protos/*.proto protoc --gogofaster_out=:. net/secureservice/handshake/handshakeproto/protos/*.proto + protoc --gogofaster_out=:. net/rpc/limiter/limiterproto/protos/*.proto protoc --gogofaster_out=$(PKGMAP):. --go-drpc_out=protolib=github.com/gogo/protobuf:. coordinator/coordinatorproto/protos/*.proto protoc --gogofaster_out=:. --go-drpc_out=protolib=github.com/gogo/protobuf:. consensus/consensusproto/protos/*.proto protoc --gogofaster_out=:. --go-drpc_out=protolib=github.com/gogo/protobuf:. commonspace/sync/synctestproto/protos/*.proto diff --git a/acl/acl.go b/acl/acl.go new file mode 100644 index 00000000..9f008e1b --- /dev/null +++ b/acl/acl.go @@ -0,0 +1,198 @@ +//go:generate mockgen -destination mock_acl/mock_acl.go github.com/anyproto/any-sync/acl AclService +package acl + +import ( + "context" + "errors" + "time" + + "github.com/prometheus/client_golang/prometheus" + + commonaccount "github.com/anyproto/any-sync/accountservice" + "github.com/anyproto/any-sync/app" + "github.com/anyproto/any-sync/app/logger" + "github.com/anyproto/any-sync/app/ocache" + "github.com/anyproto/any-sync/commonspace/object/acl/list" + "github.com/anyproto/any-sync/consensus/consensusclient" + "github.com/anyproto/any-sync/consensus/consensusproto" + "github.com/anyproto/any-sync/metric" + "github.com/anyproto/any-sync/util/crypto" +) + +const CName = "coordinator.acl" + +var log = logger.NewNamed(CName) + +var ErrLimitExceed = errors.New("limit exceed") + +type Limits struct { + ReadMembers uint32 + WriteMembers uint32 +} + +func New() AclService { + return &aclService{} +} + +type AclService interface { + AddRecord(ctx context.Context, spaceId string, rec *consensusproto.RawRecord, limits Limits) (result *consensusproto.RawRecordWithId, err error) + RecordsAfter(ctx context.Context, spaceId, aclHead string) (result []*consensusproto.RawRecordWithId, err error) + Permissions(ctx context.Context, identity crypto.PubKey, spaceId string) (res list.AclPermissions, err error) + OwnerPubKey(ctx context.Context, spaceId string) (ownerIdentity crypto.PubKey, err error) + ReadState(ctx context.Context, spaceId string, f func(s *list.AclState) error) (err error) + HasRecord(ctx context.Context, spaceId, recordId string) (has bool, err error) + app.ComponentRunnable +} + +type aclService struct { + consService consensusclient.Service + cache ocache.OCache + accountService commonaccount.Service +} + +func (as *aclService) Init(a *app.App) (err error) { + as.consService = app.MustComponent[consensusclient.Service](a) + as.accountService = app.MustComponent[commonaccount.Service](a) + + var metricReg *prometheus.Registry + if m := a.Component(metric.CName); m != nil { + metricReg = m.(metric.Metric).Registry() + } + as.cache = ocache.New(as.loadObject, + ocache.WithTTL(5*time.Minute), + ocache.WithLogger(log.Sugar()), + ocache.WithPrometheus(metricReg, "acl", ""), + ) + return +} + +func (as *aclService) Name() (name string) { + return CName +} + +func (as *aclService) loadObject(ctx context.Context, id string) (ocache.Object, error) { + return as.newAclObject(ctx, id) +} + +func (as *aclService) get(ctx context.Context, spaceId string) (list.AclList, error) { + obj, err := as.cache.Get(ctx, spaceId) + if err != nil { + return nil, err + } + aObj := obj.(*aclObject) + aObj.lastUsage.Store(time.Now()) + return aObj.AclList, nil +} + +func (as *aclService) AddRecord(ctx context.Context, spaceId string, rec *consensusproto.RawRecord, limits Limits) (result *consensusproto.RawRecordWithId, err error) { + if limits.ReadMembers <= 1 && limits.WriteMembers <= 1 { + return nil, ErrLimitExceed + } + + acl, err := as.get(ctx, spaceId) + if err != nil { + return nil, err + } + acl.RLock() + defer acl.RUnlock() + + var beforeReaders, beforeWriters int + for _, acc := range acl.AclState().CurrentAccounts() { + if !acc.Permissions.NoPermissions() { + beforeReaders++ + } + if acc.Permissions.CanWrite() { + beforeWriters++ + } + } + + err = acl.ValidateRawRecord(rec, func(state *list.AclState) error { + var readers, writers int + for _, acc := range state.CurrentAccounts() { + if acc.Permissions.NoPermissions() { + continue + } + readers++ + if acc.Permissions.CanWrite() { + writers++ + } + } + if readers > beforeReaders && uint32(readers) > limits.ReadMembers { + return ErrLimitExceed + } + if writers > beforeWriters && uint32(writers) > limits.WriteMembers { + return ErrLimitExceed + } + return nil + }) + if err != nil { + return + } + + return as.consService.AddRecord(ctx, spaceId, rec) +} + +func (as *aclService) RecordsAfter(ctx context.Context, spaceId, aclHead string) (result []*consensusproto.RawRecordWithId, err error) { + acl, err := as.get(ctx, spaceId) + if err != nil { + return nil, err + } + acl.RLock() + defer acl.RUnlock() + return acl.RecordsAfter(ctx, aclHead) +} + +func (as *aclService) OwnerPubKey(ctx context.Context, spaceId string) (ownerIdentity crypto.PubKey, err error) { + acl, err := as.get(ctx, spaceId) + if err != nil { + return + } + acl.RLock() + defer acl.RUnlock() + return acl.AclState().OwnerPubKey() +} + +func (as *aclService) Permissions(ctx context.Context, identity crypto.PubKey, spaceId string) (res list.AclPermissions, err error) { + acl, err := as.get(ctx, spaceId) + if err != nil { + return + } + acl.RLock() + defer acl.RUnlock() + return acl.AclState().Permissions(identity), nil +} + +func (as *aclService) ReadState(ctx context.Context, spaceId string, f func(s *list.AclState) error) (err error) { + acl, err := as.get(ctx, spaceId) + if err != nil { + return + } + acl.RLock() + defer acl.RUnlock() + return f(acl.AclState()) +} + +func (as *aclService) HasRecord(ctx context.Context, spaceId, recordId string) (has bool, err error) { + acl, err := as.get(ctx, spaceId) + if err != nil { + return + } + acl.RLock() + defer acl.RUnlock() + acl.Iterate(func(record *list.AclRecord) (isContinue bool) { + if record.Id == recordId { + has = true + return false + } + return true + }) + return +} + +func (as *aclService) Run(ctx context.Context) (err error) { + return +} + +func (as *aclService) Close(ctx context.Context) (err error) { + return as.cache.Close() +} diff --git a/acl/acl_test.go b/acl/acl_test.go new file mode 100644 index 00000000..e1764b3b --- /dev/null +++ b/acl/acl_test.go @@ -0,0 +1,237 @@ +package acl + +import ( + "context" + "errors" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" + + "github.com/anyproto/any-sync/app" + "github.com/anyproto/any-sync/commonspace/object/accountdata" + "github.com/anyproto/any-sync/commonspace/object/acl/list" + "github.com/anyproto/any-sync/consensus/consensusclient" + "github.com/anyproto/any-sync/consensus/consensusclient/mock_consensusclient" + "github.com/anyproto/any-sync/consensus/consensusproto" + "github.com/anyproto/any-sync/testutil/accounttest" +) + +var ctx = context.Background() + +func TestAclService_AddRecord(t *testing.T) { + ownerKeys, err := accountdata.NewRandom() + require.NoError(t, err) + spaceId := "spaceId" + ownerAcl, err := list.NewTestDerivedAcl(spaceId, ownerKeys) + require.NoError(t, err) + inv, err := ownerAcl.RecordBuilder().BuildInvite() + require.NoError(t, err) + + t.Run("success", func(t *testing.T) { + fx := newFixture(t) + defer fx.finish(t) + + expRes := list.WrapAclRecord(inv.InviteRec) + var watcherCh = make(chan consensusclient.Watcher) + fx.consCl.EXPECT().Watch(spaceId, gomock.Any()).DoAndReturn(func(spaceId string, w consensusclient.Watcher) error { + go func() { + w.AddConsensusRecords([]*consensusproto.RawRecordWithId{ + ownerAcl.Root(), + }) + watcherCh <- w + }() + return nil + }) + + fx.consCl.EXPECT().AddRecord(ctx, spaceId, inv.InviteRec).Return(expRes, nil) + fx.consCl.EXPECT().UnWatch(spaceId) + + res, err := fx.AddRecord(ctx, spaceId, inv.InviteRec, Limits{ + ReadMembers: 10, + WriteMembers: 10, + }) + assert.Equal(t, expRes, res) + assert.NoError(t, err) + + w := <-watcherCh + w.AddConsensusRecords([]*consensusproto.RawRecordWithId{ + expRes, + }) + }) + t.Run("error", func(t *testing.T) { + fx := newFixture(t) + defer fx.finish(t) + + var testErr = errors.New("test") + + fx.consCl.EXPECT().Watch(spaceId, gomock.Any()).DoAndReturn(func(spaceId string, w consensusclient.Watcher) error { + go func() { + w.AddConsensusError(testErr) + }() + return nil + }) + fx.consCl.EXPECT().UnWatch(spaceId) + + res, err := fx.AddRecord(ctx, spaceId, inv.InviteRec, Limits{ + ReadMembers: 10, + WriteMembers: 10, + }) + assert.Nil(t, res) + assert.EqualError(t, err, testErr.Error()) + }) + t.Run("limit exceed", func(t *testing.T) { + fx := newFixture(t) + defer fx.finish(t) + _, err := fx.AddRecord(ctx, spaceId, inv.InviteRec, Limits{ + ReadMembers: 1, + WriteMembers: 1, + }) + assert.ErrorIs(t, err, ErrLimitExceed) + }) +} + +func TestAclService_RecordsAfter(t *testing.T) { + ownerKeys, err := accountdata.NewRandom() + require.NoError(t, err) + spaceId := "spaceId" + ownerAcl, err := list.NewTestDerivedAcl(spaceId, ownerKeys) + require.NoError(t, err) + + fx := newFixture(t) + defer fx.finish(t) + + fx.consCl.EXPECT().Watch(spaceId, gomock.Any()).DoAndReturn(func(spaceId string, w consensusclient.Watcher) error { + go func() { + w.AddConsensusRecords([]*consensusproto.RawRecordWithId{ + ownerAcl.Root(), + }) + }() + return nil + }) + fx.consCl.EXPECT().UnWatch(spaceId) + + res, err := fx.RecordsAfter(ctx, spaceId, "") + require.NoError(t, err) + assert.Len(t, res, 1) +} + +func TestAclService(t *testing.T) { + ownerKeys, err := accountdata.NewRandom() + require.NoError(t, err) + spaceId := "spaceId" + ownerAcl, err := list.NewTestDerivedAcl(spaceId, ownerKeys) + require.NoError(t, err) + + fx := newFixture(t) + defer fx.finish(t) + + fx.consCl.EXPECT().Watch(spaceId, gomock.Any()).DoAndReturn(func(spaceId string, w consensusclient.Watcher) error { + go func() { + w.AddConsensusRecords([]*consensusproto.RawRecordWithId{ + ownerAcl.Root(), + }) + }() + return nil + }) + fx.consCl.EXPECT().UnWatch(spaceId) + + t.Run("permissions", func(t *testing.T) { + res, err := fx.Permissions(ctx, ownerKeys.SignKey.GetPublic(), spaceId) + require.NoError(t, err) + assert.True(t, res.IsOwner()) + }) + t.Run("ownerPubKey", func(t *testing.T) { + res, err := fx.OwnerPubKey(ctx, spaceId) + require.NoError(t, err) + assert.Equal(t, ownerKeys.SignKey.GetPublic().Account(), res.Account()) + }) +} + +func TestAclService_ReadState(t *testing.T) { + ownerKeys, err := accountdata.NewRandom() + require.NoError(t, err) + spaceId := "spaceId" + ownerAcl, err := list.NewTestDerivedAcl(spaceId, ownerKeys) + require.NoError(t, err) + + fx := newFixture(t) + defer fx.finish(t) + + fx.consCl.EXPECT().Watch(spaceId, gomock.Any()).DoAndReturn(func(spaceId string, w consensusclient.Watcher) error { + go func() { + w.AddConsensusRecords([]*consensusproto.RawRecordWithId{ + ownerAcl.Root(), + }) + }() + return nil + }) + fx.consCl.EXPECT().UnWatch(spaceId) + + require.NoError(t, fx.ReadState(ctx, spaceId, func(s *list.AclState) error { + assert.NotNil(t, s) + return nil + })) +} + +func TestAclService_HasRecord(t *testing.T) { + ownerKeys, err := accountdata.NewRandom() + require.NoError(t, err) + spaceId := "spaceId" + ownerAcl, err := list.NewTestDerivedAcl(spaceId, ownerKeys) + require.NoError(t, err) + + fx := newFixture(t) + defer fx.finish(t) + + fx.consCl.EXPECT().Watch(spaceId, gomock.Any()).DoAndReturn(func(spaceId string, w consensusclient.Watcher) error { + go func() { + w.AddConsensusRecords([]*consensusproto.RawRecordWithId{ + ownerAcl.Root(), + }) + }() + return nil + }) + fx.consCl.EXPECT().UnWatch(spaceId) + + has, err := fx.HasRecord(ctx, spaceId, ownerAcl.Root().Id) + require.NoError(t, err) + assert.True(t, has) + + has, err = fx.HasRecord(ctx, spaceId, "non-exists") + require.NoError(t, err) + assert.False(t, has) +} + +func newFixture(t *testing.T) *fixture { + ctrl := gomock.NewController(t) + fx := &fixture{ + a: new(app.App), + ctrl: ctrl, + consCl: mock_consensusclient.NewMockService(ctrl), + AclService: New(), + } + + fx.consCl.EXPECT().Name().Return(consensusclient.CName).AnyTimes() + fx.consCl.EXPECT().Init(gomock.Any()).AnyTimes() + fx.consCl.EXPECT().Run(gomock.Any()).AnyTimes() + fx.consCl.EXPECT().Close(gomock.Any()).AnyTimes() + + fx.a.Register(fx.consCl).Register(fx.AclService).Register(&accounttest.AccountTestService{}) + + require.NoError(t, fx.a.Start(ctx)) + return fx +} + +type fixture struct { + a *app.App + ctrl *gomock.Controller + consCl *mock_consensusclient.MockService + AclService +} + +func (fx *fixture) finish(t *testing.T) { + require.NoError(t, fx.a.Close(ctx)) + fx.ctrl.Finish() +} diff --git a/acl/mock_acl/mock_acl.go b/acl/mock_acl/mock_acl.go new file mode 100644 index 00000000..14db24ca --- /dev/null +++ b/acl/mock_acl/mock_acl.go @@ -0,0 +1,190 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/anyproto/any-sync/acl (interfaces: AclService) +// +// Generated by this command: +// +// mockgen -destination mock_acl/mock_acl.go github.com/anyproto/any-sync/acl AclService +// + +// Package mock_acl is a generated GoMock package. +package mock_acl + +import ( + context "context" + reflect "reflect" + + acl "github.com/anyproto/any-sync/acl" + app "github.com/anyproto/any-sync/app" + list "github.com/anyproto/any-sync/commonspace/object/acl/list" + consensusproto "github.com/anyproto/any-sync/consensus/consensusproto" + crypto "github.com/anyproto/any-sync/util/crypto" + gomock "go.uber.org/mock/gomock" +) + +// MockAclService is a mock of AclService interface. +type MockAclService struct { + ctrl *gomock.Controller + recorder *MockAclServiceMockRecorder +} + +// MockAclServiceMockRecorder is the mock recorder for MockAclService. +type MockAclServiceMockRecorder struct { + mock *MockAclService +} + +// NewMockAclService creates a new mock instance. +func NewMockAclService(ctrl *gomock.Controller) *MockAclService { + mock := &MockAclService{ctrl: ctrl} + mock.recorder = &MockAclServiceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAclService) EXPECT() *MockAclServiceMockRecorder { + return m.recorder +} + +// AddRecord mocks base method. +func (m *MockAclService) AddRecord(arg0 context.Context, arg1 string, arg2 *consensusproto.RawRecord, arg3 acl.Limits) (*consensusproto.RawRecordWithId, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddRecord", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*consensusproto.RawRecordWithId) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AddRecord indicates an expected call of AddRecord. +func (mr *MockAclServiceMockRecorder) AddRecord(arg0, arg1, arg2, arg3 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddRecord", reflect.TypeOf((*MockAclService)(nil).AddRecord), arg0, arg1, arg2, arg3) +} + +// Close mocks base method. +func (m *MockAclService) Close(arg0 context.Context) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Close", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Close indicates an expected call of Close. +func (mr *MockAclServiceMockRecorder) Close(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockAclService)(nil).Close), arg0) +} + +// HasRecord mocks base method. +func (m *MockAclService) HasRecord(arg0 context.Context, arg1, arg2 string) (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "HasRecord", arg0, arg1, arg2) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// HasRecord indicates an expected call of HasRecord. +func (mr *MockAclServiceMockRecorder) HasRecord(arg0, arg1, arg2 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasRecord", reflect.TypeOf((*MockAclService)(nil).HasRecord), arg0, arg1, arg2) +} + +// Init mocks base method. +func (m *MockAclService) Init(arg0 *app.App) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Init", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Init indicates an expected call of Init. +func (mr *MockAclServiceMockRecorder) Init(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Init", reflect.TypeOf((*MockAclService)(nil).Init), arg0) +} + +// Name mocks base method. +func (m *MockAclService) Name() string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Name") + ret0, _ := ret[0].(string) + return ret0 +} + +// Name indicates an expected call of Name. +func (mr *MockAclServiceMockRecorder) Name() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockAclService)(nil).Name)) +} + +// OwnerPubKey mocks base method. +func (m *MockAclService) OwnerPubKey(arg0 context.Context, arg1 string) (crypto.PubKey, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "OwnerPubKey", arg0, arg1) + ret0, _ := ret[0].(crypto.PubKey) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// OwnerPubKey indicates an expected call of OwnerPubKey. +func (mr *MockAclServiceMockRecorder) OwnerPubKey(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OwnerPubKey", reflect.TypeOf((*MockAclService)(nil).OwnerPubKey), arg0, arg1) +} + +// Permissions mocks base method. +func (m *MockAclService) Permissions(arg0 context.Context, arg1 crypto.PubKey, arg2 string) (list.AclPermissions, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Permissions", arg0, arg1, arg2) + ret0, _ := ret[0].(list.AclPermissions) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Permissions indicates an expected call of Permissions. +func (mr *MockAclServiceMockRecorder) Permissions(arg0, arg1, arg2 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Permissions", reflect.TypeOf((*MockAclService)(nil).Permissions), arg0, arg1, arg2) +} + +// ReadState mocks base method. +func (m *MockAclService) ReadState(arg0 context.Context, arg1 string, arg2 func(*list.AclState) error) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReadState", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// ReadState indicates an expected call of ReadState. +func (mr *MockAclServiceMockRecorder) ReadState(arg0, arg1, arg2 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadState", reflect.TypeOf((*MockAclService)(nil).ReadState), arg0, arg1, arg2) +} + +// RecordsAfter mocks base method. +func (m *MockAclService) RecordsAfter(arg0 context.Context, arg1, arg2 string) ([]*consensusproto.RawRecordWithId, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RecordsAfter", arg0, arg1, arg2) + ret0, _ := ret[0].([]*consensusproto.RawRecordWithId) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RecordsAfter indicates an expected call of RecordsAfter. +func (mr *MockAclServiceMockRecorder) RecordsAfter(arg0, arg1, arg2 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecordsAfter", reflect.TypeOf((*MockAclService)(nil).RecordsAfter), arg0, arg1, arg2) +} + +// Run mocks base method. +func (m *MockAclService) Run(arg0 context.Context) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Run", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Run indicates an expected call of Run. +func (mr *MockAclServiceMockRecorder) Run(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Run", reflect.TypeOf((*MockAclService)(nil).Run), arg0) +} diff --git a/acl/object.go b/acl/object.go new file mode 100644 index 00000000..9ff76df4 --- /dev/null +++ b/acl/object.go @@ -0,0 +1,94 @@ +package acl + +import ( + "context" + "slices" + "sync" + "time" + + "github.com/anyproto/any-sync/commonspace/object/acl/list" + "github.com/anyproto/any-sync/commonspace/object/acl/liststorage" + "github.com/anyproto/any-sync/consensus/consensusproto" + "go.uber.org/atomic" + "go.uber.org/zap" +) + +func (as *aclService) newAclObject(ctx context.Context, id string) (*aclObject, error) { + obj := &aclObject{ + id: id, + aclService: as, + ready: make(chan struct{}), + } + if err := as.consService.Watch(id, obj); err != nil { + return nil, err + } + select { + case <-obj.ready: + if obj.consErr != nil { + _ = as.consService.UnWatch(id) + return nil, obj.consErr + } + return obj, nil + case <-ctx.Done(): + _ = as.consService.UnWatch(id) + return nil, ctx.Err() + } +} + +type aclObject struct { + id string + aclService *aclService + store liststorage.ListStorage + + list.AclList + ready chan struct{} + consErr error + + lastUsage atomic.Time + + mu sync.Mutex +} + +func (a *aclObject) AddConsensusRecords(recs []*consensusproto.RawRecordWithId) { + a.mu.Lock() + defer a.mu.Unlock() + slices.Reverse(recs) + if a.store == nil { + defer close(a.ready) + if a.store, a.consErr = liststorage.NewInMemoryAclListStorage(a.id, recs); a.consErr != nil { + return + } + if a.AclList, a.consErr = list.BuildAclListWithIdentity(a.aclService.accountService.Account(), a.store, list.NoOpAcceptorVerifier{}); a.consErr != nil { + return + } + } else { + a.Lock() + defer a.Unlock() + if err := a.AddRawRecords(recs); err != nil { + log.Warn("unable to add consensus records", zap.Error(err), zap.String("spaceId", a.id)) + return + } + } +} + +func (a *aclObject) AddConsensusError(err error) { + a.mu.Lock() + defer a.mu.Unlock() + if a.store == nil { + a.consErr = err + close(a.ready) + } else { + log.Warn("got consensus error", zap.Error(err)) + } +} + +func (a *aclObject) Close() (err error) { + return a.aclService.consService.UnWatch(a.id) +} + +func (a *aclObject) TryClose(objectTTL time.Duration) (res bool, err error) { + if a.lastUsage.Load().Before(time.Now().Add(-objectTTL)) { + return true, a.Close() + } + return false, nil +} diff --git a/app/app.go b/app/app.go index 5aeda7f3..0269be7d 100644 --- a/app/app.go +++ b/app/app.go @@ -4,14 +4,16 @@ import ( "context" "errors" "fmt" - "github.com/anyproto/any-sync/app/logger" - "go.uber.org/zap" "os" "runtime" "runtime/debug" "strings" "sync" "time" + + "go.uber.org/zap" + + "github.com/anyproto/any-sync/app/logger" ) var ( @@ -227,7 +229,7 @@ func (app *App) Start(ctx context.Context) (err error) { for i := idx; i >= 0; i-- { if serviceClose, ok := app.components[i].(ComponentRunnable); ok { if e := serviceClose.Close(ctx); e != nil { - log.Info("close error", zap.String("component", serviceClose.Name()), zap.Error(e)) + log.Error("close error", zap.String("component", serviceClose.Name()), zap.Error(e)) } } } @@ -235,6 +237,7 @@ func (app *App) Start(ctx context.Context) (err error) { for i, s := range app.components { if err = s.Init(app); err != nil { + log.Error("can't init service", zap.String("service", s.Name()), zap.Error(err)) closeServices(i) return fmt.Errorf("can't init service '%s': %w", s.Name(), err) } @@ -244,6 +247,7 @@ func (app *App) Start(ctx context.Context) (err error) { if serviceRun, ok := s.(ComponentRunnable); ok { start := time.Now() if err = serviceRun.Run(ctx); err != nil { + log.Error("can't run service", zap.String("service", serviceRun.Name()), zap.Error(err)) closeServices(i) return fmt.Errorf("can't run service '%s': %w", serviceRun.Name(), err) } diff --git a/app/ocache/ocache.go b/app/ocache/ocache.go index c91b3905..18c5c179 100644 --- a/app/ocache/ocache.go +++ b/app/ocache/ocache.go @@ -275,7 +275,6 @@ func (c *oCache) GC() { var toClose []*entry for _, e := range c.data { if e.isActive() && e.lastUsage.Before(deadline) { - e.close = make(chan struct{}) toClose = append(toClose, e) } } diff --git a/commonfile/fileproto/file.pb.go b/commonfile/fileproto/file.pb.go index 081498f3..2afd1b94 100644 --- a/commonfile/fileproto/file.pb.go +++ b/commonfile/fileproto/file.pb.go @@ -25,33 +25,36 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type ErrCodes int32 const ( - ErrCodes_Unexpected ErrCodes = 0 - ErrCodes_CIDNotFound ErrCodes = 1 - ErrCodes_Forbidden ErrCodes = 2 - ErrCodes_SpaceLimitExceeded ErrCodes = 3 - ErrCodes_QuerySizeExceeded ErrCodes = 4 - ErrCodes_WrongHash ErrCodes = 5 - ErrCodes_ErrorOffset ErrCodes = 200 + ErrCodes_Unexpected ErrCodes = 0 + ErrCodes_CIDNotFound ErrCodes = 1 + ErrCodes_Forbidden ErrCodes = 2 + ErrCodes_LimitExceeded ErrCodes = 3 + ErrCodes_QuerySizeExceeded ErrCodes = 4 + ErrCodes_WrongHash ErrCodes = 5 + ErrCodes_NotEnoughSpace ErrCodes = 6 + ErrCodes_ErrorOffset ErrCodes = 200 ) var ErrCodes_name = map[int32]string{ 0: "Unexpected", 1: "CIDNotFound", 2: "Forbidden", - 3: "SpaceLimitExceeded", + 3: "LimitExceeded", 4: "QuerySizeExceeded", 5: "WrongHash", + 6: "NotEnoughSpace", 200: "ErrorOffset", } var ErrCodes_value = map[string]int32{ - "Unexpected": 0, - "CIDNotFound": 1, - "Forbidden": 2, - "SpaceLimitExceeded": 3, - "QuerySizeExceeded": 4, - "WrongHash": 5, - "ErrorOffset": 200, + "Unexpected": 0, + "CIDNotFound": 1, + "Forbidden": 2, + "LimitExceeded": 3, + "QuerySizeExceeded": 4, + "WrongHash": 5, + "NotEnoughSpace": 6, + "ErrorOffset": 200, } func (x ErrCodes) String() string { @@ -90,16 +93,53 @@ func (AvailabilityStatus) EnumDescriptor() ([]byte, []int) { return fileDescriptor_fd665a7e11c833d5, []int{1} } +type Ok struct { +} + +func (m *Ok) Reset() { *m = Ok{} } +func (m *Ok) String() string { return proto.CompactTextString(m) } +func (*Ok) ProtoMessage() {} +func (*Ok) Descriptor() ([]byte, []int) { + return fileDescriptor_fd665a7e11c833d5, []int{0} +} +func (m *Ok) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Ok) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Ok.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Ok) XXX_Merge(src proto.Message) { + xxx_messageInfo_Ok.Merge(m, src) +} +func (m *Ok) XXX_Size() int { + return m.Size() +} +func (m *Ok) XXX_DiscardUnknown() { + xxx_messageInfo_Ok.DiscardUnknown(m) +} + +var xxx_messageInfo_Ok proto.InternalMessageInfo + type BlockGetRequest struct { SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` Cid []byte `protobuf:"bytes,2,opt,name=cid,proto3" json:"cid,omitempty"` + Wait bool `protobuf:"varint,3,opt,name=wait,proto3" json:"wait,omitempty"` } func (m *BlockGetRequest) Reset() { *m = BlockGetRequest{} } func (m *BlockGetRequest) String() string { return proto.CompactTextString(m) } func (*BlockGetRequest) ProtoMessage() {} func (*BlockGetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_fd665a7e11c833d5, []int{0} + return fileDescriptor_fd665a7e11c833d5, []int{1} } func (m *BlockGetRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -142,6 +182,13 @@ func (m *BlockGetRequest) GetCid() []byte { return nil } +func (m *BlockGetRequest) GetWait() bool { + if m != nil { + return m.Wait + } + return false +} + type BlockGetResponse struct { Cid []byte `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` @@ -151,7 +198,7 @@ func (m *BlockGetResponse) Reset() { *m = BlockGetResponse{} } func (m *BlockGetResponse) String() string { return proto.CompactTextString(m) } func (*BlockGetResponse) ProtoMessage() {} func (*BlockGetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_fd665a7e11c833d5, []int{1} + return fileDescriptor_fd665a7e11c833d5, []int{2} } func (m *BlockGetResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -205,7 +252,7 @@ func (m *BlockPushRequest) Reset() { *m = BlockPushRequest{} } func (m *BlockPushRequest) String() string { return proto.CompactTextString(m) } func (*BlockPushRequest) ProtoMessage() {} func (*BlockPushRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_fd665a7e11c833d5, []int{2} + return fileDescriptor_fd665a7e11c833d5, []int{3} } func (m *BlockPushRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -262,42 +309,6 @@ func (m *BlockPushRequest) GetData() []byte { return nil } -type BlockPushResponse struct { -} - -func (m *BlockPushResponse) Reset() { *m = BlockPushResponse{} } -func (m *BlockPushResponse) String() string { return proto.CompactTextString(m) } -func (*BlockPushResponse) ProtoMessage() {} -func (*BlockPushResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_fd665a7e11c833d5, []int{3} -} -func (m *BlockPushResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BlockPushResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BlockPushResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *BlockPushResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlockPushResponse.Merge(m, src) -} -func (m *BlockPushResponse) XXX_Size() int { - return m.Size() -} -func (m *BlockPushResponse) XXX_DiscardUnknown() { - xxx_messageInfo_BlockPushResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_BlockPushResponse proto.InternalMessageInfo - type BlocksCheckRequest struct { SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` Cids [][]byte `protobuf:"bytes,2,rep,name=cids,proto3" json:"cids,omitempty"` @@ -506,42 +517,6 @@ func (m *BlocksBindRequest) GetCids() [][]byte { return nil } -type BlocksBindResponse struct { -} - -func (m *BlocksBindResponse) Reset() { *m = BlocksBindResponse{} } -func (m *BlocksBindResponse) String() string { return proto.CompactTextString(m) } -func (*BlocksBindResponse) ProtoMessage() {} -func (*BlocksBindResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_fd665a7e11c833d5, []int{8} -} -func (m *BlocksBindResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BlocksBindResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BlocksBindResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *BlocksBindResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlocksBindResponse.Merge(m, src) -} -func (m *BlocksBindResponse) XXX_Size() int { - return m.Size() -} -func (m *BlocksBindResponse) XXX_DiscardUnknown() { - xxx_messageInfo_BlocksBindResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_BlocksBindResponse proto.InternalMessageInfo - type FilesDeleteRequest struct { SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` FileIds []string `protobuf:"bytes,2,rep,name=fileIds,proto3" json:"fileIds,omitempty"` @@ -551,7 +526,7 @@ func (m *FilesDeleteRequest) Reset() { *m = FilesDeleteRequest{} } func (m *FilesDeleteRequest) String() string { return proto.CompactTextString(m) } func (*FilesDeleteRequest) ProtoMessage() {} func (*FilesDeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_fd665a7e11c833d5, []int{9} + return fileDescriptor_fd665a7e11c833d5, []int{8} } func (m *FilesDeleteRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -601,7 +576,7 @@ func (m *FilesDeleteResponse) Reset() { *m = FilesDeleteResponse{} } func (m *FilesDeleteResponse) String() string { return proto.CompactTextString(m) } func (*FilesDeleteResponse) ProtoMessage() {} func (*FilesDeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_fd665a7e11c833d5, []int{10} + return fileDescriptor_fd665a7e11c833d5, []int{9} } func (m *FilesDeleteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -639,7 +614,7 @@ func (m *FilesInfoRequest) Reset() { *m = FilesInfoRequest{} } func (m *FilesInfoRequest) String() string { return proto.CompactTextString(m) } func (*FilesInfoRequest) ProtoMessage() {} func (*FilesInfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_fd665a7e11c833d5, []int{11} + return fileDescriptor_fd665a7e11c833d5, []int{10} } func (m *FilesInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -690,7 +665,7 @@ func (m *FilesInfoResponse) Reset() { *m = FilesInfoResponse{} } func (m *FilesInfoResponse) String() string { return proto.CompactTextString(m) } func (*FilesInfoResponse) ProtoMessage() {} func (*FilesInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_fd665a7e11c833d5, []int{12} + return fileDescriptor_fd665a7e11c833d5, []int{11} } func (m *FilesInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -736,7 +711,7 @@ func (m *FileInfo) Reset() { *m = FileInfo{} } func (m *FileInfo) String() string { return proto.CompactTextString(m) } func (*FileInfo) ProtoMessage() {} func (*FileInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_fd665a7e11c833d5, []int{13} + return fileDescriptor_fd665a7e11c833d5, []int{12} } func (m *FileInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -786,6 +761,94 @@ func (m *FileInfo) GetCidsCount() uint32 { return 0 } +type FilesGetRequest struct { + SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` +} + +func (m *FilesGetRequest) Reset() { *m = FilesGetRequest{} } +func (m *FilesGetRequest) String() string { return proto.CompactTextString(m) } +func (*FilesGetRequest) ProtoMessage() {} +func (*FilesGetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_fd665a7e11c833d5, []int{13} +} +func (m *FilesGetRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FilesGetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FilesGetRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *FilesGetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_FilesGetRequest.Merge(m, src) +} +func (m *FilesGetRequest) XXX_Size() int { + return m.Size() +} +func (m *FilesGetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_FilesGetRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_FilesGetRequest proto.InternalMessageInfo + +func (m *FilesGetRequest) GetSpaceId() string { + if m != nil { + return m.SpaceId + } + return "" +} + +type FilesGetResponse struct { + FileId string `protobuf:"bytes,1,opt,name=fileId,proto3" json:"fileId,omitempty"` +} + +func (m *FilesGetResponse) Reset() { *m = FilesGetResponse{} } +func (m *FilesGetResponse) String() string { return proto.CompactTextString(m) } +func (*FilesGetResponse) ProtoMessage() {} +func (*FilesGetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_fd665a7e11c833d5, []int{14} +} +func (m *FilesGetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FilesGetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FilesGetResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *FilesGetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_FilesGetResponse.Merge(m, src) +} +func (m *FilesGetResponse) XXX_Size() int { + return m.Size() +} +func (m *FilesGetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_FilesGetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_FilesGetResponse proto.InternalMessageInfo + +func (m *FilesGetResponse) GetFileId() string { + if m != nil { + return m.FileId + } + return "" +} + type CheckRequest struct { } @@ -793,7 +856,7 @@ func (m *CheckRequest) Reset() { *m = CheckRequest{} } func (m *CheckRequest) String() string { return proto.CompactTextString(m) } func (*CheckRequest) ProtoMessage() {} func (*CheckRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_fd665a7e11c833d5, []int{14} + return fileDescriptor_fd665a7e11c833d5, []int{15} } func (m *CheckRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -831,7 +894,7 @@ func (m *CheckResponse) Reset() { *m = CheckResponse{} } func (m *CheckResponse) String() string { return proto.CompactTextString(m) } func (*CheckResponse) ProtoMessage() {} func (*CheckResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_fd665a7e11c833d5, []int{15} + return fileDescriptor_fd665a7e11c833d5, []int{16} } func (m *CheckResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -882,7 +945,7 @@ func (m *SpaceInfoRequest) Reset() { *m = SpaceInfoRequest{} } func (m *SpaceInfoRequest) String() string { return proto.CompactTextString(m) } func (*SpaceInfoRequest) ProtoMessage() {} func (*SpaceInfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_fd665a7e11c833d5, []int{16} + return fileDescriptor_fd665a7e11c833d5, []int{17} } func (m *SpaceInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -931,7 +994,7 @@ func (m *SpaceInfoResponse) Reset() { *m = SpaceInfoResponse{} } func (m *SpaceInfoResponse) String() string { return proto.CompactTextString(m) } func (*SpaceInfoResponse) ProtoMessage() {} func (*SpaceInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_fd665a7e11c833d5, []int{17} + return fileDescriptor_fd665a7e11c833d5, []int{18} } func (m *SpaceInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1009,7 +1072,7 @@ func (m *AccountInfoRequest) Reset() { *m = AccountInfoRequest{} } func (m *AccountInfoRequest) String() string { return proto.CompactTextString(m) } func (*AccountInfoRequest) ProtoMessage() {} func (*AccountInfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_fd665a7e11c833d5, []int{18} + return fileDescriptor_fd665a7e11c833d5, []int{19} } func (m *AccountInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1039,17 +1102,20 @@ func (m *AccountInfoRequest) XXX_DiscardUnknown() { var xxx_messageInfo_AccountInfoRequest proto.InternalMessageInfo type AccountInfoResponse struct { + // the shared limit excluding isolated spaces LimitBytes uint64 `protobuf:"varint,1,opt,name=limitBytes,proto3" json:"limitBytes,omitempty"` TotalUsageBytes uint64 `protobuf:"varint,2,opt,name=totalUsageBytes,proto3" json:"totalUsageBytes,omitempty"` TotalCidsCount uint64 `protobuf:"varint,3,opt,name=totalCidsCount,proto3" json:"totalCidsCount,omitempty"` Spaces []*SpaceInfoResponse `protobuf:"bytes,4,rep,name=spaces,proto3" json:"spaces,omitempty"` + // the total limit including isolated spaces + AccountLimitBytes uint64 `protobuf:"varint,5,opt,name=accountLimitBytes,proto3" json:"accountLimitBytes,omitempty"` } func (m *AccountInfoResponse) Reset() { *m = AccountInfoResponse{} } func (m *AccountInfoResponse) String() string { return proto.CompactTextString(m) } func (*AccountInfoResponse) ProtoMessage() {} func (*AccountInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_fd665a7e11c833d5, []int{19} + return fileDescriptor_fd665a7e11c833d5, []int{20} } func (m *AccountInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1106,29 +1172,143 @@ func (m *AccountInfoResponse) GetSpaces() []*SpaceInfoResponse { return nil } +func (m *AccountInfoResponse) GetAccountLimitBytes() uint64 { + if m != nil { + return m.AccountLimitBytes + } + return 0 +} + +type AccountLimitSetRequest struct { + Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` + Limit uint64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` +} + +func (m *AccountLimitSetRequest) Reset() { *m = AccountLimitSetRequest{} } +func (m *AccountLimitSetRequest) String() string { return proto.CompactTextString(m) } +func (*AccountLimitSetRequest) ProtoMessage() {} +func (*AccountLimitSetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_fd665a7e11c833d5, []int{21} +} +func (m *AccountLimitSetRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AccountLimitSetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AccountLimitSetRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AccountLimitSetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccountLimitSetRequest.Merge(m, src) +} +func (m *AccountLimitSetRequest) XXX_Size() int { + return m.Size() +} +func (m *AccountLimitSetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AccountLimitSetRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AccountLimitSetRequest proto.InternalMessageInfo + +func (m *AccountLimitSetRequest) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *AccountLimitSetRequest) GetLimit() uint64 { + if m != nil { + return m.Limit + } + return 0 +} + +type SpaceLimitSetRequest struct { + SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` + Limit uint64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` +} + +func (m *SpaceLimitSetRequest) Reset() { *m = SpaceLimitSetRequest{} } +func (m *SpaceLimitSetRequest) String() string { return proto.CompactTextString(m) } +func (*SpaceLimitSetRequest) ProtoMessage() {} +func (*SpaceLimitSetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_fd665a7e11c833d5, []int{22} +} +func (m *SpaceLimitSetRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SpaceLimitSetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SpaceLimitSetRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SpaceLimitSetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SpaceLimitSetRequest.Merge(m, src) +} +func (m *SpaceLimitSetRequest) XXX_Size() int { + return m.Size() +} +func (m *SpaceLimitSetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SpaceLimitSetRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SpaceLimitSetRequest proto.InternalMessageInfo + +func (m *SpaceLimitSetRequest) GetSpaceId() string { + if m != nil { + return m.SpaceId + } + return "" +} + +func (m *SpaceLimitSetRequest) GetLimit() uint64 { + if m != nil { + return m.Limit + } + return 0 +} + func init() { proto.RegisterEnum("filesync.ErrCodes", ErrCodes_name, ErrCodes_value) proto.RegisterEnum("filesync.AvailabilityStatus", AvailabilityStatus_name, AvailabilityStatus_value) + proto.RegisterType((*Ok)(nil), "filesync.Ok") proto.RegisterType((*BlockGetRequest)(nil), "filesync.BlockGetRequest") proto.RegisterType((*BlockGetResponse)(nil), "filesync.BlockGetResponse") proto.RegisterType((*BlockPushRequest)(nil), "filesync.BlockPushRequest") - proto.RegisterType((*BlockPushResponse)(nil), "filesync.BlockPushResponse") proto.RegisterType((*BlocksCheckRequest)(nil), "filesync.BlocksCheckRequest") proto.RegisterType((*BlocksCheckResponse)(nil), "filesync.BlocksCheckResponse") proto.RegisterType((*BlockAvailability)(nil), "filesync.BlockAvailability") proto.RegisterType((*BlocksBindRequest)(nil), "filesync.BlocksBindRequest") - proto.RegisterType((*BlocksBindResponse)(nil), "filesync.BlocksBindResponse") proto.RegisterType((*FilesDeleteRequest)(nil), "filesync.FilesDeleteRequest") proto.RegisterType((*FilesDeleteResponse)(nil), "filesync.FilesDeleteResponse") proto.RegisterType((*FilesInfoRequest)(nil), "filesync.FilesInfoRequest") proto.RegisterType((*FilesInfoResponse)(nil), "filesync.FilesInfoResponse") proto.RegisterType((*FileInfo)(nil), "filesync.FileInfo") + proto.RegisterType((*FilesGetRequest)(nil), "filesync.FilesGetRequest") + proto.RegisterType((*FilesGetResponse)(nil), "filesync.FilesGetResponse") proto.RegisterType((*CheckRequest)(nil), "filesync.CheckRequest") proto.RegisterType((*CheckResponse)(nil), "filesync.CheckResponse") proto.RegisterType((*SpaceInfoRequest)(nil), "filesync.SpaceInfoRequest") proto.RegisterType((*SpaceInfoResponse)(nil), "filesync.SpaceInfoResponse") proto.RegisterType((*AccountInfoRequest)(nil), "filesync.AccountInfoRequest") proto.RegisterType((*AccountInfoResponse)(nil), "filesync.AccountInfoResponse") + proto.RegisterType((*AccountLimitSetRequest)(nil), "filesync.AccountLimitSetRequest") + proto.RegisterType((*SpaceLimitSetRequest)(nil), "filesync.SpaceLimitSetRequest") } func init() { @@ -1136,63 +1316,94 @@ func init() { } var fileDescriptor_fd665a7e11c833d5 = []byte{ - // 889 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x73, 0xdb, 0x44, - 0x14, 0xf7, 0xc6, 0x8a, 0x6b, 0xbd, 0x34, 0x89, 0xbc, 0x49, 0x83, 0x71, 0x83, 0x26, 0xa3, 0x43, - 0xc7, 0xd3, 0x61, 0x5c, 0x26, 0xe5, 0xd0, 0x0b, 0x87, 0xd8, 0xb1, 0x5b, 0x53, 0xa6, 0x80, 0x32, - 0x9d, 0x0e, 0x70, 0x41, 0x96, 0xd6, 0x8d, 0xa8, 0xa2, 0x35, 0xda, 0x35, 0xc4, 0x1c, 0x39, 0x72, - 0xe2, 0x03, 0xf1, 0x01, 0x7a, 0xcc, 0x91, 0x1b, 0x4c, 0xf2, 0x45, 0x98, 0x5d, 0xad, 0xac, 0xd5, - 0x1f, 0x08, 0x03, 0xbd, 0xc8, 0xbb, 0xbf, 0x7d, 0xef, 0xfd, 0xde, 0xfb, 0xed, 0xee, 0x5b, 0xc3, - 0x03, 0x9f, 0x5e, 0x5c, 0xd0, 0x78, 0x1e, 0x46, 0xe4, 0x91, 0xf8, 0x2c, 0x12, 0xca, 0xe9, 0x23, - 0xf9, 0x65, 0x12, 0x18, 0xc8, 0x31, 0x6e, 0x8b, 0x31, 0x5b, 0xc5, 0xbe, 0xf3, 0x09, 0xec, 0x0e, - 0x23, 0xea, 0xbf, 0x79, 0x4a, 0xb8, 0x4b, 0xbe, 0x5f, 0x12, 0xc6, 0x71, 0x17, 0xee, 0xb0, 0x85, - 0xe7, 0x93, 0x69, 0xd0, 0x45, 0x47, 0xa8, 0x6f, 0xba, 0xd9, 0x14, 0x5b, 0xd0, 0xf4, 0xc3, 0xa0, - 0xbb, 0x71, 0x84, 0xfa, 0x77, 0x5d, 0x31, 0x74, 0x9e, 0x80, 0x95, 0xbb, 0xb3, 0x05, 0x8d, 0x19, - 0xc9, 0xac, 0xd0, 0xda, 0x0a, 0x63, 0x30, 0x02, 0x8f, 0x7b, 0xca, 0x51, 0x8e, 0x9d, 0xef, 0x94, - 0xe7, 0x17, 0x4b, 0x76, 0x7e, 0x3b, 0xf3, 0x01, 0xb4, 0x44, 0xca, 0xd3, 0x94, 0xdc, 0x74, 0xd5, - 0x2c, 0xe3, 0x6a, 0x56, 0xb9, 0x0c, 0x8d, 0x6b, 0x0f, 0x3a, 0x1a, 0x57, 0x9a, 0xa6, 0x33, 0x04, - 0x2c, 0x41, 0x36, 0x3a, 0x27, 0xfe, 0x9b, 0xdb, 0x53, 0xc0, 0x60, 0xf8, 0x61, 0xc0, 0xba, 0x1b, - 0x47, 0x4d, 0x11, 0x58, 0x8c, 0x9d, 0x19, 0xec, 0x15, 0x62, 0x28, 0x05, 0x9e, 0x03, 0x9e, 0x49, - 0xf8, 0xe4, 0x07, 0x2f, 0x8c, 0xbc, 0x59, 0x18, 0x85, 0x7c, 0xd5, 0x45, 0x47, 0xcd, 0xfe, 0xd6, - 0xf1, 0xfd, 0x41, 0xa6, 0xfd, 0x40, 0xba, 0xea, 0x26, 0x6e, 0x8d, 0x9b, 0xf3, 0x8d, 0x4a, 0x5e, - 0x07, 0x6b, 0x34, 0xfe, 0x18, 0x5a, 0x8c, 0x7b, 0x7c, 0xc9, 0xa4, 0x42, 0x3b, 0xc7, 0x87, 0x39, - 0x8f, 0xee, 0x79, 0x26, 0x6d, 0x5c, 0x65, 0xeb, 0x7c, 0xa5, 0x82, 0xb3, 0x61, 0x18, 0x07, 0xff, - 0x7d, 0x1b, 0x32, 0x6d, 0x9a, 0x9a, 0x36, 0xfb, 0x99, 0xbe, 0x69, 0x68, 0xa5, 0xfa, 0x33, 0xc0, - 0x13, 0x91, 0xd7, 0x29, 0x89, 0x08, 0x27, 0xb7, 0x33, 0x76, 0xe1, 0x4e, 0xca, 0x91, 0x0a, 0x6f, - 0xba, 0xd9, 0xd4, 0xb9, 0x07, 0x7b, 0x85, 0x48, 0x8a, 0x60, 0x02, 0x96, 0x84, 0xa7, 0xf1, 0x9c, - 0xfe, 0x9f, 0xf0, 0x63, 0xe8, 0x68, 0x71, 0xd4, 0xc6, 0x7e, 0x04, 0xe6, 0x3c, 0x03, 0xd5, 0x7e, - 0xe2, 0x5c, 0x67, 0x61, 0x2f, 0xcd, 0x73, 0x23, 0xe7, 0x5b, 0x68, 0x67, 0xb0, 0xa6, 0x1e, 0x2a, - 0xa8, 0x67, 0x03, 0x2c, 0x99, 0xf7, 0x9a, 0x0c, 0x57, 0x9c, 0xa4, 0xdb, 0x67, 0xb8, 0x1a, 0x82, - 0x0f, 0xc1, 0x14, 0x8a, 0x8e, 0xe8, 0x32, 0xe6, 0xf2, 0xa8, 0x6f, 0xbb, 0x39, 0xe0, 0xec, 0xc0, - 0x5d, 0xfd, 0x04, 0x3b, 0xcf, 0x61, 0xbb, 0x78, 0x1a, 0x7b, 0xd0, 0x56, 0xe5, 0x32, 0x99, 0xb3, - 0xe9, 0xae, 0xe7, 0x82, 0xda, 0x8b, 0x22, 0xfa, 0xe3, 0xab, 0x24, 0xe4, 0x44, 0x52, 0xb7, 0x5d, - 0x0d, 0x71, 0x3e, 0x04, 0xeb, 0x4c, 0xda, 0xfe, 0x1b, 0x35, 0x9d, 0x3f, 0x10, 0x74, 0x34, 0x73, - 0xc5, 0x6f, 0x03, 0x44, 0xe1, 0x45, 0xc8, 0xd3, 0xf2, 0x50, 0x5a, 0x5e, 0x8e, 0xe0, 0x3e, 0xec, - 0x72, 0xca, 0xbd, 0xe8, 0x65, 0x59, 0x83, 0x32, 0x5c, 0x15, 0xc2, 0xd0, 0x84, 0x10, 0x3c, 0x52, - 0xf7, 0x74, 0xd9, 0x48, 0x79, 0x72, 0x44, 0xf0, 0xc8, 0x44, 0x35, 0x9e, 0xcd, 0x94, 0xa7, 0x04, - 0xeb, 0x15, 0xb6, 0x8a, 0x15, 0xee, 0x03, 0x3e, 0xf1, 0x7d, 0x11, 0x4e, 0x53, 0xc4, 0xf9, 0x0d, - 0xc1, 0x5e, 0x01, 0x7e, 0xe7, 0x95, 0x3f, 0x80, 0x1d, 0x09, 0x8d, 0x4a, 0xe5, 0x97, 0x50, 0xfc, - 0x18, 0x5a, 0x32, 0x55, 0xd6, 0x35, 0xca, 0xdd, 0xa6, 0xb2, 0x31, 0xae, 0x32, 0x7d, 0xf8, 0x0b, - 0x82, 0xf6, 0x38, 0x49, 0x46, 0x34, 0x20, 0x0c, 0xef, 0x00, 0xbc, 0x8c, 0xc9, 0xe5, 0x82, 0xf8, - 0x9c, 0x04, 0x56, 0x03, 0xef, 0xc2, 0xd6, 0x68, 0x7a, 0xfa, 0x82, 0xf2, 0x09, 0x5d, 0xc6, 0x81, - 0x85, 0xf0, 0x36, 0x98, 0x13, 0x9a, 0xcc, 0xc2, 0x20, 0x20, 0xb1, 0xb5, 0x81, 0x0f, 0x00, 0xcb, - 0xc8, 0x9f, 0x89, 0xb2, 0xc6, 0x97, 0x3e, 0x21, 0x01, 0x09, 0xac, 0x26, 0xbe, 0x07, 0x9d, 0x2f, - 0x97, 0x24, 0x59, 0x9d, 0x85, 0x3f, 0x91, 0x35, 0x6c, 0x08, 0xef, 0x57, 0x09, 0x8d, 0x5f, 0x3f, - 0xf3, 0xd8, 0xb9, 0xb5, 0x89, 0x2d, 0xd8, 0x1a, 0x27, 0x09, 0x4d, 0x3e, 0x9f, 0xcf, 0x19, 0xe1, - 0xd6, 0x5b, 0xf4, 0x70, 0x08, 0xb8, 0xda, 0xaf, 0x84, 0xdb, 0x0b, 0xca, 0xc7, 0x97, 0x21, 0xe3, - 0xcc, 0x6a, 0x60, 0x80, 0x96, 0x1a, 0x23, 0xdc, 0x81, 0xed, 0x74, 0x3c, 0x8d, 0x65, 0x22, 0xd6, - 0xc6, 0xf1, 0xcf, 0x9b, 0x60, 0x88, 0x5b, 0x87, 0x4f, 0xa0, 0x9d, 0x3d, 0x4f, 0xf8, 0xfd, 0x52, - 0xe3, 0xcd, 0x5f, 0xbc, 0x5e, 0xaf, 0x6e, 0x49, 0xed, 0xe1, 0x29, 0x98, 0xeb, 0xb7, 0x03, 0x97, - 0x0d, 0xb5, 0xc7, 0xab, 0x77, 0xbf, 0x76, 0x4d, 0x45, 0xf9, 0x14, 0xb6, 0xb4, 0x87, 0x02, 0x1f, - 0x96, 0x6c, 0x0b, 0x6f, 0x50, 0xef, 0x83, 0xbf, 0x59, 0x55, 0xb1, 0x9e, 0x02, 0xe4, 0x8d, 0x15, - 0x97, 0x69, 0xf5, 0x4e, 0xde, 0x3b, 0xac, 0x5f, 0xcc, 0x93, 0xd2, 0x3a, 0xa8, 0x9e, 0x54, 0xb5, - 0x45, 0xeb, 0x49, 0xd5, 0xb4, 0x5d, 0x21, 0xd3, 0xba, 0x5d, 0xea, 0x32, 0x95, 0x7b, 0xb1, 0x2e, - 0x53, 0xb5, 0xbf, 0x3e, 0x81, 0xcd, 0x54, 0xa0, 0x83, 0xdc, 0xaa, 0x20, 0xcd, 0x7b, 0x15, 0x3c, - 0xe7, 0x5f, 0x1f, 0x70, 0x9d, 0xbf, 0xdc, 0xbd, 0x7a, 0xff, 0x74, 0x23, 0x84, 0x22, 0xda, 0x3d, - 0xd6, 0x15, 0xa9, 0xde, 0x7a, 0x5d, 0x91, 0x9a, 0xcb, 0x3f, 0x1c, 0xbc, 0xbd, 0xb6, 0xd1, 0xd5, - 0xb5, 0x8d, 0xfe, 0xbc, 0xb6, 0xd1, 0xaf, 0x37, 0x76, 0xe3, 0xea, 0xc6, 0x6e, 0xfc, 0x7e, 0x63, - 0x37, 0xbe, 0xde, 0xaf, 0xfb, 0x97, 0x36, 0x6b, 0xc9, 0x9f, 0xc7, 0x7f, 0x05, 0x00, 0x00, 0xff, - 0xff, 0x30, 0x1a, 0xf6, 0xe5, 0xc4, 0x09, 0x00, 0x00, + // 1014 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x41, 0x73, 0xdb, 0x44, + 0x14, 0xb6, 0x6c, 0xc5, 0xb5, 0x5f, 0x62, 0x5b, 0xde, 0xa4, 0xc1, 0xa8, 0xc1, 0xe3, 0xd9, 0x43, + 0xc7, 0x13, 0x3a, 0x69, 0x27, 0x85, 0xa1, 0x17, 0x0e, 0xb6, 0x63, 0x53, 0xb7, 0x4c, 0x43, 0x95, + 0xe9, 0x74, 0x80, 0x0b, 0xb2, 0xb4, 0x4e, 0x44, 0x1c, 0x29, 0x68, 0xd7, 0x34, 0xe1, 0x57, 0x70, + 0xe5, 0x2f, 0xf0, 0x4b, 0x7a, 0xec, 0x91, 0x1b, 0x4c, 0x72, 0xe3, 0x57, 0x30, 0xbb, 0x2b, 0x5b, + 0xab, 0x95, 0xd3, 0x74, 0x80, 0x8b, 0xb3, 0xfb, 0xed, 0x7b, 0xdf, 0x7b, 0xef, 0x5b, 0xed, 0x7b, + 0x81, 0xfb, 0x5e, 0x74, 0x76, 0x16, 0x85, 0xd3, 0x60, 0x46, 0x1e, 0xf2, 0x9f, 0xf3, 0x38, 0x62, + 0xd1, 0x43, 0xf1, 0x4b, 0x05, 0xb0, 0x27, 0xd6, 0xa8, 0xc2, 0xd7, 0xf4, 0x32, 0xf4, 0xb0, 0x09, + 0xc5, 0xc3, 0x53, 0xfc, 0x12, 0x1a, 0xfd, 0x59, 0xe4, 0x9d, 0x7e, 0x45, 0x98, 0x43, 0x7e, 0x9a, + 0x13, 0xca, 0x50, 0x0b, 0xee, 0xd0, 0x73, 0xd7, 0x23, 0x63, 0xbf, 0x65, 0x74, 0x8c, 0x6e, 0xd5, + 0x59, 0x6c, 0x91, 0x05, 0x25, 0x2f, 0xf0, 0x5b, 0xc5, 0x8e, 0xd1, 0xdd, 0x70, 0xf8, 0x12, 0x21, + 0x30, 0xdf, 0xb8, 0x01, 0x6b, 0x95, 0x3a, 0x46, 0xb7, 0xe2, 0x88, 0x35, 0x7e, 0x02, 0x56, 0x4a, + 0x49, 0xcf, 0xa3, 0x90, 0x92, 0x85, 0xa7, 0x91, 0xf1, 0xf4, 0x5d, 0xe6, 0x26, 0x64, 0x62, 0x8d, + 0x7f, 0x4c, 0x3c, 0xbf, 0x99, 0xd3, 0x93, 0xdb, 0xb3, 0xd9, 0x86, 0x32, 0x2f, 0x66, 0x2c, 0x13, + 0xaa, 0x3a, 0xc9, 0x6e, 0x11, 0xab, 0x94, 0x8f, 0x65, 0x2a, 0xb1, 0xfa, 0x80, 0x44, 0x2c, 0x3a, + 0x38, 0x21, 0xde, 0xe9, 0xed, 0xd1, 0x10, 0x98, 0x5e, 0xe0, 0xd3, 0x56, 0xb1, 0x53, 0xe2, 0x1c, + 0x7c, 0x8d, 0x27, 0xb0, 0x99, 0xe1, 0x48, 0x8a, 0x7d, 0x0e, 0x68, 0x22, 0xe0, 0xde, 0xcf, 0x6e, + 0x30, 0x73, 0x27, 0xc1, 0x2c, 0x60, 0x97, 0x2d, 0xa3, 0x53, 0xea, 0xae, 0xef, 0xdf, 0xdb, 0x5b, + 0x5c, 0xc0, 0x9e, 0x70, 0x55, 0x4d, 0x9c, 0x15, 0x6e, 0xf8, 0x7b, 0x68, 0xe6, 0x0c, 0x57, 0xc8, + 0xf9, 0x19, 0x94, 0x29, 0x73, 0xd9, 0x9c, 0x0a, 0x31, 0xea, 0xfb, 0x3b, 0x69, 0x1c, 0xd5, 0xf3, + 0x48, 0xd8, 0x38, 0x89, 0x2d, 0xfe, 0x36, 0x21, 0xa7, 0xfd, 0x20, 0xf4, 0xff, 0xbd, 0xe2, 0x0b, + 0x6d, 0x4a, 0x8a, 0x36, 0x4f, 0x01, 0x8d, 0x78, 0x06, 0x07, 0x64, 0x46, 0x18, 0xb9, 0x9d, 0xbb, + 0x05, 0x77, 0x24, 0x9b, 0x94, 0xb8, 0xea, 0x2c, 0xb6, 0xf8, 0x2e, 0x6c, 0x66, 0x98, 0xa4, 0xca, + 0x78, 0x04, 0x96, 0x80, 0xc7, 0xe1, 0x34, 0xfa, 0x2f, 0xf4, 0x43, 0x68, 0x2a, 0x3c, 0xc9, 0x15, + 0x3e, 0x82, 0xea, 0x74, 0x01, 0x26, 0x37, 0x87, 0x52, 0x45, 0xb9, 0xbd, 0x30, 0x4f, 0x8d, 0xf0, + 0x0f, 0x50, 0x59, 0xc0, 0x8a, 0x4e, 0x46, 0x46, 0xa7, 0x36, 0xc0, 0x9c, 0xba, 0xc7, 0xa4, 0x7f, + 0xc9, 0x88, 0xbc, 0x28, 0xd3, 0x51, 0x10, 0xb4, 0x03, 0x55, 0xae, 0xdd, 0x20, 0x9a, 0x87, 0xf2, + 0x49, 0xd5, 0x9c, 0x14, 0xc0, 0x9f, 0x42, 0x43, 0x24, 0xfa, 0x21, 0x4f, 0x15, 0xef, 0x26, 0xea, + 0xa8, 0x8f, 0xf0, 0x86, 0xb4, 0x70, 0x1d, 0x36, 0xd4, 0x47, 0x80, 0x9f, 0x43, 0x2d, 0xfb, 0x41, + 0xdb, 0x50, 0x49, 0x78, 0xa9, 0x10, 0xa3, 0xea, 0x2c, 0xf7, 0xbc, 0x26, 0x77, 0x36, 0x8b, 0xde, + 0xbc, 0x8e, 0x03, 0x46, 0x44, 0x4d, 0x15, 0x47, 0x41, 0xf0, 0x03, 0xb0, 0x8e, 0x84, 0xed, 0x87, + 0x5c, 0x13, 0xfe, 0xd3, 0x80, 0xa6, 0x62, 0x9e, 0xc4, 0x6f, 0x03, 0xcc, 0x82, 0xb3, 0x80, 0x49, + 0xdd, 0x0c, 0xa9, 0x5b, 0x8a, 0xa0, 0x2e, 0x34, 0x58, 0xc4, 0xdc, 0xd9, 0x2b, 0x5d, 0x5c, 0x1d, + 0xce, 0x2b, 0x6c, 0x2a, 0x0a, 0xf3, 0x38, 0xe2, 0x42, 0xe5, 0xb1, 0x29, 0xe3, 0xa4, 0x08, 0x8f, + 0x23, 0x12, 0x55, 0xe2, 0xac, 0xc9, 0x38, 0x1a, 0xac, 0x56, 0x58, 0xce, 0x56, 0xb8, 0x05, 0xa8, + 0xe7, 0x79, 0x9c, 0x4e, 0x51, 0x04, 0xff, 0x6d, 0xc0, 0x66, 0x06, 0xfe, 0xdf, 0x2b, 0xbf, 0x0f, + 0x75, 0x01, 0x0d, 0xb4, 0xf2, 0x35, 0x14, 0x3d, 0x86, 0xb2, 0x48, 0x95, 0xb6, 0x4c, 0xbd, 0x61, + 0xe5, 0x2e, 0xc6, 0x49, 0x4c, 0xd1, 0x03, 0x68, 0xba, 0x32, 0xfb, 0xaf, 0xd3, 0x6c, 0xa5, 0x34, + 0xf9, 0x03, 0xfc, 0x0c, 0xb6, 0x7b, 0x0a, 0x78, 0x94, 0x7e, 0xcf, 0x36, 0x54, 0x02, 0x9f, 0x84, + 0x4c, 0xf6, 0x4b, 0xae, 0xdb, 0x72, 0x8f, 0xb6, 0x60, 0x4d, 0x14, 0x9e, 0x14, 0x28, 0x37, 0x78, + 0x04, 0x5b, 0x22, 0x2d, 0x9d, 0xe9, 0xe6, 0x4e, 0xb0, 0x92, 0x67, 0xf7, 0x37, 0x03, 0x2a, 0xc3, + 0x38, 0x1e, 0x44, 0x3e, 0xa1, 0xa8, 0x0e, 0xf0, 0x2a, 0x24, 0x17, 0xe7, 0xc4, 0x63, 0xc4, 0xb7, + 0x0a, 0xa8, 0x01, 0xeb, 0x83, 0xf1, 0xc1, 0x8b, 0x88, 0x8d, 0xa2, 0x79, 0xe8, 0x5b, 0x06, 0xaa, + 0x41, 0x75, 0x14, 0xc5, 0x93, 0xc0, 0xf7, 0x49, 0x68, 0x15, 0x51, 0x13, 0x6a, 0x22, 0xfe, 0xf0, + 0xc2, 0x23, 0xc4, 0x27, 0xbe, 0x55, 0x42, 0x77, 0xa1, 0xf9, 0x72, 0x4e, 0xe2, 0xcb, 0xa3, 0xe0, + 0x17, 0xb2, 0x84, 0x4d, 0xee, 0xf8, 0x3a, 0x8e, 0xc2, 0xe3, 0xa7, 0x2e, 0x3d, 0xb1, 0xd6, 0x10, + 0x82, 0xfa, 0x8b, 0x88, 0x0d, 0xc3, 0x68, 0x7e, 0x7c, 0x22, 0xca, 0xb0, 0xca, 0xc8, 0x82, 0xf5, + 0x61, 0x1c, 0x47, 0xf1, 0xe1, 0x74, 0x4a, 0x09, 0xb3, 0xde, 0x1a, 0xbb, 0x7d, 0x40, 0xf9, 0x1e, + 0xce, 0xa9, 0xb8, 0xef, 0x45, 0x40, 0x19, 0xb5, 0x0a, 0x08, 0xa0, 0x9c, 0xac, 0x0d, 0x9e, 0x8f, + 0x5c, 0x8f, 0x43, 0xc9, 0x5a, 0xdc, 0xff, 0xbd, 0x0c, 0x26, 0x6f, 0x08, 0xa8, 0x07, 0x95, 0xc5, + 0x74, 0x46, 0x1f, 0x6b, 0xc3, 0x28, 0xed, 0x2c, 0xb6, 0xbd, 0xea, 0x28, 0xf9, 0x28, 0x3f, 0x87, + 0xea, 0x72, 0x4c, 0x23, 0xdd, 0x50, 0x99, 0xdd, 0xf6, 0x46, 0x7a, 0x76, 0x78, 0x8a, 0x9e, 0xc1, + 0xba, 0x32, 0x2d, 0xd1, 0x8e, 0xe6, 0x98, 0x19, 0xc4, 0xf6, 0x27, 0x37, 0x9c, 0x26, 0x29, 0x7c, + 0x01, 0x90, 0x0e, 0x2e, 0xa4, 0x0f, 0x55, 0x75, 0x9c, 0xe5, 0x93, 0x50, 0x86, 0x89, 0x9a, 0x44, + 0x7e, 0x5a, 0xa9, 0x49, 0xac, 0x98, 0x40, 0xe8, 0x00, 0xaa, 0xcb, 0xc9, 0xa1, 0xea, 0xa0, 0x8f, + 0x25, 0xfb, 0xde, 0xca, 0xb3, 0x84, 0x65, 0x20, 0x07, 0x07, 0xd5, 0x2e, 0x44, 0x6b, 0xf5, 0xb6, + 0xbd, 0xea, 0x48, 0x52, 0x3c, 0x32, 0xd0, 0x13, 0x58, 0x93, 0xaa, 0x6e, 0xa7, 0x66, 0x19, 0x3d, + 0x3f, 0xca, 0xe1, 0x69, 0x11, 0xcb, 0x77, 0xad, 0x16, 0xa1, 0x37, 0x6d, 0xfb, 0x7d, 0x8d, 0x80, + 0xcb, 0xaa, 0xb4, 0x2f, 0x55, 0xd6, 0x7c, 0xb3, 0x53, 0x65, 0x5d, 0xd5, 0xf3, 0x7a, 0xd0, 0xd0, + 0xda, 0x03, 0xea, 0xe4, 0x3c, 0xb4, 0xf7, 0xae, 0xdd, 0xf2, 0x97, 0x50, 0xcb, 0x74, 0x05, 0xd4, + 0xd6, 0x92, 0x7f, 0xaf, 0x7b, 0x7f, 0xef, 0xed, 0x55, 0xdb, 0x78, 0x77, 0xd5, 0x36, 0xfe, 0xba, + 0x6a, 0x1b, 0xbf, 0x5e, 0xb7, 0x0b, 0xef, 0xae, 0xdb, 0x85, 0x3f, 0xae, 0xdb, 0x85, 0xef, 0xb6, + 0x56, 0xfd, 0x9b, 0x3d, 0x29, 0x8b, 0x3f, 0x8f, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0xef, 0x18, + 0x68, 0x52, 0x85, 0x0b, 0x00, 0x00, +} + +func (m *Ok) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Ok) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Ok) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil } func (m *BlockGetRequest) Marshal() (dAtA []byte, err error) { @@ -1215,6 +1426,16 @@ func (m *BlockGetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Wait { + i-- + if m.Wait { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } if len(m.Cid) > 0 { i -= len(m.Cid) copy(dAtA[i:], m.Cid) @@ -1320,29 +1541,6 @@ func (m *BlockPushRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *BlockPushResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BlockPushResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BlockPushResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - func (m *BlocksCheckRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1500,29 +1698,6 @@ func (m *BlocksBindRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *BlocksBindResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BlocksBindResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BlocksBindResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - func (m *FilesDeleteRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1701,6 +1876,66 @@ func (m *FileInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *FilesGetRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FilesGetRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FilesGetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SpaceId) > 0 { + i -= len(m.SpaceId) + copy(dAtA[i:], m.SpaceId) + i = encodeVarintFile(dAtA, i, uint64(len(m.SpaceId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *FilesGetResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FilesGetResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FilesGetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FileId) > 0 { + i -= len(m.FileId) + copy(dAtA[i:], m.FileId) + i = encodeVarintFile(dAtA, i, uint64(len(m.FileId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *CheckRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1894,6 +2129,11 @@ func (m *AccountInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.AccountLimitBytes != 0 { + i = encodeVarintFile(dAtA, i, uint64(m.AccountLimitBytes)) + i-- + dAtA[i] = 0x28 + } if len(m.Spaces) > 0 { for iNdEx := len(m.Spaces) - 1; iNdEx >= 0; iNdEx-- { { @@ -1926,6 +2166,76 @@ func (m *AccountInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *AccountLimitSetRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AccountLimitSetRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccountLimitSetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Limit != 0 { + i = encodeVarintFile(dAtA, i, uint64(m.Limit)) + i-- + dAtA[i] = 0x10 + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintFile(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SpaceLimitSetRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SpaceLimitSetRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SpaceLimitSetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Limit != 0 { + i = encodeVarintFile(dAtA, i, uint64(m.Limit)) + i-- + dAtA[i] = 0x10 + } + if len(m.SpaceId) > 0 { + i -= len(m.SpaceId) + copy(dAtA[i:], m.SpaceId) + i = encodeVarintFile(dAtA, i, uint64(len(m.SpaceId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintFile(dAtA []byte, offset int, v uint64) int { offset -= sovFile(v) base := offset @@ -1937,6 +2247,15 @@ func encodeVarintFile(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *Ok) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func (m *BlockGetRequest) Size() (n int) { if m == nil { return 0 @@ -1951,6 +2270,9 @@ func (m *BlockGetRequest) Size() (n int) { if l > 0 { n += 1 + l + sovFile(uint64(l)) } + if m.Wait { + n += 2 + } return n } @@ -1996,15 +2318,6 @@ func (m *BlockPushRequest) Size() (n int) { return n } -func (m *BlockPushResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func (m *BlocksCheckRequest) Size() (n int) { if m == nil { return 0 @@ -2078,15 +2391,6 @@ func (m *BlocksBindRequest) Size() (n int) { return n } -func (m *BlocksBindResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func (m *FilesDeleteRequest) Size() (n int) { if m == nil { return 0 @@ -2168,6 +2472,32 @@ func (m *FileInfo) Size() (n int) { return n } +func (m *FilesGetRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SpaceId) + if l > 0 { + n += 1 + l + sovFile(uint64(l)) + } + return n +} + +func (m *FilesGetResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FileId) + if l > 0 { + n += 1 + l + sovFile(uint64(l)) + } + return n +} + func (m *CheckRequest) Size() (n int) { if m == nil { return 0 @@ -2266,6 +2596,41 @@ func (m *AccountInfoResponse) Size() (n int) { n += 1 + l + sovFile(uint64(l)) } } + if m.AccountLimitBytes != 0 { + n += 1 + sovFile(uint64(m.AccountLimitBytes)) + } + return n +} + +func (m *AccountLimitSetRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovFile(uint64(l)) + } + if m.Limit != 0 { + n += 1 + sovFile(uint64(m.Limit)) + } + return n +} + +func (m *SpaceLimitSetRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SpaceId) + if l > 0 { + n += 1 + l + sovFile(uint64(l)) + } + if m.Limit != 0 { + n += 1 + sovFile(uint64(m.Limit)) + } return n } @@ -2275,6 +2640,56 @@ func sovFile(x uint64) (n int) { func sozFile(x uint64) (n int) { return sovFile(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *Ok) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Ok: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Ok: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipFile(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFile + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *BlockGetRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2370,6 +2785,26 @@ func (m *BlockGetRequest) Unmarshal(dAtA []byte) error { m.Cid = []byte{} } iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Wait", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Wait = bool(v != 0) default: iNdEx = preIndex skippy, err := skipFile(dAtA[iNdEx:]) @@ -2691,56 +3126,6 @@ func (m *BlockPushRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *BlockPushResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFile - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BlockPushResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BlockPushResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipFile(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthFile - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *BlocksCheckRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3188,56 +3573,6 @@ func (m *BlocksBindRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *BlocksBindResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFile - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BlocksBindResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BlocksBindResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipFile(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthFile - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *FilesDeleteRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3720,6 +4055,170 @@ func (m *FileInfo) Unmarshal(dAtA []byte) error { } return nil } +func (m *FilesGetRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FilesGetRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FilesGetRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpaceId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFile + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFile + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SpaceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFile(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFile + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FilesGetResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FilesGetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FilesGetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FileId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFile + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFile + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FileId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFile(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFile + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *CheckRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4301,6 +4800,227 @@ func (m *AccountInfoResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AccountLimitBytes", wireType) + } + m.AccountLimitBytes = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AccountLimitBytes |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipFile(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFile + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AccountLimitSetRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AccountLimitSetRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccountLimitSetRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFile + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFile + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) + } + m.Limit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Limit |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipFile(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFile + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SpaceLimitSetRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SpaceLimitSetRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SpaceLimitSetRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpaceId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFile + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFile + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SpaceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) + } + m.Limit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Limit |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipFile(dAtA[iNdEx:]) diff --git a/commonfile/fileproto/file_drpc.pb.go b/commonfile/fileproto/file_drpc.pb.go index aa2d2ef8..f649161a 100644 --- a/commonfile/fileproto/file_drpc.pb.go +++ b/commonfile/fileproto/file_drpc.pb.go @@ -41,14 +41,17 @@ type DRPCFileClient interface { DRPCConn() drpc.Conn BlockGet(ctx context.Context, in *BlockGetRequest) (*BlockGetResponse, error) - BlockPush(ctx context.Context, in *BlockPushRequest) (*BlockPushResponse, error) + BlockPush(ctx context.Context, in *BlockPushRequest) (*Ok, error) BlocksCheck(ctx context.Context, in *BlocksCheckRequest) (*BlocksCheckResponse, error) - BlocksBind(ctx context.Context, in *BlocksBindRequest) (*BlocksBindResponse, error) + BlocksBind(ctx context.Context, in *BlocksBindRequest) (*Ok, error) FilesDelete(ctx context.Context, in *FilesDeleteRequest) (*FilesDeleteResponse, error) FilesInfo(ctx context.Context, in *FilesInfoRequest) (*FilesInfoResponse, error) + FilesGet(ctx context.Context, in *FilesGetRequest) (DRPCFile_FilesGetClient, error) Check(ctx context.Context, in *CheckRequest) (*CheckResponse, error) SpaceInfo(ctx context.Context, in *SpaceInfoRequest) (*SpaceInfoResponse, error) AccountInfo(ctx context.Context, in *AccountInfoRequest) (*AccountInfoResponse, error) + AccountLimitSet(ctx context.Context, in *AccountLimitSetRequest) (*Ok, error) + SpaceLimitSet(ctx context.Context, in *SpaceLimitSetRequest) (*Ok, error) } type drpcFileClient struct { @@ -70,8 +73,8 @@ func (c *drpcFileClient) BlockGet(ctx context.Context, in *BlockGetRequest) (*Bl return out, nil } -func (c *drpcFileClient) BlockPush(ctx context.Context, in *BlockPushRequest) (*BlockPushResponse, error) { - out := new(BlockPushResponse) +func (c *drpcFileClient) BlockPush(ctx context.Context, in *BlockPushRequest) (*Ok, error) { + out := new(Ok) err := c.cc.Invoke(ctx, "/filesync.File/BlockPush", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, in, out) if err != nil { return nil, err @@ -88,8 +91,8 @@ func (c *drpcFileClient) BlocksCheck(ctx context.Context, in *BlocksCheckRequest return out, nil } -func (c *drpcFileClient) BlocksBind(ctx context.Context, in *BlocksBindRequest) (*BlocksBindResponse, error) { - out := new(BlocksBindResponse) +func (c *drpcFileClient) BlocksBind(ctx context.Context, in *BlocksBindRequest) (*Ok, error) { + out := new(Ok) err := c.cc.Invoke(ctx, "/filesync.File/BlocksBind", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, in, out) if err != nil { return nil, err @@ -115,6 +118,46 @@ func (c *drpcFileClient) FilesInfo(ctx context.Context, in *FilesInfoRequest) (* return out, nil } +func (c *drpcFileClient) FilesGet(ctx context.Context, in *FilesGetRequest) (DRPCFile_FilesGetClient, error) { + stream, err := c.cc.NewStream(ctx, "/filesync.File/FilesGet", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}) + if err != nil { + return nil, err + } + x := &drpcFile_FilesGetClient{stream} + if err := x.MsgSend(in, drpcEncoding_File_commonfile_fileproto_protos_file_proto{}); err != nil { + return nil, err + } + if err := x.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type DRPCFile_FilesGetClient interface { + drpc.Stream + Recv() (*FilesGetResponse, error) +} + +type drpcFile_FilesGetClient struct { + drpc.Stream +} + +func (x *drpcFile_FilesGetClient) GetStream() drpc.Stream { + return x.Stream +} + +func (x *drpcFile_FilesGetClient) Recv() (*FilesGetResponse, error) { + m := new(FilesGetResponse) + if err := x.MsgRecv(m, drpcEncoding_File_commonfile_fileproto_protos_file_proto{}); err != nil { + return nil, err + } + return m, nil +} + +func (x *drpcFile_FilesGetClient) RecvMsg(m *FilesGetResponse) error { + return x.MsgRecv(m, drpcEncoding_File_commonfile_fileproto_protos_file_proto{}) +} + func (c *drpcFileClient) Check(ctx context.Context, in *CheckRequest) (*CheckResponse, error) { out := new(CheckResponse) err := c.cc.Invoke(ctx, "/filesync.File/Check", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, in, out) @@ -142,16 +185,37 @@ func (c *drpcFileClient) AccountInfo(ctx context.Context, in *AccountInfoRequest return out, nil } +func (c *drpcFileClient) AccountLimitSet(ctx context.Context, in *AccountLimitSetRequest) (*Ok, error) { + out := new(Ok) + err := c.cc.Invoke(ctx, "/filesync.File/AccountLimitSet", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *drpcFileClient) SpaceLimitSet(ctx context.Context, in *SpaceLimitSetRequest) (*Ok, error) { + out := new(Ok) + err := c.cc.Invoke(ctx, "/filesync.File/SpaceLimitSet", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + type DRPCFileServer interface { BlockGet(context.Context, *BlockGetRequest) (*BlockGetResponse, error) - BlockPush(context.Context, *BlockPushRequest) (*BlockPushResponse, error) + BlockPush(context.Context, *BlockPushRequest) (*Ok, error) BlocksCheck(context.Context, *BlocksCheckRequest) (*BlocksCheckResponse, error) - BlocksBind(context.Context, *BlocksBindRequest) (*BlocksBindResponse, error) + BlocksBind(context.Context, *BlocksBindRequest) (*Ok, error) FilesDelete(context.Context, *FilesDeleteRequest) (*FilesDeleteResponse, error) FilesInfo(context.Context, *FilesInfoRequest) (*FilesInfoResponse, error) + FilesGet(*FilesGetRequest, DRPCFile_FilesGetStream) error Check(context.Context, *CheckRequest) (*CheckResponse, error) SpaceInfo(context.Context, *SpaceInfoRequest) (*SpaceInfoResponse, error) AccountInfo(context.Context, *AccountInfoRequest) (*AccountInfoResponse, error) + AccountLimitSet(context.Context, *AccountLimitSetRequest) (*Ok, error) + SpaceLimitSet(context.Context, *SpaceLimitSetRequest) (*Ok, error) } type DRPCFileUnimplementedServer struct{} @@ -160,7 +224,7 @@ func (s *DRPCFileUnimplementedServer) BlockGet(context.Context, *BlockGetRequest return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } -func (s *DRPCFileUnimplementedServer) BlockPush(context.Context, *BlockPushRequest) (*BlockPushResponse, error) { +func (s *DRPCFileUnimplementedServer) BlockPush(context.Context, *BlockPushRequest) (*Ok, error) { return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } @@ -168,7 +232,7 @@ func (s *DRPCFileUnimplementedServer) BlocksCheck(context.Context, *BlocksCheckR return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } -func (s *DRPCFileUnimplementedServer) BlocksBind(context.Context, *BlocksBindRequest) (*BlocksBindResponse, error) { +func (s *DRPCFileUnimplementedServer) BlocksBind(context.Context, *BlocksBindRequest) (*Ok, error) { return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } @@ -180,6 +244,10 @@ func (s *DRPCFileUnimplementedServer) FilesInfo(context.Context, *FilesInfoReque return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } +func (s *DRPCFileUnimplementedServer) FilesGet(*FilesGetRequest, DRPCFile_FilesGetStream) error { + return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + func (s *DRPCFileUnimplementedServer) Check(context.Context, *CheckRequest) (*CheckResponse, error) { return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } @@ -192,9 +260,17 @@ func (s *DRPCFileUnimplementedServer) AccountInfo(context.Context, *AccountInfoR return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } +func (s *DRPCFileUnimplementedServer) AccountLimitSet(context.Context, *AccountLimitSetRequest) (*Ok, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + +func (s *DRPCFileUnimplementedServer) SpaceLimitSet(context.Context, *SpaceLimitSetRequest) (*Ok, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + type DRPCFileDescription struct{} -func (DRPCFileDescription) NumMethods() int { return 9 } +func (DRPCFileDescription) NumMethods() int { return 12 } func (DRPCFileDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { switch n { @@ -253,6 +329,15 @@ func (DRPCFileDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, ) }, DRPCFileServer.FilesInfo, true case 6: + return "/filesync.File/FilesGet", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return nil, srv.(DRPCFileServer). + FilesGet( + in1.(*FilesGetRequest), + &drpcFile_FilesGetStream{in2.(drpc.Stream)}, + ) + }, DRPCFileServer.FilesGet, true + case 7: return "/filesync.File/Check", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCFileServer). @@ -261,7 +346,7 @@ func (DRPCFileDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, in1.(*CheckRequest), ) }, DRPCFileServer.Check, true - case 7: + case 8: return "/filesync.File/SpaceInfo", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCFileServer). @@ -270,7 +355,7 @@ func (DRPCFileDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, in1.(*SpaceInfoRequest), ) }, DRPCFileServer.SpaceInfo, true - case 8: + case 9: return "/filesync.File/AccountInfo", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCFileServer). @@ -279,6 +364,24 @@ func (DRPCFileDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, in1.(*AccountInfoRequest), ) }, DRPCFileServer.AccountInfo, true + case 10: + return "/filesync.File/AccountLimitSet", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCFileServer). + AccountLimitSet( + ctx, + in1.(*AccountLimitSetRequest), + ) + }, DRPCFileServer.AccountLimitSet, true + case 11: + return "/filesync.File/SpaceLimitSet", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCFileServer). + SpaceLimitSet( + ctx, + in1.(*SpaceLimitSetRequest), + ) + }, DRPCFileServer.SpaceLimitSet, true default: return "", nil, nil, nil, false } @@ -306,14 +409,14 @@ func (x *drpcFile_BlockGetStream) SendAndClose(m *BlockGetResponse) error { type DRPCFile_BlockPushStream interface { drpc.Stream - SendAndClose(*BlockPushResponse) error + SendAndClose(*Ok) error } type drpcFile_BlockPushStream struct { drpc.Stream } -func (x *drpcFile_BlockPushStream) SendAndClose(m *BlockPushResponse) error { +func (x *drpcFile_BlockPushStream) SendAndClose(m *Ok) error { if err := x.MsgSend(m, drpcEncoding_File_commonfile_fileproto_protos_file_proto{}); err != nil { return err } @@ -338,14 +441,14 @@ func (x *drpcFile_BlocksCheckStream) SendAndClose(m *BlocksCheckResponse) error type DRPCFile_BlocksBindStream interface { drpc.Stream - SendAndClose(*BlocksBindResponse) error + SendAndClose(*Ok) error } type drpcFile_BlocksBindStream struct { drpc.Stream } -func (x *drpcFile_BlocksBindStream) SendAndClose(m *BlocksBindResponse) error { +func (x *drpcFile_BlocksBindStream) SendAndClose(m *Ok) error { if err := x.MsgSend(m, drpcEncoding_File_commonfile_fileproto_protos_file_proto{}); err != nil { return err } @@ -384,6 +487,19 @@ func (x *drpcFile_FilesInfoStream) SendAndClose(m *FilesInfoResponse) error { return x.CloseSend() } +type DRPCFile_FilesGetStream interface { + drpc.Stream + Send(*FilesGetResponse) error +} + +type drpcFile_FilesGetStream struct { + drpc.Stream +} + +func (x *drpcFile_FilesGetStream) Send(m *FilesGetResponse) error { + return x.MsgSend(m, drpcEncoding_File_commonfile_fileproto_protos_file_proto{}) +} + type DRPCFile_CheckStream interface { drpc.Stream SendAndClose(*CheckResponse) error @@ -431,3 +547,35 @@ func (x *drpcFile_AccountInfoStream) SendAndClose(m *AccountInfoResponse) error } return x.CloseSend() } + +type DRPCFile_AccountLimitSetStream interface { + drpc.Stream + SendAndClose(*Ok) error +} + +type drpcFile_AccountLimitSetStream struct { + drpc.Stream +} + +func (x *drpcFile_AccountLimitSetStream) SendAndClose(m *Ok) error { + if err := x.MsgSend(m, drpcEncoding_File_commonfile_fileproto_protos_file_proto{}); err != nil { + return err + } + return x.CloseSend() +} + +type DRPCFile_SpaceLimitSetStream interface { + drpc.Stream + SendAndClose(*Ok) error +} + +type drpcFile_SpaceLimitSetStream struct { + drpc.Stream +} + +func (x *drpcFile_SpaceLimitSetStream) SendAndClose(m *Ok) error { + if err := x.MsgSend(m, drpcEncoding_File_commonfile_fileproto_protos_file_proto{}); err != nil { + return err + } + return x.CloseSend() +} diff --git a/commonfile/fileproto/fileprotoerr/fileprotoerr.go b/commonfile/fileproto/fileprotoerr/fileprotoerr.go index d5ff4d13..85f72786 100644 --- a/commonfile/fileproto/fileprotoerr/fileprotoerr.go +++ b/commonfile/fileproto/fileprotoerr/fileprotoerr.go @@ -2,6 +2,7 @@ package fileprotoerr import ( "fmt" + "github.com/anyproto/any-sync/commonfile/fileproto" "github.com/anyproto/any-sync/net/rpc/rpcerr" ) @@ -11,7 +12,8 @@ var ( ErrUnexpected = errGroup.Register(fmt.Errorf("unexpected fileproto error"), uint64(fileproto.ErrCodes_Unexpected)) ErrCIDNotFound = errGroup.Register(fmt.Errorf("CID not found"), uint64(fileproto.ErrCodes_CIDNotFound)) ErrForbidden = errGroup.Register(fmt.Errorf("forbidden"), uint64(fileproto.ErrCodes_Forbidden)) - ErrSpaceLimitExceeded = errGroup.Register(fmt.Errorf("space limit exceeded"), uint64(fileproto.ErrCodes_SpaceLimitExceeded)) + ErrSpaceLimitExceeded = errGroup.Register(fmt.Errorf("space limit exceeded"), uint64(fileproto.ErrCodes_LimitExceeded)) ErrQuerySizeExceeded = errGroup.Register(fmt.Errorf("query size exceeded"), uint64(fileproto.ErrCodes_QuerySizeExceeded)) + ErrNotEnoughSpace = errGroup.Register(fmt.Errorf("not enough space"), uint64(fileproto.ErrCodes_NotEnoughSpace)) ErrWrongHash = errGroup.Register(fmt.Errorf("wrong block hash"), uint64(fileproto.ErrCodes_WrongHash)) ) diff --git a/commonfile/fileproto/protos/file.proto b/commonfile/fileproto/protos/file.proto index c843300e..cd79e67c 100644 --- a/commonfile/fileproto/protos/file.proto +++ b/commonfile/fileproto/protos/file.proto @@ -7,9 +7,10 @@ enum ErrCodes { Unexpected = 0; CIDNotFound = 1; Forbidden = 2; - SpaceLimitExceeded = 3; + LimitExceeded = 3; QuerySizeExceeded = 4; WrongHash = 5; + NotEnoughSpace = 6; ErrorOffset = 200; } @@ -17,26 +18,35 @@ service File { // BlockGet gets one block from a server rpc BlockGet(BlockGetRequest) returns (BlockGetResponse); // BlockPush pushes one block to a server - rpc BlockPush(BlockPushRequest) returns (BlockPushResponse); + rpc BlockPush(BlockPushRequest) returns (Ok); // BlocksCheck checks is CIDs exists rpc BlocksCheck(BlocksCheckRequest) returns (BlocksCheckResponse); // BlocksBind binds CIDs to space - rpc BlocksBind(BlocksBindRequest) returns (BlocksBindResponse); + rpc BlocksBind(BlocksBindRequest) returns (Ok); // FilesDelete deletes files by id rpc FilesDelete(FilesDeleteRequest) returns (FilesDeleteResponse); // FilesInfo return info by given files id rpc FilesInfo(FilesInfoRequest) returns (FilesInfoResponse); + // FilesGet returns a stream that streams all file ids in the space + rpc FilesGet(FilesGetRequest) returns (stream FilesGetResponse); // Check checks the connection and credentials rpc Check(CheckRequest) returns (CheckResponse); // SpaceInfo returns usage, limit, etc about space rpc SpaceInfo(SpaceInfoRequest) returns (SpaceInfoResponse); // AccountInfo returns usage, limit, etc by all spaces rpc AccountInfo(AccountInfoRequest) returns (AccountInfoResponse); + // AccountLimitSet sets the account file storage limit (available only for nodeconf members) + rpc AccountLimitSet(AccountLimitSetRequest) returns (Ok); + // SpaceLimitSet sets the space limit. Limit 0 means space will use account limits. + rpc SpaceLimitSet(SpaceLimitSetRequest) returns (Ok); } +message Ok {} + message BlockGetRequest { string spaceId = 1; bytes cid = 2; + bool wait = 3; } message BlockGetResponse { @@ -51,9 +61,6 @@ message BlockPushRequest { bytes data = 4; } -message BlockPushResponse {} - - message BlocksCheckRequest { string spaceId = 1; repeated bytes cids = 2; @@ -80,8 +87,6 @@ message BlocksBindRequest { repeated bytes cids = 3; } -message BlocksBindResponse {} - message FilesDeleteRequest { string spaceId = 1; @@ -105,6 +110,15 @@ message FileInfo { uint32 cidsCount = 3; } +message FilesGetRequest { + string spaceId = 1; +} + +message FilesGetResponse { + string fileId = 1; +} + + message CheckRequest {} message CheckResponse { @@ -129,8 +143,22 @@ message AccountInfoRequest { } message AccountInfoResponse { + // the shared limit excluding isolated spaces uint64 limitBytes = 1; uint64 totalUsageBytes = 2; uint64 totalCidsCount = 3; repeated SpaceInfoResponse spaces = 4; + // the total limit including isolated spaces + uint64 accountLimitBytes = 5; +} + + +message AccountLimitSetRequest { + string identity = 1; + uint64 limit = 2; +} + +message SpaceLimitSetRequest { + string spaceId = 1; + uint64 limit = 2; } diff --git a/commonspace/acl/aclclient/acjoiningclient.go b/commonspace/acl/aclclient/acjoiningclient.go index 0a96255e..b273fac8 100644 --- a/commonspace/acl/aclclient/acjoiningclient.go +++ b/commonspace/acl/aclclient/acjoiningclient.go @@ -1,3 +1,4 @@ +//go:generate mockgen -destination mock_aclclient/mock_aclclient.go github.com/anyproto/any-sync/commonspace/acl/aclclient AclJoiningClient,AclSpaceClient package aclclient import ( @@ -10,7 +11,7 @@ import ( "github.com/anyproto/any-sync/commonspace/object/acl/list" "github.com/anyproto/any-sync/commonspace/object/acl/liststorage" "github.com/anyproto/any-sync/consensus/consensusproto" - "github.com/anyproto/any-sync/coordinator/coordinatorclient" + "github.com/anyproto/any-sync/node/nodeclient" ) const CName = "common.acl.aclclient" @@ -24,8 +25,8 @@ type AclJoiningClient interface { } type aclJoiningClient struct { - coordinatorClient coordinatorclient.CoordinatorClient - keys *accountdata.AccountKeys + nodeClient nodeclient.NodeClient + keys *accountdata.AccountKeys } func NewAclJoiningClient() AclJoiningClient { @@ -37,13 +38,13 @@ func (c *aclJoiningClient) Name() (name string) { } func (c *aclJoiningClient) Init(a *app.App) (err error) { - c.coordinatorClient = a.MustComponent(coordinatorclient.CName).(coordinatorclient.CoordinatorClient) + c.nodeClient = a.MustComponent(nodeclient.CName).(nodeclient.NodeClient) c.keys = a.MustComponent(accountservice.CName).(accountservice.Service).Account() return nil } func (c *aclJoiningClient) AclGetRecords(ctx context.Context, spaceId, aclHead string) (recs []*consensusproto.RawRecordWithId, err error) { - return c.coordinatorClient.AclGetRecords(ctx, spaceId, aclHead) + return c.nodeClient.AclGetRecords(ctx, spaceId, aclHead) } func (c *aclJoiningClient) getAcl(ctx context.Context, spaceId string) (l list.AclList, err error) { @@ -75,7 +76,7 @@ func (c *aclJoiningClient) CancelJoin(ctx context.Context, spaceId string) (err if err != nil { return } - _, err = c.coordinatorClient.AclAddRecord(ctx, spaceId, res) + _, err = c.nodeClient.AclAddRecord(ctx, spaceId, res) return } @@ -98,7 +99,7 @@ func (c *aclJoiningClient) RequestJoin(ctx context.Context, spaceId string, payl if err != nil { return } - recWithId, err := c.coordinatorClient.AclAddRecord(ctx, spaceId, rec) + recWithId, err := c.nodeClient.AclAddRecord(ctx, spaceId, rec) if err != nil { return } @@ -125,6 +126,6 @@ func (c *aclJoiningClient) CancelRemoveSelf(ctx context.Context, spaceId string) if err != nil { return } - _, err = c.coordinatorClient.AclAddRecord(ctx, spaceId, newRec) + _, err = c.nodeClient.AclAddRecord(ctx, spaceId, newRec) return } diff --git a/commonspace/acl/aclclient/aclspaceclient.go b/commonspace/acl/aclclient/aclspaceclient.go index 61182d42..c007fbc0 100644 --- a/commonspace/acl/aclclient/aclspaceclient.go +++ b/commonspace/acl/aclclient/aclspaceclient.go @@ -9,7 +9,7 @@ import ( "github.com/anyproto/any-sync/commonspace/object/acl/syncacl" "github.com/anyproto/any-sync/commonspace/spacestate" "github.com/anyproto/any-sync/consensus/consensusproto" - "github.com/anyproto/any-sync/coordinator/coordinatorclient" + "github.com/anyproto/any-sync/node/nodeclient" "github.com/anyproto/any-sync/util/crypto" ) @@ -45,13 +45,13 @@ func NewAclSpaceClient() AclSpaceClient { } type aclSpaceClient struct { - coordinatorClient coordinatorclient.CoordinatorClient - acl list.AclList - spaceId string + nodeClient nodeclient.NodeClient + acl list.AclList + spaceId string } func (c *aclSpaceClient) Init(a *app.App) (err error) { - c.coordinatorClient = a.MustComponent(coordinatorclient.CName).(coordinatorclient.CoordinatorClient) + c.nodeClient = a.MustComponent(nodeclient.CName).(nodeclient.NodeClient) c.acl = a.MustComponent(syncacl.CName).(list.AclList) c.spaceId = a.MustComponent(spacestate.CName).(*spacestate.SpaceState).SpaceId return nil @@ -132,6 +132,10 @@ func (c *aclSpaceClient) RevokeAllInvites(ctx context.Context) (err error) { func (c *aclSpaceClient) StopSharing(ctx context.Context, readKeyChange list.ReadKeyChangePayload) (err error) { c.acl.Lock() + if c.acl.AclState().IsEmpty() { + c.acl.Unlock() + return + } var ( identities []crypto.PubKey recIds []string @@ -217,7 +221,7 @@ func (c *aclSpaceClient) AddRecord(ctx context.Context, consRec *consensusproto. } func (c *aclSpaceClient) sendRecordAndUpdate(ctx context.Context, spaceId string, rec *consensusproto.RawRecord) (err error) { - res, err := c.coordinatorClient.AclAddRecord(ctx, spaceId, rec) + res, err := c.nodeClient.AclAddRecord(ctx, spaceId, rec) if err != nil { return } diff --git a/commonspace/acl/aclclient/aclspaceclient_test.go b/commonspace/acl/aclclient/aclspaceclient_test.go new file mode 100644 index 00000000..bfe94a53 --- /dev/null +++ b/commonspace/acl/aclclient/aclspaceclient_test.go @@ -0,0 +1,131 @@ +package aclclient + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" + + "github.com/anyproto/any-sync/app" + "github.com/anyproto/any-sync/commonspace/object/acl/list" + "github.com/anyproto/any-sync/commonspace/object/acl/syncacl" + "github.com/anyproto/any-sync/commonspace/spacestate" + "github.com/anyproto/any-sync/consensus/consensusproto" + "github.com/anyproto/any-sync/node/nodeclient" + "github.com/anyproto/any-sync/node/nodeclient/mock_nodeclient" + "github.com/anyproto/any-sync/testutil/anymock" + "github.com/anyproto/any-sync/util/cidutil" + "github.com/anyproto/any-sync/util/crypto" +) + +var ctx = context.Background() + +func TestAclSpaceClient_StopSharing(t *testing.T) { + t.Run("not empty", func(t *testing.T) { + fx := newFixture(t) + defer fx.finish(t) + cmds := []string{ + "a.invite::invId", + "b.join::invId", + "c.join::invId", + "a.approve::c,r", + } + for _, cmd := range cmds { + err := fx.exec.Execute(cmd) + require.NoError(t, err) + } + newPrivKey, _, err := crypto.GenerateRandomEd25519KeyPair() + require.NoError(t, err) + st := fx.acl.AclState() + require.False(t, st.IsEmpty()) + fx.nodeClient.EXPECT().AclAddRecord(ctx, fx.spaceState.SpaceId, gomock.Any()).DoAndReturn( + func(ctx context.Context, spaceId string, rec *consensusproto.RawRecord) (*consensusproto.RawRecordWithId, error) { + return marshallRecord(t, rec), nil + }) + err = fx.StopSharing(ctx, list.ReadKeyChangePayload{ + MetadataKey: newPrivKey, + ReadKey: crypto.NewAES(), + }) + st = fx.acl.AclState() + require.True(t, st.IsEmpty()) + }) + t.Run("already empty", func(t *testing.T) { + fx := newFixture(t) + defer fx.finish(t) + newPrivKey, _, err := crypto.GenerateRandomEd25519KeyPair() + require.NoError(t, err) + st := fx.acl.AclState() + require.True(t, st.IsEmpty()) + err = fx.StopSharing(ctx, list.ReadKeyChangePayload{ + MetadataKey: newPrivKey, + ReadKey: crypto.NewAES(), + }) + st = fx.acl.AclState() + require.True(t, st.IsEmpty()) + }) +} + +type namedAcl struct { + list.AclList +} + +func (a *namedAcl) Name() string { + return syncacl.CName +} + +func (a *namedAcl) Init(app *app.App) error { + return nil +} + +func marshallRecord(t *testing.T, rec *consensusproto.RawRecord) *consensusproto.RawRecordWithId { + data, err := rec.Marshal() + require.NoError(t, err) + recId, err := cidutil.NewCidFromBytes(data) + require.NoError(t, err) + return &consensusproto.RawRecordWithId{ + Payload: data, + Id: recId, + } +} + +type fixture struct { + *aclSpaceClient + a *app.App + ctrl *gomock.Controller + nodeClient *mock_nodeclient.MockNodeClient + acl list.AclList + spaceState *spacestate.SpaceState + exec *list.AclTestExecutor +} + +func newFixture(t *testing.T) *fixture { + ctrl := gomock.NewController(t) + spaceId := "spaceId" + exec := list.NewAclExecutor(spaceId) + err := exec.Execute("a.init::a") + require.NoError(t, err) + acl := exec.ActualAccounts()["a"].Acl + fx := &fixture{ + aclSpaceClient: NewAclSpaceClient().(*aclSpaceClient), + ctrl: ctrl, + acl: acl, + nodeClient: mock_nodeclient.NewMockNodeClient(ctrl), + spaceState: &spacestate.SpaceState{SpaceId: spaceId}, + a: new(app.App), + exec: exec, + } + anymock.ExpectComp(fx.nodeClient.EXPECT(), nodeclient.CName) + fx.a.Register(fx.spaceState). + Register(fx.nodeClient). + Register(&namedAcl{acl}). + Register(fx) + + require.NoError(t, fx.a.Start(ctx)) + return fx +} + +func (fx *fixture) finish(t *testing.T) { + require.NoError(t, fx.a.Close(ctx)) + fx.ctrl.Finish() +} diff --git a/commonspace/acl/aclclient/mock_aclclient/mock_aclclient.go b/commonspace/acl/aclclient/mock_aclclient/mock_aclclient.go new file mode 100644 index 00000000..3994a66d --- /dev/null +++ b/commonspace/acl/aclclient/mock_aclclient/mock_aclclient.go @@ -0,0 +1,350 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/anyproto/any-sync/commonspace/acl/aclclient (interfaces: AclJoiningClient,AclSpaceClient) +// +// Generated by this command: +// +// mockgen -destination mock_aclclient/mock_aclclient.go github.com/anyproto/any-sync/commonspace/acl/aclclient AclJoiningClient,AclSpaceClient +// + +// Package mock_aclclient is a generated GoMock package. +package mock_aclclient + +import ( + context "context" + reflect "reflect" + + app "github.com/anyproto/any-sync/app" + list "github.com/anyproto/any-sync/commonspace/object/acl/list" + consensusproto "github.com/anyproto/any-sync/consensus/consensusproto" + crypto "github.com/anyproto/any-sync/util/crypto" + gomock "go.uber.org/mock/gomock" +) + +// MockAclJoiningClient is a mock of AclJoiningClient interface. +type MockAclJoiningClient struct { + ctrl *gomock.Controller + recorder *MockAclJoiningClientMockRecorder +} + +// MockAclJoiningClientMockRecorder is the mock recorder for MockAclJoiningClient. +type MockAclJoiningClientMockRecorder struct { + mock *MockAclJoiningClient +} + +// NewMockAclJoiningClient creates a new mock instance. +func NewMockAclJoiningClient(ctrl *gomock.Controller) *MockAclJoiningClient { + mock := &MockAclJoiningClient{ctrl: ctrl} + mock.recorder = &MockAclJoiningClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAclJoiningClient) EXPECT() *MockAclJoiningClientMockRecorder { + return m.recorder +} + +// AclGetRecords mocks base method. +func (m *MockAclJoiningClient) AclGetRecords(arg0 context.Context, arg1, arg2 string) ([]*consensusproto.RawRecordWithId, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AclGetRecords", arg0, arg1, arg2) + ret0, _ := ret[0].([]*consensusproto.RawRecordWithId) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AclGetRecords indicates an expected call of AclGetRecords. +func (mr *MockAclJoiningClientMockRecorder) AclGetRecords(arg0, arg1, arg2 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AclGetRecords", reflect.TypeOf((*MockAclJoiningClient)(nil).AclGetRecords), arg0, arg1, arg2) +} + +// CancelJoin mocks base method. +func (m *MockAclJoiningClient) CancelJoin(arg0 context.Context, arg1 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CancelJoin", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// CancelJoin indicates an expected call of CancelJoin. +func (mr *MockAclJoiningClientMockRecorder) CancelJoin(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelJoin", reflect.TypeOf((*MockAclJoiningClient)(nil).CancelJoin), arg0, arg1) +} + +// CancelRemoveSelf mocks base method. +func (m *MockAclJoiningClient) CancelRemoveSelf(arg0 context.Context, arg1 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CancelRemoveSelf", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// CancelRemoveSelf indicates an expected call of CancelRemoveSelf. +func (mr *MockAclJoiningClientMockRecorder) CancelRemoveSelf(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelRemoveSelf", reflect.TypeOf((*MockAclJoiningClient)(nil).CancelRemoveSelf), arg0, arg1) +} + +// Init mocks base method. +func (m *MockAclJoiningClient) Init(arg0 *app.App) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Init", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Init indicates an expected call of Init. +func (mr *MockAclJoiningClientMockRecorder) Init(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Init", reflect.TypeOf((*MockAclJoiningClient)(nil).Init), arg0) +} + +// Name mocks base method. +func (m *MockAclJoiningClient) Name() string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Name") + ret0, _ := ret[0].(string) + return ret0 +} + +// Name indicates an expected call of Name. +func (mr *MockAclJoiningClientMockRecorder) Name() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockAclJoiningClient)(nil).Name)) +} + +// RequestJoin mocks base method. +func (m *MockAclJoiningClient) RequestJoin(arg0 context.Context, arg1 string, arg2 list.RequestJoinPayload) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RequestJoin", arg0, arg1, arg2) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RequestJoin indicates an expected call of RequestJoin. +func (mr *MockAclJoiningClientMockRecorder) RequestJoin(arg0, arg1, arg2 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RequestJoin", reflect.TypeOf((*MockAclJoiningClient)(nil).RequestJoin), arg0, arg1, arg2) +} + +// MockAclSpaceClient is a mock of AclSpaceClient interface. +type MockAclSpaceClient struct { + ctrl *gomock.Controller + recorder *MockAclSpaceClientMockRecorder +} + +// MockAclSpaceClientMockRecorder is the mock recorder for MockAclSpaceClient. +type MockAclSpaceClientMockRecorder struct { + mock *MockAclSpaceClient +} + +// NewMockAclSpaceClient creates a new mock instance. +func NewMockAclSpaceClient(ctrl *gomock.Controller) *MockAclSpaceClient { + mock := &MockAclSpaceClient{ctrl: ctrl} + mock.recorder = &MockAclSpaceClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAclSpaceClient) EXPECT() *MockAclSpaceClientMockRecorder { + return m.recorder +} + +// AcceptRequest mocks base method. +func (m *MockAclSpaceClient) AcceptRequest(arg0 context.Context, arg1 list.RequestAcceptPayload) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AcceptRequest", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// AcceptRequest indicates an expected call of AcceptRequest. +func (mr *MockAclSpaceClientMockRecorder) AcceptRequest(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcceptRequest", reflect.TypeOf((*MockAclSpaceClient)(nil).AcceptRequest), arg0, arg1) +} + +// AddAccounts mocks base method. +func (m *MockAclSpaceClient) AddAccounts(arg0 context.Context, arg1 list.AccountsAddPayload) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddAccounts", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// AddAccounts indicates an expected call of AddAccounts. +func (mr *MockAclSpaceClientMockRecorder) AddAccounts(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddAccounts", reflect.TypeOf((*MockAclSpaceClient)(nil).AddAccounts), arg0, arg1) +} + +// AddRecord mocks base method. +func (m *MockAclSpaceClient) AddRecord(arg0 context.Context, arg1 *consensusproto.RawRecord) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddRecord", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// AddRecord indicates an expected call of AddRecord. +func (mr *MockAclSpaceClientMockRecorder) AddRecord(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddRecord", reflect.TypeOf((*MockAclSpaceClient)(nil).AddRecord), arg0, arg1) +} + +// CancelRequest mocks base method. +func (m *MockAclSpaceClient) CancelRequest(arg0 context.Context) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CancelRequest", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// CancelRequest indicates an expected call of CancelRequest. +func (mr *MockAclSpaceClientMockRecorder) CancelRequest(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelRequest", reflect.TypeOf((*MockAclSpaceClient)(nil).CancelRequest), arg0) +} + +// ChangePermissions mocks base method. +func (m *MockAclSpaceClient) ChangePermissions(arg0 context.Context, arg1 list.PermissionChangesPayload) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ChangePermissions", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ChangePermissions indicates an expected call of ChangePermissions. +func (mr *MockAclSpaceClientMockRecorder) ChangePermissions(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChangePermissions", reflect.TypeOf((*MockAclSpaceClient)(nil).ChangePermissions), arg0, arg1) +} + +// DeclineRequest mocks base method. +func (m *MockAclSpaceClient) DeclineRequest(arg0 context.Context, arg1 crypto.PubKey) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeclineRequest", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeclineRequest indicates an expected call of DeclineRequest. +func (mr *MockAclSpaceClientMockRecorder) DeclineRequest(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeclineRequest", reflect.TypeOf((*MockAclSpaceClient)(nil).DeclineRequest), arg0, arg1) +} + +// GenerateInvite mocks base method. +func (m *MockAclSpaceClient) GenerateInvite() (list.InviteResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GenerateInvite") + ret0, _ := ret[0].(list.InviteResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GenerateInvite indicates an expected call of GenerateInvite. +func (mr *MockAclSpaceClientMockRecorder) GenerateInvite() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateInvite", reflect.TypeOf((*MockAclSpaceClient)(nil).GenerateInvite)) +} + +// Init mocks base method. +func (m *MockAclSpaceClient) Init(arg0 *app.App) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Init", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Init indicates an expected call of Init. +func (mr *MockAclSpaceClientMockRecorder) Init(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Init", reflect.TypeOf((*MockAclSpaceClient)(nil).Init), arg0) +} + +// Name mocks base method. +func (m *MockAclSpaceClient) Name() string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Name") + ret0, _ := ret[0].(string) + return ret0 +} + +// Name indicates an expected call of Name. +func (mr *MockAclSpaceClientMockRecorder) Name() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockAclSpaceClient)(nil).Name)) +} + +// RemoveAccounts mocks base method. +func (m *MockAclSpaceClient) RemoveAccounts(arg0 context.Context, arg1 list.AccountRemovePayload) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RemoveAccounts", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// RemoveAccounts indicates an expected call of RemoveAccounts. +func (mr *MockAclSpaceClientMockRecorder) RemoveAccounts(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveAccounts", reflect.TypeOf((*MockAclSpaceClient)(nil).RemoveAccounts), arg0, arg1) +} + +// RequestSelfRemove mocks base method. +func (m *MockAclSpaceClient) RequestSelfRemove(arg0 context.Context) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RequestSelfRemove", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// RequestSelfRemove indicates an expected call of RequestSelfRemove. +func (mr *MockAclSpaceClientMockRecorder) RequestSelfRemove(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RequestSelfRemove", reflect.TypeOf((*MockAclSpaceClient)(nil).RequestSelfRemove), arg0) +} + +// RevokeAllInvites mocks base method. +func (m *MockAclSpaceClient) RevokeAllInvites(arg0 context.Context) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RevokeAllInvites", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// RevokeAllInvites indicates an expected call of RevokeAllInvites. +func (mr *MockAclSpaceClientMockRecorder) RevokeAllInvites(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevokeAllInvites", reflect.TypeOf((*MockAclSpaceClient)(nil).RevokeAllInvites), arg0) +} + +// RevokeInvite mocks base method. +func (m *MockAclSpaceClient) RevokeInvite(arg0 context.Context, arg1 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RevokeInvite", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// RevokeInvite indicates an expected call of RevokeInvite. +func (mr *MockAclSpaceClientMockRecorder) RevokeInvite(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevokeInvite", reflect.TypeOf((*MockAclSpaceClient)(nil).RevokeInvite), arg0, arg1) +} + +// StopSharing mocks base method. +func (m *MockAclSpaceClient) StopSharing(arg0 context.Context, arg1 list.ReadKeyChangePayload) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "StopSharing", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// StopSharing indicates an expected call of StopSharing. +func (mr *MockAclSpaceClientMockRecorder) StopSharing(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StopSharing", reflect.TypeOf((*MockAclSpaceClient)(nil).StopSharing), arg0, arg1) +} diff --git a/commonspace/deletion_test.go b/commonspace/deletion_test.go index 3d1f2dc2..e3289954 100644 --- a/commonspace/deletion_test.go +++ b/commonspace/deletion_test.go @@ -3,6 +3,12 @@ package commonspace import ( "context" "fmt" + "math/rand" + "testing" + "time" + + "github.com/stretchr/testify/require" + "github.com/anyproto/any-sync/commonspace/object/accountdata" "github.com/anyproto/any-sync/commonspace/object/tree/objecttree" "github.com/anyproto/any-sync/commonspace/object/tree/treechangeproto" @@ -12,10 +18,6 @@ import ( "github.com/anyproto/any-sync/commonspace/spacestorage" "github.com/anyproto/any-sync/commonspace/spacesyncproto" "github.com/anyproto/any-sync/util/crypto" - "github.com/stretchr/testify/require" - "math/rand" - "testing" - "time" ) func addIncorrectSnapshot(settingsObject settings.SettingsObject, acc *accountdata.AccountKeys, partialIds map[string]struct{}, newId string) (err error) { diff --git a/commonspace/mock_commonspace/mock_commonspace.go b/commonspace/mock_commonspace/mock_commonspace.go index 948e0d2c..40203a5a 100644 --- a/commonspace/mock_commonspace/mock_commonspace.go +++ b/commonspace/mock_commonspace/mock_commonspace.go @@ -19,13 +19,13 @@ import ( headsync "github.com/anyproto/any-sync/commonspace/headsync" syncacl "github.com/anyproto/any-sync/commonspace/object/acl/syncacl" treesyncer "github.com/anyproto/any-sync/commonspace/object/treesyncer" - objectsync "github.com/anyproto/any-sync/commonspace/objectsync" objecttreebuilder "github.com/anyproto/any-sync/commonspace/objecttreebuilder" spacestorage "github.com/anyproto/any-sync/commonspace/spacestorage" spacesyncproto "github.com/anyproto/any-sync/commonspace/spacesyncproto" syncstatus "github.com/anyproto/any-sync/commonspace/syncstatus" peer "github.com/anyproto/any-sync/net/peer" gomock "go.uber.org/mock/gomock" + drpc "storj.io/drpc" ) // MockSpace is a mock of Space interface. @@ -151,20 +151,6 @@ func (mr *MockSpaceMockRecorder) GetNodePeers(arg0 any) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNodePeers", reflect.TypeOf((*MockSpace)(nil).GetNodePeers), arg0) } -// HandleMessage mocks base method. -func (m *MockSpace) HandleMessage(arg0 context.Context, arg1 objectsync.HandleMessage) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "HandleMessage", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// HandleMessage indicates an expected call of HandleMessage. -func (mr *MockSpaceMockRecorder) HandleMessage(arg0, arg1 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleMessage", reflect.TypeOf((*MockSpace)(nil).HandleMessage), arg0, arg1) -} - // HandleRangeRequest mocks base method. func (m *MockSpace) HandleRangeRequest(arg0 context.Context, arg1 *spacesyncproto.HeadSyncRequest) (*spacesyncproto.HeadSyncResponse, error) { m.ctrl.T.Helper() @@ -180,19 +166,32 @@ func (mr *MockSpaceMockRecorder) HandleRangeRequest(arg0, arg1 any) *gomock.Call return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleRangeRequest", reflect.TypeOf((*MockSpace)(nil).HandleRangeRequest), arg0, arg1) } -// HandleSyncRequest mocks base method. -func (m *MockSpace) HandleSyncRequest(arg0 context.Context, arg1 *spacesyncproto.ObjectSyncMessage) (*spacesyncproto.ObjectSyncMessage, error) { +// HandleStream mocks base method. +func (m *MockSpace) HandleStream(arg0 spacesyncproto.DRPCSpaceSync_ObjectSyncStreamStream) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "HandleSyncRequest", arg0, arg1) - ret0, _ := ret[0].(*spacesyncproto.ObjectSyncMessage) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "HandleStream", arg0) + ret0, _ := ret[0].(error) + return ret0 } -// HandleSyncRequest indicates an expected call of HandleSyncRequest. -func (mr *MockSpaceMockRecorder) HandleSyncRequest(arg0, arg1 any) *gomock.Call { +// HandleStream indicates an expected call of HandleStream. +func (mr *MockSpaceMockRecorder) HandleStream(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleSyncRequest", reflect.TypeOf((*MockSpace)(nil).HandleSyncRequest), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleStream", reflect.TypeOf((*MockSpace)(nil).HandleStream), arg0) +} + +// HandleStreamSyncRequest mocks base method. +func (m *MockSpace) HandleStreamSyncRequest(arg0 context.Context, arg1 *spacesyncproto.ObjectSyncMessage, arg2 drpc.Stream) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "HandleStreamSyncRequest", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// HandleStreamSyncRequest indicates an expected call of HandleStreamSyncRequest. +func (mr *MockSpaceMockRecorder) HandleStreamSyncRequest(arg0, arg1, arg2 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleStreamSyncRequest", reflect.TypeOf((*MockSpace)(nil).HandleStreamSyncRequest), arg0, arg1, arg2) } // Id mocks base method. diff --git a/commonspace/object/acl/list/aclstate.go b/commonspace/object/acl/list/aclstate.go index 1a45dfce..0f16f740 100644 --- a/commonspace/object/acl/list/aclstate.go +++ b/commonspace/object/acl/list/aclstate.go @@ -34,6 +34,7 @@ var ( ErrIncorrectRoot = errors.New("incorrect root") ErrIncorrectRecordSequence = errors.New("incorrect prev id of a record") ErrMetadataTooLarge = errors.New("metadata size too large") + ErrOwnerNotFound = errors.New("owner not found") ) const MaxMetadataLen = 1024 @@ -228,6 +229,16 @@ func (st *AclState) ApplyRecord(record *AclRecord) (err error) { return } +func (st *AclState) IsEmpty() bool { + users := 0 + for _, acc := range st.CurrentAccounts() { + if !acc.Permissions.NoPermissions() { + users++ + } + } + return users == 1 && len(st.Invites()) == 0 && len(st.pendingRequests) == 0 +} + func (st *AclState) applyRoot(record *AclRecord) (err error) { root, ok := record.Model.(*aclrecordproto.AclRoot) if !ok { @@ -844,6 +855,15 @@ func (st *AclState) LastRecordId() string { return st.lastRecordId } +func (st *AclState) OwnerPubKey() (ownerIdentity crypto.PubKey, err error) { + for _, aState := range st.accountStates { + if aState.Permissions.IsOwner() { + return aState.PubKey, nil + } + } + return nil, ErrOwnerNotFound +} + func (st *AclState) deriveKey() (crypto.SymKey, error) { keyBytes, err := st.key.Raw() if err != nil { diff --git a/commonspace/object/acl/list/aclstate_test.go b/commonspace/object/acl/list/aclstate_test.go new file mode 100644 index 00000000..cae40dc8 --- /dev/null +++ b/commonspace/object/acl/list/aclstate_test.go @@ -0,0 +1,70 @@ +package list + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestAclStateIsEmpty(t *testing.T) { + t.Run("not empty when invites", func(t *testing.T) { + a := NewAclExecutor("spaceId") + cmds := []string{ + "a.init::a", + "a.invite::invId", + } + for _, cmd := range cmds { + err := a.Execute(cmd) + require.NoError(t, err) + } + st := a.ActualAccounts()["a"].Acl.AclState() + require.False(t, st.IsEmpty()) + }) + t.Run("not empty when joining requests", func(t *testing.T) { + a := NewAclExecutor("spaceId") + cmds := []string{ + "a.init::a", + "a.invite::invId", + "b.join::invId", + "a.revoke::invId", + } + for _, cmd := range cmds { + err := a.Execute(cmd) + require.NoError(t, err) + } + st := a.ActualAccounts()["a"].Acl.AclState() + require.False(t, st.IsEmpty()) + }) + t.Run("not empty when users", func(t *testing.T) { + a := NewAclExecutor("spaceId") + cmds := []string{ + "a.init::a", + "a.invite::invId", + "b.join::invId", + "a.revoke::invId", + "a.approve::b,r", + } + for _, cmd := range cmds { + err := a.Execute(cmd) + require.NoError(t, err) + } + st := a.ActualAccounts()["a"].Acl.AclState() + require.False(t, st.IsEmpty()) + }) + t.Run("empty when no joining requests, no invites and no users", func(t *testing.T) { + a := NewAclExecutor("spaceId") + cmds := []string{ + "a.init::a", + "a.invite::invId", + "b.join::invId", + "a.decline::b", + "a.revoke::invId", + } + for _, cmd := range cmds { + err := a.Execute(cmd) + require.NoError(t, err) + } + st := a.ActualAccounts()["a"].Acl.AclState() + require.True(t, st.IsEmpty()) + }) +} diff --git a/commonspace/object/acl/list/list_test.go b/commonspace/object/acl/list/list_test.go index 4084baa0..1aae71c0 100644 --- a/commonspace/object/acl/list/list_test.go +++ b/commonspace/object/acl/list/list_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/anyproto/any-sync/commonspace/object/accountdata" @@ -395,3 +396,10 @@ func TestAclList_RequestRemove(t *testing.T) { require.Nil(t, accountState().keys[removeRec.Id].ReadKey) require.NotEmpty(t, accountState().keys[fx.ownerAcl.Id()]) } + +func TestAclState_OwnerPubKey(t *testing.T) { + fx := newFixture(t) + pubKey, err := fx.ownerAcl.AclState().OwnerPubKey() + require.NoError(t, err) + assert.Equal(t, fx.ownerKeys.SignKey.GetPublic().Account(), pubKey.Account()) +} diff --git a/commonspace/object/acl/list/listutils.go b/commonspace/object/acl/list/listutils.go index 77fe2084..397653c5 100644 --- a/commonspace/object/acl/list/listutils.go +++ b/commonspace/object/acl/list/listutils.go @@ -1,6 +1,8 @@ package list import ( + "fmt" + "github.com/anyproto/any-sync/commonspace/object/accountdata" "github.com/anyproto/any-sync/commonspace/object/acl/liststorage" "github.com/anyproto/any-sync/consensus/consensusproto" @@ -53,3 +55,30 @@ func NewTestAclWithRoot(keys *accountdata.AccountKeys, root *consensusproto.RawR } return BuildAclListWithIdentity(keys, st, NoOpAcceptorVerifier{}) } + +func NewTestAclStateWithUsers(numWriters, numReaders, numInvites int) *AclState { + st := &AclState{ + keys: make(map[string]AclKeys), + accountStates: make(map[string]AccountState), + inviteKeys: make(map[string]crypto.PubKey), + requestRecords: make(map[string]RequestRecord), + pendingRequests: make(map[string]string), + keyStore: crypto.NewKeyStorage(), + } + for i := 0; i < numWriters; i++ { + st.accountStates[fmt.Sprint("w", i)] = AccountState{ + Permissions: AclPermissionsWriter, + Status: StatusActive, + } + } + for i := 0; i < numReaders; i++ { + st.accountStates[fmt.Sprint("r", i)] = AccountState{ + Permissions: AclPermissionsReader, + Status: StatusActive, + } + } + for i := 0; i < numInvites; i++ { + st.inviteKeys[fmt.Sprint("r", i)] = nil + } + return st +} diff --git a/commonspace/object/acl/syncacl/mock_syncacl/mock_syncacl.go b/commonspace/object/acl/syncacl/mock_syncacl/mock_syncacl.go index 8ff0c633..c9f88108 100644 --- a/commonspace/object/acl/syncacl/mock_syncacl/mock_syncacl.go +++ b/commonspace/object/acl/syncacl/mock_syncacl/mock_syncacl.go @@ -5,6 +5,7 @@ // // mockgen -destination mock_syncacl/mock_syncacl.go github.com/anyproto/any-sync/commonspace/object/acl/syncacl SyncAcl,SyncClient,RequestFactory,AclSyncProtocol // + // Package mock_syncacl is a generated GoMock package. package mock_syncacl diff --git a/commonspace/object/tree/exporter/treeexporter.go b/commonspace/object/tree/exporter/treeexporter.go index 25723561..be9ead92 100644 --- a/commonspace/object/tree/exporter/treeexporter.go +++ b/commonspace/object/tree/exporter/treeexporter.go @@ -9,8 +9,8 @@ import ( ) type DataConverter interface { - Unmarshall(decrypted []byte) (any, error) - Marshall(model any) ([]byte, error) + Unmarshall(dataType string, decrypted []byte) (any, error) + Marshall(model any) (data []byte, dataType string, err error) } type TreeExporterParams struct { @@ -59,21 +59,25 @@ func (t *treeExporter) ExportUnencrypted(tree objecttree.ReadableObjectTree) (er } err = tree.IterateRoot( func(change *objecttree.Change, decrypted []byte) (any, error) { - return t.converter.Unmarshall(decrypted) + return t.converter.Unmarshall(change.DataType, decrypted) }, func(change *objecttree.Change) bool { if change.Id == tree.Id() { err = putStorage(change) return err == nil } - var data []byte - data, err = t.converter.Marshall(change.Model) + var ( + data []byte + dataType string + ) + data, dataType, err = t.converter.Marshall(change.Model) if err != nil { return false } // that means that change is unencrypted change.ReadKeyId = "" change.Data = data + change.DataType = dataType err = putStorage(change) return err == nil }) diff --git a/commonspace/object/tree/objecttree/mock_objecttree/mock_objecttree.go b/commonspace/object/tree/objecttree/mock_objecttree/mock_objecttree.go index 46669ee9..85736c6f 100644 --- a/commonspace/object/tree/objecttree/mock_objecttree/mock_objecttree.go +++ b/commonspace/object/tree/objecttree/mock_objecttree/mock_objecttree.go @@ -333,30 +333,6 @@ func (mr *MockObjectTreeMockRecorder) PrepareChange(arg0 any) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PrepareChange", reflect.TypeOf((*MockObjectTree)(nil).PrepareChange), arg0) } -// RLock mocks base method. -func (m *MockObjectTree) RLock() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "RLock") -} - -// RLock indicates an expected call of RLock. -func (mr *MockObjectTreeMockRecorder) RLock() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RLock", reflect.TypeOf((*MockObjectTree)(nil).RLock)) -} - -// RUnlock mocks base method. -func (m *MockObjectTree) RUnlock() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "RUnlock") -} - -// RUnlock indicates an expected call of RUnlock. -func (mr *MockObjectTreeMockRecorder) RUnlock() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RUnlock", reflect.TypeOf((*MockObjectTree)(nil).RUnlock)) -} - // Root mocks base method. func (m *MockObjectTree) Root() *objecttree.Change { m.ctrl.T.Helper() @@ -428,20 +404,6 @@ func (mr *MockObjectTreeMockRecorder) TryLock() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TryLock", reflect.TypeOf((*MockObjectTree)(nil).TryLock)) } -// TryRLock mocks base method. -func (m *MockObjectTree) TryRLock() bool { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TryRLock") - ret0, _ := ret[0].(bool) - return ret0 -} - -// TryRLock indicates an expected call of TryRLock. -func (mr *MockObjectTreeMockRecorder) TryRLock() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TryRLock", reflect.TypeOf((*MockObjectTree)(nil).TryRLock)) -} - // Unlock mocks base method. func (m *MockObjectTree) Unlock() { m.ctrl.T.Helper() diff --git a/commonspace/object/tree/objecttree/objecttree.go b/commonspace/object/tree/objecttree/objecttree.go index b0088281..7a894713 100644 --- a/commonspace/object/tree/objecttree/objecttree.go +++ b/commonspace/object/tree/objecttree/objecttree.go @@ -4,31 +4,29 @@ package objecttree import ( "context" "errors" + "fmt" "sync" "time" - "github.com/anyproto/any-sync/util/crypto" + "github.com/anyproto/any-sync/util/debug" + + "go.uber.org/zap" "github.com/anyproto/any-sync/commonspace/object/acl/list" "github.com/anyproto/any-sync/commonspace/object/tree/treechangeproto" "github.com/anyproto/any-sync/commonspace/object/tree/treestorage" + "github.com/anyproto/any-sync/util/crypto" "github.com/anyproto/any-sync/util/slice" ) -type RWLocker interface { - sync.Locker - RLock() - RUnlock() - TryRLock() bool - TryLock() bool -} - var ( ErrHasInvalidChanges = errors.New("the change is invalid") ErrNoCommonSnapshot = errors.New("trees doesn't have a common snapshot") ErrNoChangeInTree = errors.New("no such change in tree") ErrMissingKey = errors.New("missing current read key") ErrDerived = errors.New("expect >= 2 changes in derived tree") + ErrDeleted = errors.New("object tree is deleted") + ErrNoAclHead = errors.New("no acl head") ) type AddResultSummary int @@ -49,8 +47,13 @@ type RawChangesPayload struct { type ChangeIterateFunc = func(change *Change) bool type ChangeConvertFunc = func(change *Change, decrypted []byte) (any, error) +type TryLocker interface { + sync.Locker + TryLock() bool +} + type ReadableObjectTree interface { - RWLocker + TryLocker Id() string Header() *treechangeproto.RawTreeChangeWithId @@ -106,6 +109,7 @@ type objectTree struct { keys map[string]crypto.SymKey currentReadKey crypto.SymKey + isDeleted bool // buffers difSnapshotBuf []*treechangeproto.RawTreeChangeWithId @@ -115,7 +119,7 @@ type objectTree struct { snapshotPath []string - sync.RWMutex + sync.Mutex } func (ot *objectTree) rebuildFromStorage(theirHeads []string, newChanges []*Change) (err error) { @@ -123,6 +127,7 @@ func (ot *objectTree) rebuildFromStorage(theirHeads []string, newChanges []*Chan ot.treeBuilder.Reset() ot.tree, err = ot.treeBuilder.Build(theirHeads, newChanges) if err != nil { + ot.tree = oldTree return } @@ -180,13 +185,29 @@ func (ot *objectTree) Storage() treestorage.TreeStorage { } func (ot *objectTree) GetChange(id string) (*Change, error) { + if ot.isDeleted { + return nil, ErrDeleted + } if ch, ok := ot.tree.attached[id]; ok { return ch, nil } return nil, ErrNoChangeInTree } +func (ot *objectTree) logUseWhenUnlocked() { + // this is needed to check when we use the tree not under the lock + if ot.TryLock() { + log.With(zap.String("treeId", ot.id), zap.String("stack", debug.StackCompact(true))).Error("use tree when unlocked") + ot.Unlock() + } +} + func (ot *objectTree) AddContent(ctx context.Context, content SignableChangeContent) (res AddResult, err error) { + if ot.isDeleted { + err = ErrDeleted + return + } + ot.logUseWhenUnlocked() payload, err := ot.prepareBuilderContent(content) if err != nil { return @@ -228,6 +249,10 @@ func (ot *objectTree) AddContent(ctx context.Context, content SignableChangeCont } func (ot *objectTree) UnpackChange(raw *treechangeproto.RawTreeChangeWithId) (data []byte, err error) { + if ot.isDeleted { + err = ErrDeleted + return + } unmarshalled, err := ot.changeBuilder.Unmarshall(raw, true) if err != nil { return @@ -237,6 +262,10 @@ func (ot *objectTree) UnpackChange(raw *treechangeproto.RawTreeChangeWithId) (da } func (ot *objectTree) PrepareChange(content SignableChangeContent) (res *treechangeproto.RawTreeChangeWithId, err error) { + if ot.isDeleted { + err = ErrDeleted + return + } payload, err := ot.prepareBuilderContent(content) if err != nil { return @@ -292,6 +321,11 @@ func (ot *objectTree) prepareBuilderContent(content SignableChangeContent) (cnt } func (ot *objectTree) AddRawChanges(ctx context.Context, changesPayload RawChangesPayload) (addResult AddResult, err error) { + if ot.isDeleted { + err = ErrDeleted + return + } + ot.logUseWhenUnlocked() lastHeadId := ot.tree.lastIteratedHeadId addResult, err = ot.addRawChanges(ctx, changesPayload) if err != nil { @@ -309,7 +343,10 @@ func (ot *objectTree) AddRawChanges(ctx context.Context, changesPayload RawChang err = ot.treeStorage.AddRawChangesSetHeads(addResult.Added, addResult.Heads) if err != nil { // rolling back all changes made to inmemory state - ot.rebuildFromStorage(nil, nil) + rebuildErr := ot.rebuildFromStorage(nil, nil) + if rebuildErr != nil { + log.Error("failed to rebuild after adding to storage", zap.Strings("heads", ot.Heads()), zap.Error(rebuildErr)) + } } return } @@ -372,7 +409,7 @@ func (ot *objectTree) addRawChanges(ctx context.Context, changesPayload RawChang headsToUse = changesPayload.NewHeads ) // if our validator provides filtering mechanism then we use it - filteredHeads, ot.newChangesBuf, ot.newSnapshotsBuf, ot.notSeenIdxBuf = ot.validator.FilterChanges(ot.aclList, changesPayload.NewHeads, ot.newChangesBuf, ot.newSnapshotsBuf, ot.notSeenIdxBuf) + filteredHeads, ot.newChangesBuf, ot.newSnapshotsBuf, ot.notSeenIdxBuf = ot.validator.FilterChanges(ot.aclList, ot.newChangesBuf, ot.newSnapshotsBuf, ot.notSeenIdxBuf) if filteredHeads { // if we filtered some of the heads, then we don't know which heads to use headsToUse = []string{} @@ -409,20 +446,27 @@ func (ot *objectTree) addRawChanges(ctx context.Context, changesPayload RawChang break } } - + log := log.With(zap.String("treeId", ot.id)) if shouldRebuildFromStorage { err = ot.rebuildFromStorage(headsToUse, ot.newChangesBuf) if err != nil { + log.Error("failed to rebuild with new heads", zap.Strings("headsToUse", headsToUse), zap.Error(err)) // rebuilding without new changes - ot.rebuildFromStorage(nil, nil) + rebuildErr := ot.rebuildFromStorage(nil, nil) + if rebuildErr != nil { + log.Error("failed to rebuild from storage", zap.Strings("heads", ot.Heads()), zap.Error(rebuildErr)) + } return } addResult, err = ot.createAddResult(prevHeadsCopy, Rebuild, nil, changesPayload.RawChanges) if err != nil { + log.Error("failed to create add result", zap.Strings("headsToUse", headsToUse), zap.Error(err)) // that means that some unattached changes were somehow corrupted in memory // this shouldn't happen but if that happens, then rebuilding from storage - ot.rebuildFromStorage(nil, nil) - return + rebuildErr := ot.rebuildFromStorage(nil, nil) + if rebuildErr != nil { + log.Error("failed to rebuild after add result", zap.Strings("heads", ot.Heads()), zap.Error(rebuildErr)) + } } return } @@ -443,14 +487,18 @@ func (ot *objectTree) addRawChanges(ctx context.Context, changesPayload RawChang err = ot.validateTree(treeChangesAdded) if err != nil { rollback(treeChangesAdded) - err = ErrHasInvalidChanges + err = fmt.Errorf("%w: %w", ErrHasInvalidChanges, err) return } addResult, err = ot.createAddResult(prevHeadsCopy, mode, treeChangesAdded, changesPayload.RawChanges) if err != nil { // that means that some unattached changes were somehow corrupted in memory // this shouldn't happen but if that happens, then rebuilding from storage - ot.rebuildFromStorage(nil, nil) + rollback(treeChangesAdded) + rebuildErr := ot.rebuildFromStorage(nil, nil) + if rebuildErr != nil { + log.Error("failed to rebuild after add result (add to tree)", zap.Strings("heads", ot.Heads()), zap.Error(rebuildErr)) + } return } return @@ -527,6 +575,10 @@ func (ot *objectTree) IterateRoot(convert ChangeConvertFunc, iterate ChangeItera } func (ot *objectTree) IterateFrom(id string, convert ChangeConvertFunc, iterate ChangeIterateFunc) (err error) { + if ot.isDeleted { + err = ErrDeleted + return + } if convert == nil { ot.tree.Iterate(id, iterate) return @@ -576,12 +628,14 @@ func (ot *objectTree) IterateFrom(id string, convert ChangeConvertFunc, iterate } func (ot *objectTree) HasChanges(chs ...string) bool { + if ot.isDeleted { + return false + } for _, ch := range chs { if _, attachedExists := ot.tree.attached[ch]; !attachedExists { return false } } - return true } @@ -602,10 +656,17 @@ func (ot *objectTree) Close() error { } func (ot *objectTree) Delete() error { + if ot.isDeleted { + return nil + } + ot.isDeleted = true return ot.treeStorage.Delete() } func (ot *objectTree) SnapshotPath() []string { + if ot.isDeleted { + return nil + } // TODO: Add error as return parameter if ot.snapshotPathIsActual() { return ot.snapshotPath @@ -628,6 +689,9 @@ func (ot *objectTree) SnapshotPath() []string { } func (ot *objectTree) ChangesAfterCommonSnapshot(theirPath, theirHeads []string) ([]*treechangeproto.RawTreeChangeWithId, error) { + if ot.isDeleted { + return nil, ErrDeleted + } var ( needFullDocument = len(theirPath) == 0 ourPath = ot.SnapshotPath() diff --git a/commonspace/object/tree/objecttree/objecttree_test.go b/commonspace/object/tree/objecttree/objecttree_test.go index 9ddae5cf..2b35fde6 100644 --- a/commonspace/object/tree/objecttree/objecttree_test.go +++ b/commonspace/object/tree/objecttree/objecttree_test.go @@ -2,6 +2,7 @@ package objecttree import ( "context" + "errors" "fmt" "math/rand" "testing" @@ -15,6 +16,7 @@ import ( "github.com/anyproto/any-sync/commonspace/object/accountdata" "github.com/anyproto/any-sync/commonspace/object/acl/list" + "github.com/anyproto/any-sync/commonspace/object/acl/liststorage" "github.com/anyproto/any-sync/commonspace/object/tree/treechangeproto" "github.com/anyproto/any-sync/commonspace/object/tree/treestorage" ) @@ -212,6 +214,51 @@ func TestObjectTree(t *testing.T) { aclList, keys := prepareAclList(t) ctx := context.Background() + t.Run("delete object tree", func(t *testing.T) { + exec := list.NewAclExecutor("spaceId") + type cmdErr struct { + cmd string + err error + } + cmds := []cmdErr{ + {"a.init::a", nil}, + } + for _, cmd := range cmds { + err := exec.Execute(cmd.cmd) + require.Equal(t, cmd.err, err, cmd) + } + aAccount := exec.ActualAccounts()["a"] + root, err := CreateObjectTreeRoot(ObjectTreeCreatePayload{ + PrivKey: aAccount.Keys.SignKey, + ChangeType: "changeType", + ChangePayload: nil, + SpaceId: "spaceId", + IsEncrypted: true, + }, aAccount.Acl) + require.NoError(t, err) + aStore, _ := treestorage.NewInMemoryTreeStorage(root, []string{root.Id}, []*treechangeproto.RawTreeChangeWithId{root}) + aTree, err := BuildKeyFilterableObjectTree(aStore, aAccount.Acl) + require.NoError(t, err) + err = aTree.Delete() + require.NoError(t, err) + _, err = aTree.ChangesAfterCommonSnapshot(nil, nil) + require.Equal(t, ErrDeleted, err) + err = aTree.IterateFrom("", nil, func(change *Change) bool { + return true + }) + require.Equal(t, ErrDeleted, err) + _, err = aTree.AddContent(ctx, SignableChangeContent{}) + require.Equal(t, ErrDeleted, err) + _, err = aTree.AddRawChanges(ctx, RawChangesPayload{}) + require.Equal(t, ErrDeleted, err) + _, err = aTree.PrepareChange(SignableChangeContent{}) + require.Equal(t, ErrDeleted, err) + _, err = aTree.UnpackChange(nil) + require.Equal(t, ErrDeleted, err) + _, err = aTree.GetChange("") + require.Equal(t, ErrDeleted, err) + }) + t.Run("user delete logic: validation, key change, decryption", func(t *testing.T) { exec := list.NewAclExecutor("spaceId") type cmdErr struct { @@ -286,6 +333,84 @@ func TestObjectTree(t *testing.T) { require.NoError(t, err) }) + t.Run("filter changes when no aclHeadId", func(t *testing.T) { + exec := list.NewAclExecutor("spaceId") + type cmdErr struct { + cmd string + err error + } + cmds := []cmdErr{ + {"a.init::a", nil}, + {"a.invite::invId", nil}, + {"b.join::invId", nil}, + {"a.approve::b,r", nil}, + } + for _, cmd := range cmds { + err := exec.Execute(cmd.cmd) + require.Equal(t, cmd.err, err, cmd) + } + aAccount := exec.ActualAccounts()["a"] + bAccount := exec.ActualAccounts()["b"] + root, err := CreateObjectTreeRoot(ObjectTreeCreatePayload{ + PrivKey: aAccount.Keys.SignKey, + ChangeType: "changeType", + ChangePayload: nil, + SpaceId: "spaceId", + IsEncrypted: true, + }, aAccount.Acl) + require.NoError(t, err) + aStore, _ := treestorage.NewInMemoryTreeStorage(root, []string{root.Id}, []*treechangeproto.RawTreeChangeWithId{root}) + aTree, err := BuildKeyFilterableObjectTree(aStore, aAccount.Acl) + require.NoError(t, err) + _, err = aTree.AddContent(ctx, SignableChangeContent{ + Data: []byte("some"), + Key: aAccount.Keys.SignKey, + IsSnapshot: false, + IsEncrypted: true, + DataType: mockDataType, + }) + require.NoError(t, err) + bStore := aTree.Storage().(*treestorage.InMemoryTreeStorage).Copy() + // copying old version of storage + prevAclRecs, err := bAccount.Acl.RecordsAfter(ctx, "") + require.NoError(t, err) + storage, err := liststorage.NewInMemoryAclListStorage(prevAclRecs[0].Id, prevAclRecs) + require.NoError(t, err) + acl, err := list.BuildAclListWithIdentity(bAccount.Keys, storage, list.NoOpAcceptorVerifier{}) + require.NoError(t, err) + // creating tree with old storage which doesn't have a new invite record + bTree, err := BuildKeyFilterableObjectTree(bStore, acl) + require.NoError(t, err) + err = exec.Execute("a.invite::inv1Id") + require.NoError(t, err) + res, err := aTree.AddContent(ctx, SignableChangeContent{ + Data: []byte("some"), + Key: aAccount.Keys.SignKey, + IsSnapshot: false, + IsEncrypted: true, + DataType: mockDataType, + }) + unexpectedId := res.Added[0].Id + require.NoError(t, err) + var collectedChanges []*Change + err = aTree.IterateRoot(func(change *Change, decrypted []byte) (any, error) { + return nil, nil + }, func(change *Change) bool { + collectedChanges = append(collectedChanges, change) + return true + }) + require.NoError(t, err) + bObjTree := bTree.(*objectTree) + // this is just a random slice, so the func works + indexes := []int{1, 2, 3, 4, 5} + // checking that we filter the changes + filtered, filteredChanges, _, _ := bObjTree.validator.FilterChanges(bObjTree.aclList, collectedChanges, nil, indexes) + require.True(t, filtered) + for _, ch := range filteredChanges { + require.NotEqual(t, unexpectedId, ch.Id) + } + }) + t.Run("add content", func(t *testing.T) { root, err := CreateObjectTreeRoot(ObjectTreeCreatePayload{ PrivKey: keys.SignKey, @@ -1274,7 +1399,7 @@ func TestObjectTree(t *testing.T) { Heads: []string{"3"}, Changes: rawChanges, }, ctx.aclList) - require.Equal(t, ErrHasInvalidChanges, err) + require.True(t, errors.Is(err, ErrHasInvalidChanges)) }) t.Run("gen changes test load iterator simple", func(t *testing.T) { diff --git a/commonspace/object/tree/objecttree/objecttreevalidator.go b/commonspace/object/tree/objecttree/objecttreevalidator.go index bb971ad7..117e0169 100644 --- a/commonspace/object/tree/objecttree/objecttreevalidator.go +++ b/commonspace/object/tree/objecttree/objecttreevalidator.go @@ -16,7 +16,7 @@ type ObjectTreeValidator interface { ValidateFullTree(tree *Tree, aclList list.AclList) error // ValidateNewChanges should always be entered while holding a read lock on AclList ValidateNewChanges(tree *Tree, aclList list.AclList, newChanges []*Change) error - FilterChanges(aclList list.AclList, heads []string, changes []*Change, snapshots []*Change, indexes []int) (filteredHeads bool, filtered, filteredSnapshots []*Change, newIndexes []int) + FilterChanges(aclList list.AclList, changes []*Change, snapshots []*Change, indexes []int) (filteredHeads bool, filtered, filteredSnapshots []*Change, newIndexes []int) } type noOpTreeValidator struct { @@ -31,7 +31,7 @@ func (n *noOpTreeValidator) ValidateNewChanges(tree *Tree, aclList list.AclList, return nil } -func (n *noOpTreeValidator) FilterChanges(aclList list.AclList, heads []string, changes []*Change, snapshots []*Change, indexes []int) (filteredHeads bool, filtered, filteredSnapshots []*Change, newIndexes []int) { +func (n *noOpTreeValidator) FilterChanges(aclList list.AclList, changes []*Change, snapshots []*Change, indexes []int) (filteredHeads bool, filtered, filteredSnapshots []*Change, newIndexes []int) { if n.filterFunc == nil { return false, changes, snapshots, indexes } @@ -80,7 +80,7 @@ func (v *objectTreeValidator) ValidateNewChanges(tree *Tree, aclList list.AclLis return } -func (v *objectTreeValidator) FilterChanges(aclList list.AclList, heads []string, changes []*Change, snapshots []*Change, indexes []int) (filteredHeads bool, filtered, filteredSnapshots []*Change, newIndexes []int) { +func (v *objectTreeValidator) FilterChanges(aclList list.AclList, changes []*Change, snapshots []*Change, indexes []int) (filteredHeads bool, filtered, filteredSnapshots []*Change, newIndexes []int) { if !v.shouldFilter { return false, changes, snapshots, indexes } @@ -88,18 +88,25 @@ func (v *objectTreeValidator) FilterChanges(aclList list.AclList, heads []string defer aclList.RUnlock() state := aclList.AclState() for idx, c := range changes { - // only taking changes which we can read - if keys, exists := state.Keys()[c.ReadKeyId]; exists && keys.ReadKey != nil { + // this has to be a root + if c.PreviousIds == nil { + newIndexes = append(newIndexes, indexes[idx]) + filtered = append(filtered, c) + filteredSnapshots = append(filteredSnapshots, c) + continue + } + // only taking changes which we can read and for which we have acl heads + if keys, exists := state.Keys()[c.ReadKeyId]; aclList.HasHead(c.AclHeadId) && exists && keys.ReadKey != nil { newIndexes = append(newIndexes, indexes[idx]) filtered = append(filtered, c) if c.IsSnapshot { filteredSnapshots = append(filteredSnapshots, c) } - } else { - // if we filtered at least one change this can be the change between heads and other changes - // thus we cannot use heads - filteredHeads = true + continue } + // if we filtered at least one change this can be the change between heads and other changes + // thus we cannot use heads + filteredHeads = true } return } @@ -162,6 +169,8 @@ func ValidateRawTreeBuildFunc(payload treestorage.TreeStorageCreatePayload, buil if err != nil { return } + tree.Lock() + defer tree.Unlock() res, err := tree.AddRawChanges(context.Background(), RawChangesPayload{ NewHeads: payload.Heads, RawChanges: payload.Changes, @@ -170,7 +179,7 @@ func ValidateRawTreeBuildFunc(payload treestorage.TreeStorageCreatePayload, buil return } if !slice.UnsortedEquals(res.Heads, payload.Heads) { - return payload, ErrHasInvalidChanges + return payload, fmt.Errorf("heads mismatch: %v != %v, %w", res.Heads, payload.Heads, ErrHasInvalidChanges) } // if tree has only one change we still should check if the snapshot id is same as root if IsEmptyDerivedTree(tree) { @@ -194,6 +203,8 @@ func ValidateFilterRawTree(payload treestorage.TreeStorageCreatePayload, aclList if err != nil { return } + tree.Lock() + defer tree.Unlock() res, err := tree.AddRawChanges(context.Background(), RawChangesPayload{ NewHeads: payload.Heads, RawChanges: payload.Changes, diff --git a/commonspace/object/tree/synctree/mock_synctree/mock_synctree.go b/commonspace/object/tree/synctree/mock_synctree/mock_synctree.go index ebf3cc79..15b5b689 100644 --- a/commonspace/object/tree/synctree/mock_synctree/mock_synctree.go +++ b/commonspace/object/tree/synctree/mock_synctree/mock_synctree.go @@ -349,30 +349,6 @@ func (mr *MockSyncTreeMockRecorder) PrepareChange(arg0 any) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PrepareChange", reflect.TypeOf((*MockSyncTree)(nil).PrepareChange), arg0) } -// RLock mocks base method. -func (m *MockSyncTree) RLock() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "RLock") -} - -// RLock indicates an expected call of RLock. -func (mr *MockSyncTreeMockRecorder) RLock() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RLock", reflect.TypeOf((*MockSyncTree)(nil).RLock)) -} - -// RUnlock mocks base method. -func (m *MockSyncTree) RUnlock() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "RUnlock") -} - -// RUnlock indicates an expected call of RUnlock. -func (mr *MockSyncTreeMockRecorder) RUnlock() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RUnlock", reflect.TypeOf((*MockSyncTree)(nil).RUnlock)) -} - // Root mocks base method. func (m *MockSyncTree) Root() *objecttree.Change { m.ctrl.T.Helper() @@ -470,20 +446,6 @@ func (mr *MockSyncTreeMockRecorder) TryLock() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TryLock", reflect.TypeOf((*MockSyncTree)(nil).TryLock)) } -// TryRLock mocks base method. -func (m *MockSyncTree) TryRLock() bool { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TryRLock") - ret0, _ := ret[0].(bool) - return ret0 -} - -// TryRLock indicates an expected call of TryRLock. -func (mr *MockSyncTreeMockRecorder) TryRLock() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TryRLock", reflect.TypeOf((*MockSyncTree)(nil).TryRLock)) -} - // Unlock mocks base method. func (m *MockSyncTree) Unlock() { m.ctrl.T.Helper() diff --git a/commonspace/object/tree/synctree/synctree_test.go b/commonspace/object/tree/synctree/synctree_test.go index 3bba33b3..7c36e812 100644 --- a/commonspace/object/tree/synctree/synctree_test.go +++ b/commonspace/object/tree/synctree/synctree_test.go @@ -2,18 +2,19 @@ package synctree import ( "context" + "testing" + + "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" + "github.com/anyproto/any-sync/commonspace/object/tree/objecttree" "github.com/anyproto/any-sync/commonspace/object/tree/objecttree/mock_objecttree" "github.com/anyproto/any-sync/commonspace/object/tree/synctree/mock_synctree" "github.com/anyproto/any-sync/commonspace/object/tree/synctree/updatelistener" "github.com/anyproto/any-sync/commonspace/object/tree/synctree/updatelistener/mock_updatelistener" "github.com/anyproto/any-sync/commonspace/object/tree/treechangeproto" - "github.com/anyproto/any-sync/commonspace/objectsync" "github.com/anyproto/any-sync/commonspace/syncstatus" "github.com/anyproto/any-sync/nodeconf" - "github.com/stretchr/testify/require" - "go.uber.org/mock/gomock" - "testing" ) type syncTreeMatcher struct { diff --git a/commonspace/object/tree/treestorage/inmemory.go b/commonspace/object/tree/treestorage/inmemory.go index e5d3f753..b130317d 100644 --- a/commonspace/object/tree/treestorage/inmemory.go +++ b/commonspace/object/tree/treestorage/inmemory.go @@ -3,9 +3,10 @@ package treestorage import ( "context" "fmt" + "sync" + "github.com/anyproto/any-sync/commonspace/object/tree/treechangeproto" "github.com/anyproto/any-sync/util/slice" - "sync" ) type InMemoryTreeStorage struct { @@ -111,6 +112,9 @@ func (t *InMemoryTreeStorage) GetRawChange(ctx context.Context, changeId string) } func (t *InMemoryTreeStorage) Delete() error { + t.root = nil + t.Changes = nil + t.heads = nil return nil } diff --git a/commonspace/spaceservice.go b/commonspace/spaceservice.go index ee7e4a90..ced61bf4 100644 --- a/commonspace/spaceservice.go +++ b/commonspace/spaceservice.go @@ -114,7 +114,7 @@ func (s *spaceService) CreateSpace(ctx context.Context, payload SpaceCreatePaylo return } - return store.Id(), nil + return store.Id(), store.Close(ctx) } func (s *spaceService) DeriveId(ctx context.Context, payload SpaceDerivePayload) (id string, err error) { @@ -139,7 +139,7 @@ func (s *spaceService) DeriveSpace(ctx context.Context, payload SpaceDerivePaylo return } - return store.Id(), nil + return store.Id(), store.Close(ctx) } func (s *spaceService) NewSpace(ctx context.Context, id string, deps Deps) (Space, error) { diff --git a/commonspace/spacestorage/inmemorystorage.go b/commonspace/spacestorage/inmemorystorage.go index 1c2dec54..1b6398de 100644 --- a/commonspace/spacestorage/inmemorystorage.go +++ b/commonspace/spacestorage/inmemorystorage.go @@ -186,7 +186,7 @@ func (i *InMemorySpaceStorage) AllTrees() map[string]treestorage.TreeStorage { defer i.Unlock() cp := map[string]treestorage.TreeStorage{} for id, store := range i.trees { - cp[id] = store + cp[id] = store.(*treestorage.InMemoryTreeStorage).Copy() } return cp } diff --git a/commonspace/spaceutils_test.go b/commonspace/spaceutils_test.go index 4dd7b9e5..9319558c 100644 --- a/commonspace/spaceutils_test.go +++ b/commonspace/spaceutils_test.go @@ -461,6 +461,22 @@ func (t *mockTreeManager) DeleteTree(ctx context.Context, spaceId, treeId string type mockCoordinatorClient struct { } +func (m mockCoordinatorClient) StatusCheckMany(ctx context.Context, spaceIds []string) (statuses []*coordinatorproto.SpaceStatusPayload, limits *coordinatorproto.AccountLimits, err error) { + return +} + +func (m mockCoordinatorClient) SpaceMakeShareable(ctx context.Context, spaceId string) (err error) { + return +} + +func (m mockCoordinatorClient) SpaceMakeUnshareable(ctx context.Context, spaceId, aclId string) (err error) { + return +} + +func (m mockCoordinatorClient) AccountLimitsSet(ctx context.Context, req *coordinatorproto.AccountLimitsSetRequest) error { + return nil +} + func (m mockCoordinatorClient) SpaceDelete(ctx context.Context, spaceId string, conf *coordinatorproto.DeletionConfirmPayloadWithSignature) (err error) { return } @@ -473,10 +489,6 @@ func (m mockCoordinatorClient) AccountRevertDeletion(ctx context.Context) (err e return } -func (m mockCoordinatorClient) StatusCheckMany(ctx context.Context, spaceIds []string) (statuses []*coordinatorproto.SpaceStatusPayload, err error) { - return -} - func (m mockCoordinatorClient) StatusCheck(ctx context.Context, spaceId string) (status *coordinatorproto.SpaceStatusPayload, err error) { return } @@ -485,10 +497,6 @@ func (m mockCoordinatorClient) SpaceSign(ctx context.Context, payload coordinato return } -func (m mockCoordinatorClient) FileLimitCheck(ctx context.Context, spaceId string, identity []byte) (response *coordinatorproto.FileLimitCheckResponse, err error) { - return -} - func (m mockCoordinatorClient) NetworkConfiguration(ctx context.Context, currentId string) (*coordinatorproto.NetworkConfigurationResponse, error) { return nil, nil } diff --git a/coordinator/coordinatorclient/coordinatorclient.go b/coordinator/coordinatorclient/coordinatorclient.go index a8e00da6..5ff7e25d 100644 --- a/coordinator/coordinatorclient/coordinatorclient.go +++ b/coordinator/coordinatorclient/coordinatorclient.go @@ -34,10 +34,11 @@ type CoordinatorClient interface { SpaceDelete(ctx context.Context, spaceId string, conf *coordinatorproto.DeletionConfirmPayloadWithSignature) (err error) AccountDelete(ctx context.Context, conf *coordinatorproto.DeletionConfirmPayloadWithSignature) (timestamp int64, err error) AccountRevertDeletion(ctx context.Context) (err error) - StatusCheckMany(ctx context.Context, spaceIds []string) (statuses []*coordinatorproto.SpaceStatusPayload, err error) + StatusCheckMany(ctx context.Context, spaceIds []string) (statuses []*coordinatorproto.SpaceStatusPayload, limits *coordinatorproto.AccountLimits, err error) StatusCheck(ctx context.Context, spaceId string) (status *coordinatorproto.SpaceStatusPayload, err error) SpaceSign(ctx context.Context, payload SpaceSignPayload) (receipt *coordinatorproto.SpaceReceiptWithSignature, err error) - FileLimitCheck(ctx context.Context, spaceId string, identity []byte) (response *coordinatorproto.FileLimitCheckResponse, err error) + SpaceMakeShareable(ctx context.Context, spaceId string) (err error) + SpaceMakeUnshareable(ctx context.Context, spaceId, aclId string) (err error) NetworkConfiguration(ctx context.Context, currentId string) (*coordinatorproto.NetworkConfigurationResponse, error) DeletionLog(ctx context.Context, lastRecordId string, limit int) (records []*coordinatorproto.DeletionLogRecord, err error) @@ -47,6 +48,8 @@ type CoordinatorClient interface { AclAddRecord(ctx context.Context, spaceId string, rec *consensusproto.RawRecord) (res *consensusproto.RawRecordWithId, err error) AclGetRecords(ctx context.Context, spaceId, aclHead string) (res []*consensusproto.RawRecordWithId, err error) + AccountLimitsSet(ctx context.Context, req *coordinatorproto.AccountLimitsSetRequest) error + app.Component } @@ -146,7 +149,11 @@ func (c *coordinatorClient) DeletionLog(ctx context.Context, lastRecordId string return } -func (c *coordinatorClient) StatusCheckMany(ctx context.Context, spaceIds []string) (statuses []*coordinatorproto.SpaceStatusPayload, err error) { +func (c *coordinatorClient) StatusCheckMany(ctx context.Context, spaceIds []string) ( + statuses []*coordinatorproto.SpaceStatusPayload, + limits *coordinatorproto.AccountLimits, + err error, +) { err = c.doClient(ctx, func(cl coordinatorproto.DRPCCoordinatorClient) error { resp, err := cl.SpaceStatusCheckMany(ctx, &coordinatorproto.SpaceStatusCheckManyRequest{ SpaceIds: spaceIds, @@ -155,6 +162,7 @@ func (c *coordinatorClient) StatusCheckMany(ctx context.Context, spaceIds []stri return rpcerr.Unwrap(err) } statuses = resp.Payloads + limits = resp.AccountLimits return nil }) return @@ -207,20 +215,6 @@ func (c *coordinatorClient) SpaceSign(ctx context.Context, payload SpaceSignPayl return } -func (c *coordinatorClient) FileLimitCheck(ctx context.Context, spaceId string, identity []byte) (resp *coordinatorproto.FileLimitCheckResponse, err error) { - err = c.doClient(ctx, func(cl coordinatorproto.DRPCCoordinatorClient) error { - resp, err = cl.FileLimitCheck(ctx, &coordinatorproto.FileLimitCheckRequest{ - AccountIdentity: identity, - SpaceId: spaceId, - }) - if err != nil { - return rpcerr.Unwrap(err) - } - return nil - }) - return -} - func (c *coordinatorClient) NetworkConfiguration(ctx context.Context, currentId string) (resp *coordinatorproto.NetworkConfigurationResponse, err error) { err = c.doClient(ctx, func(cl coordinatorproto.DRPCCoordinatorClient) error { resp, err = cl.NetworkConfiguration(ctx, &coordinatorproto.NetworkConfigurationRequest{ @@ -274,7 +268,7 @@ func (c *coordinatorClient) AclAddRecord(ctx context.Context, spaceId string, re Payload: recordData, }) if err != nil { - return err + return rpcerr.Unwrap(err) } res = &consensusproto.RawRecordWithId{ Payload: resp.Payload, @@ -292,7 +286,7 @@ func (c *coordinatorClient) AclGetRecords(ctx context.Context, spaceId, aclHead AclHead: aclHead, }) if err != nil { - return err + return rpcerr.Unwrap(err) } res = make([]*consensusproto.RawRecordWithId, len(resp.Records)) for i, rec := range resp.Records { @@ -306,6 +300,38 @@ func (c *coordinatorClient) AclGetRecords(ctx context.Context, spaceId, aclHead return } +func (c *coordinatorClient) AccountLimitsSet(ctx context.Context, req *coordinatorproto.AccountLimitsSetRequest) error { + return c.doClient(ctx, func(cl coordinatorproto.DRPCCoordinatorClient) error { + if _, err := cl.AccountLimitsSet(ctx, req); err != nil { + return rpcerr.Unwrap(err) + } + return nil + }) +} + +func (c *coordinatorClient) SpaceMakeShareable(ctx context.Context, spaceId string) (err error) { + return c.doClient(ctx, func(cl coordinatorproto.DRPCCoordinatorClient) error { + if _, err := cl.SpaceMakeShareable(ctx, &coordinatorproto.SpaceMakeShareableRequest{ + SpaceId: spaceId, + }); err != nil { + return rpcerr.Unwrap(err) + } + return nil + }) +} + +func (c *coordinatorClient) SpaceMakeUnshareable(ctx context.Context, spaceId, aclHead string) (err error) { + return c.doClient(ctx, func(cl coordinatorproto.DRPCCoordinatorClient) error { + if _, err := cl.SpaceMakeUnshareable(ctx, &coordinatorproto.SpaceMakeUnshareableRequest{ + SpaceId: spaceId, + AclHead: aclHead, + }); err != nil { + return rpcerr.Unwrap(err) + } + return nil + }) +} + func (c *coordinatorClient) doClient(ctx context.Context, f func(cl coordinatorproto.DRPCCoordinatorClient) error) error { p, err := c.getPeer(ctx) if err != nil { diff --git a/coordinator/coordinatorclient/mock_coordinatorclient/mock_coordinatorclient.go b/coordinator/coordinatorclient/mock_coordinatorclient/mock_coordinatorclient.go index c80c92da..6ecb0d5a 100644 --- a/coordinator/coordinatorclient/mock_coordinatorclient/mock_coordinatorclient.go +++ b/coordinator/coordinatorclient/mock_coordinatorclient/mock_coordinatorclient.go @@ -59,6 +59,20 @@ func (mr *MockCoordinatorClientMockRecorder) AccountDelete(arg0, arg1 any) *gomo return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AccountDelete", reflect.TypeOf((*MockCoordinatorClient)(nil).AccountDelete), arg0, arg1) } +// AccountLimitsSet mocks base method. +func (m *MockCoordinatorClient) AccountLimitsSet(arg0 context.Context, arg1 *coordinatorproto.AccountLimitsSetRequest) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AccountLimitsSet", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// AccountLimitsSet indicates an expected call of AccountLimitsSet. +func (mr *MockCoordinatorClientMockRecorder) AccountLimitsSet(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AccountLimitsSet", reflect.TypeOf((*MockCoordinatorClient)(nil).AccountLimitsSet), arg0, arg1) +} + // AccountRevertDeletion mocks base method. func (m *MockCoordinatorClient) AccountRevertDeletion(arg0 context.Context) error { m.ctrl.T.Helper() @@ -118,21 +132,6 @@ func (mr *MockCoordinatorClientMockRecorder) DeletionLog(arg0, arg1, arg2 any) * return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeletionLog", reflect.TypeOf((*MockCoordinatorClient)(nil).DeletionLog), arg0, arg1, arg2) } -// FileLimitCheck mocks base method. -func (m *MockCoordinatorClient) FileLimitCheck(arg0 context.Context, arg1 string, arg2 []byte) (*coordinatorproto.FileLimitCheckResponse, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FileLimitCheck", arg0, arg1, arg2) - ret0, _ := ret[0].(*coordinatorproto.FileLimitCheckResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// FileLimitCheck indicates an expected call of FileLimitCheck. -func (mr *MockCoordinatorClientMockRecorder) FileLimitCheck(arg0, arg1, arg2 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FileLimitCheck", reflect.TypeOf((*MockCoordinatorClient)(nil).FileLimitCheck), arg0, arg1, arg2) -} - // IdentityRepoGet mocks base method. func (m *MockCoordinatorClient) IdentityRepoGet(arg0 context.Context, arg1, arg2 []string) ([]*identityrepoproto.DataWithIdentity, error) { m.ctrl.T.Helper() @@ -219,6 +218,34 @@ func (mr *MockCoordinatorClientMockRecorder) SpaceDelete(arg0, arg1, arg2 any) * return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpaceDelete", reflect.TypeOf((*MockCoordinatorClient)(nil).SpaceDelete), arg0, arg1, arg2) } +// SpaceMakeShareable mocks base method. +func (m *MockCoordinatorClient) SpaceMakeShareable(arg0 context.Context, arg1 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SpaceMakeShareable", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// SpaceMakeShareable indicates an expected call of SpaceMakeShareable. +func (mr *MockCoordinatorClientMockRecorder) SpaceMakeShareable(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpaceMakeShareable", reflect.TypeOf((*MockCoordinatorClient)(nil).SpaceMakeShareable), arg0, arg1) +} + +// SpaceMakeUnshareable mocks base method. +func (m *MockCoordinatorClient) SpaceMakeUnshareable(arg0 context.Context, arg1, arg2 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SpaceMakeUnshareable", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// SpaceMakeUnshareable indicates an expected call of SpaceMakeUnshareable. +func (mr *MockCoordinatorClientMockRecorder) SpaceMakeUnshareable(arg0, arg1, arg2 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpaceMakeUnshareable", reflect.TypeOf((*MockCoordinatorClient)(nil).SpaceMakeUnshareable), arg0, arg1, arg2) +} + // SpaceSign mocks base method. func (m *MockCoordinatorClient) SpaceSign(arg0 context.Context, arg1 coordinatorclient.SpaceSignPayload) (*coordinatorproto.SpaceReceiptWithSignature, error) { m.ctrl.T.Helper() @@ -250,12 +277,13 @@ func (mr *MockCoordinatorClientMockRecorder) StatusCheck(arg0, arg1 any) *gomock } // StatusCheckMany mocks base method. -func (m *MockCoordinatorClient) StatusCheckMany(arg0 context.Context, arg1 []string) ([]*coordinatorproto.SpaceStatusPayload, error) { +func (m *MockCoordinatorClient) StatusCheckMany(arg0 context.Context, arg1 []string) ([]*coordinatorproto.SpaceStatusPayload, *coordinatorproto.AccountLimits, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StatusCheckMany", arg0, arg1) ret0, _ := ret[0].([]*coordinatorproto.SpaceStatusPayload) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret1, _ := ret[1].(*coordinatorproto.AccountLimits) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 } // StatusCheckMany indicates an expected call of StatusCheckMany. diff --git a/coordinator/coordinatorproto/coordinator.pb.go b/coordinator/coordinatorproto/coordinator.pb.go index 747d1293..9fa444f1 100644 --- a/coordinator/coordinatorproto/coordinator.pb.go +++ b/coordinator/coordinatorproto/coordinator.pb.go @@ -32,6 +32,10 @@ const ( ErrorCodes_SpaceNotExists ErrorCodes = 4 ErrorCodes_SpaceLimitReached ErrorCodes = 5 ErrorCodes_AccountDeleted ErrorCodes = 6 + ErrorCodes_Forbidden ErrorCodes = 7 + ErrorCodes_AclHeadIsMissing ErrorCodes = 8 + ErrorCodes_AclNonEmpty ErrorCodes = 9 + ErrorCodes_SpaceNotShareable ErrorCodes = 10 ErrorCodes_ErrorOffset ErrorCodes = 300 ) @@ -43,6 +47,10 @@ var ErrorCodes_name = map[int32]string{ 4: "SpaceNotExists", 5: "SpaceLimitReached", 6: "AccountDeleted", + 7: "Forbidden", + 8: "AclHeadIsMissing", + 9: "AclNonEmpty", + 10: "SpaceNotShareable", 300: "ErrorOffset", } @@ -54,6 +62,10 @@ var ErrorCodes_value = map[string]int32{ "SpaceNotExists": 4, "SpaceLimitReached": 5, "AccountDeleted": 6, + "Forbidden": 7, + "AclHeadIsMissing": 8, + "AclNonEmpty": 9, + "SpaceNotShareable": 10, "ErrorOffset": 300, } @@ -311,17 +323,71 @@ func (m *SpaceSignRequest) GetForceRequest() bool { return false } +type SpaceLimits struct { + ReadMembers uint32 `protobuf:"varint,1,opt,name=readMembers,proto3" json:"readMembers,omitempty"` + WriteMembers uint32 `protobuf:"varint,2,opt,name=writeMembers,proto3" json:"writeMembers,omitempty"` +} + +func (m *SpaceLimits) Reset() { *m = SpaceLimits{} } +func (m *SpaceLimits) String() string { return proto.CompactTextString(m) } +func (*SpaceLimits) ProtoMessage() {} +func (*SpaceLimits) Descriptor() ([]byte, []int) { + return fileDescriptor_d94f6f99586adae2, []int{1} +} +func (m *SpaceLimits) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SpaceLimits) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SpaceLimits.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SpaceLimits) XXX_Merge(src proto.Message) { + xxx_messageInfo_SpaceLimits.Merge(m, src) +} +func (m *SpaceLimits) XXX_Size() int { + return m.Size() +} +func (m *SpaceLimits) XXX_DiscardUnknown() { + xxx_messageInfo_SpaceLimits.DiscardUnknown(m) +} + +var xxx_messageInfo_SpaceLimits proto.InternalMessageInfo + +func (m *SpaceLimits) GetReadMembers() uint32 { + if m != nil { + return m.ReadMembers + } + return 0 +} + +func (m *SpaceLimits) GetWriteMembers() uint32 { + if m != nil { + return m.WriteMembers + } + return 0 +} + type SpaceStatusPayload struct { Status SpaceStatus `protobuf:"varint,1,opt,name=status,proto3,enum=coordinator.SpaceStatus" json:"status,omitempty"` DeletionTimestamp int64 `protobuf:"varint,2,opt,name=deletionTimestamp,proto3" json:"deletionTimestamp,omitempty"` Permissions SpacePermissions `protobuf:"varint,3,opt,name=permissions,proto3,enum=coordinator.SpacePermissions" json:"permissions,omitempty"` + Limits *SpaceLimits `protobuf:"bytes,4,opt,name=limits,proto3" json:"limits,omitempty"` + IsShared bool `protobuf:"varint,5,opt,name=isShared,proto3" json:"isShared,omitempty"` } func (m *SpaceStatusPayload) Reset() { *m = SpaceStatusPayload{} } func (m *SpaceStatusPayload) String() string { return proto.CompactTextString(m) } func (*SpaceStatusPayload) ProtoMessage() {} func (*SpaceStatusPayload) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{1} + return fileDescriptor_d94f6f99586adae2, []int{2} } func (m *SpaceStatusPayload) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -371,6 +437,20 @@ func (m *SpaceStatusPayload) GetPermissions() SpacePermissions { return SpacePermissions_SpacePermissionsUnknown } +func (m *SpaceStatusPayload) GetLimits() *SpaceLimits { + if m != nil { + return m.Limits + } + return nil +} + +func (m *SpaceStatusPayload) GetIsShared() bool { + if m != nil { + return m.IsShared + } + return false +} + type SpaceSignResponse struct { Receipt *SpaceReceiptWithSignature `protobuf:"bytes,1,opt,name=receipt,proto3" json:"receipt,omitempty"` } @@ -379,7 +459,7 @@ func (m *SpaceSignResponse) Reset() { *m = SpaceSignResponse{} } func (m *SpaceSignResponse) String() string { return proto.CompactTextString(m) } func (*SpaceSignResponse) ProtoMessage() {} func (*SpaceSignResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{2} + return fileDescriptor_d94f6f99586adae2, []int{3} } func (m *SpaceSignResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -425,7 +505,7 @@ func (m *SpaceReceiptWithSignature) Reset() { *m = SpaceReceiptWithSigna func (m *SpaceReceiptWithSignature) String() string { return proto.CompactTextString(m) } func (*SpaceReceiptWithSignature) ProtoMessage() {} func (*SpaceReceiptWithSignature) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{3} + return fileDescriptor_d94f6f99586adae2, []int{4} } func (m *SpaceReceiptWithSignature) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -486,7 +566,7 @@ func (m *SpaceReceipt) Reset() { *m = SpaceReceipt{} } func (m *SpaceReceipt) String() string { return proto.CompactTextString(m) } func (*SpaceReceipt) ProtoMessage() {} func (*SpaceReceipt) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{4} + return fileDescriptor_d94f6f99586adae2, []int{5} } func (m *SpaceReceipt) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -550,115 +630,6 @@ func (m *SpaceReceipt) GetValidUntil() uint64 { return 0 } -// FileLimitCheckRequest contains an account identity and spaceId -// control node checks that identity owns a given space -type FileLimitCheckRequest struct { - AccountIdentity []byte `protobuf:"bytes,1,opt,name=accountIdentity,proto3" json:"accountIdentity,omitempty"` - SpaceId string `protobuf:"bytes,2,opt,name=spaceId,proto3" json:"spaceId,omitempty"` -} - -func (m *FileLimitCheckRequest) Reset() { *m = FileLimitCheckRequest{} } -func (m *FileLimitCheckRequest) String() string { return proto.CompactTextString(m) } -func (*FileLimitCheckRequest) ProtoMessage() {} -func (*FileLimitCheckRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{5} -} -func (m *FileLimitCheckRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *FileLimitCheckRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_FileLimitCheckRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *FileLimitCheckRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_FileLimitCheckRequest.Merge(m, src) -} -func (m *FileLimitCheckRequest) XXX_Size() int { - return m.Size() -} -func (m *FileLimitCheckRequest) XXX_DiscardUnknown() { - xxx_messageInfo_FileLimitCheckRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_FileLimitCheckRequest proto.InternalMessageInfo - -func (m *FileLimitCheckRequest) GetAccountIdentity() []byte { - if m != nil { - return m.AccountIdentity - } - return nil -} - -func (m *FileLimitCheckRequest) GetSpaceId() string { - if m != nil { - return m.SpaceId - } - return "" -} - -// FileLimitCheckResponse returns a current space limit in bytes -type FileLimitCheckResponse struct { - // Limit in bytes - Limit uint64 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"` - // StorageKey tells a key that filenode should use to save files - StorageKey string `protobuf:"bytes,2,opt,name=storageKey,proto3" json:"storageKey,omitempty"` -} - -func (m *FileLimitCheckResponse) Reset() { *m = FileLimitCheckResponse{} } -func (m *FileLimitCheckResponse) String() string { return proto.CompactTextString(m) } -func (*FileLimitCheckResponse) ProtoMessage() {} -func (*FileLimitCheckResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{6} -} -func (m *FileLimitCheckResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *FileLimitCheckResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_FileLimitCheckResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *FileLimitCheckResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_FileLimitCheckResponse.Merge(m, src) -} -func (m *FileLimitCheckResponse) XXX_Size() int { - return m.Size() -} -func (m *FileLimitCheckResponse) XXX_DiscardUnknown() { - xxx_messageInfo_FileLimitCheckResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_FileLimitCheckResponse proto.InternalMessageInfo - -func (m *FileLimitCheckResponse) GetLimit() uint64 { - if m != nil { - return m.Limit - } - return 0 -} - -func (m *FileLimitCheckResponse) GetStorageKey() string { - if m != nil { - return m.StorageKey - } - return "" -} - // SpaceStatusCheckRequest contains the spaceId of requested space type SpaceStatusCheckRequest struct { SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` @@ -668,7 +639,7 @@ func (m *SpaceStatusCheckRequest) Reset() { *m = SpaceStatusCheckRequest func (m *SpaceStatusCheckRequest) String() string { return proto.CompactTextString(m) } func (*SpaceStatusCheckRequest) ProtoMessage() {} func (*SpaceStatusCheckRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{7} + return fileDescriptor_d94f6f99586adae2, []int{6} } func (m *SpaceStatusCheckRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -713,7 +684,7 @@ func (m *SpaceStatusCheckResponse) Reset() { *m = SpaceStatusCheckRespon func (m *SpaceStatusCheckResponse) String() string { return proto.CompactTextString(m) } func (*SpaceStatusCheckResponse) ProtoMessage() {} func (*SpaceStatusCheckResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{8} + return fileDescriptor_d94f6f99586adae2, []int{7} } func (m *SpaceStatusCheckResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -758,7 +729,7 @@ func (m *SpaceStatusCheckManyRequest) Reset() { *m = SpaceStatusCheckMan func (m *SpaceStatusCheckManyRequest) String() string { return proto.CompactTextString(m) } func (*SpaceStatusCheckManyRequest) ProtoMessage() {} func (*SpaceStatusCheckManyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{9} + return fileDescriptor_d94f6f99586adae2, []int{8} } func (m *SpaceStatusCheckManyRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -796,14 +767,15 @@ func (m *SpaceStatusCheckManyRequest) GetSpaceIds() []string { // SpaceStatusCheckManyResponse contains the current statuses of spaces type SpaceStatusCheckManyResponse struct { - Payloads []*SpaceStatusPayload `protobuf:"bytes,1,rep,name=payloads,proto3" json:"payloads,omitempty"` + Payloads []*SpaceStatusPayload `protobuf:"bytes,1,rep,name=payloads,proto3" json:"payloads,omitempty"` + AccountLimits *AccountLimits `protobuf:"bytes,2,opt,name=accountLimits,proto3" json:"accountLimits,omitempty"` } func (m *SpaceStatusCheckManyResponse) Reset() { *m = SpaceStatusCheckManyResponse{} } func (m *SpaceStatusCheckManyResponse) String() string { return proto.CompactTextString(m) } func (*SpaceStatusCheckManyResponse) ProtoMessage() {} func (*SpaceStatusCheckManyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{10} + return fileDescriptor_d94f6f99586adae2, []int{9} } func (m *SpaceStatusCheckManyResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -839,6 +811,58 @@ func (m *SpaceStatusCheckManyResponse) GetPayloads() []*SpaceStatusPayload { return nil } +func (m *SpaceStatusCheckManyResponse) GetAccountLimits() *AccountLimits { + if m != nil { + return m.AccountLimits + } + return nil +} + +// AccountLimits describes account level limit +type AccountLimits struct { + SharedSpacesLimit uint32 `protobuf:"varint,1,opt,name=sharedSpacesLimit,proto3" json:"sharedSpacesLimit,omitempty"` +} + +func (m *AccountLimits) Reset() { *m = AccountLimits{} } +func (m *AccountLimits) String() string { return proto.CompactTextString(m) } +func (*AccountLimits) ProtoMessage() {} +func (*AccountLimits) Descriptor() ([]byte, []int) { + return fileDescriptor_d94f6f99586adae2, []int{10} +} +func (m *AccountLimits) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AccountLimits) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AccountLimits.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AccountLimits) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccountLimits.Merge(m, src) +} +func (m *AccountLimits) XXX_Size() int { + return m.Size() +} +func (m *AccountLimits) XXX_DiscardUnknown() { + xxx_messageInfo_AccountLimits.DiscardUnknown(m) +} + +var xxx_messageInfo_AccountLimits proto.InternalMessageInfo + +func (m *AccountLimits) GetSharedSpacesLimit() uint32 { + if m != nil { + return m.SharedSpacesLimit + } + return 0 +} + // SpaceStatusChangeRequest contains the deletionChange if we want to delete space, or it is empty otherwise type SpaceStatusChangeRequest struct { SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` @@ -953,6 +977,174 @@ func (m *SpaceStatusChangeResponse) GetPayload() *SpaceStatusPayload { return nil } +type SpaceMakeShareableRequest struct { + SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` +} + +func (m *SpaceMakeShareableRequest) Reset() { *m = SpaceMakeShareableRequest{} } +func (m *SpaceMakeShareableRequest) String() string { return proto.CompactTextString(m) } +func (*SpaceMakeShareableRequest) ProtoMessage() {} +func (*SpaceMakeShareableRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d94f6f99586adae2, []int{13} +} +func (m *SpaceMakeShareableRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SpaceMakeShareableRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SpaceMakeShareableRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SpaceMakeShareableRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SpaceMakeShareableRequest.Merge(m, src) +} +func (m *SpaceMakeShareableRequest) XXX_Size() int { + return m.Size() +} +func (m *SpaceMakeShareableRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SpaceMakeShareableRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SpaceMakeShareableRequest proto.InternalMessageInfo + +func (m *SpaceMakeShareableRequest) GetSpaceId() string { + if m != nil { + return m.SpaceId + } + return "" +} + +type SpaceMakeShareableResponse struct { +} + +func (m *SpaceMakeShareableResponse) Reset() { *m = SpaceMakeShareableResponse{} } +func (m *SpaceMakeShareableResponse) String() string { return proto.CompactTextString(m) } +func (*SpaceMakeShareableResponse) ProtoMessage() {} +func (*SpaceMakeShareableResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d94f6f99586adae2, []int{14} +} +func (m *SpaceMakeShareableResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SpaceMakeShareableResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SpaceMakeShareableResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SpaceMakeShareableResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SpaceMakeShareableResponse.Merge(m, src) +} +func (m *SpaceMakeShareableResponse) XXX_Size() int { + return m.Size() +} +func (m *SpaceMakeShareableResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SpaceMakeShareableResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SpaceMakeShareableResponse proto.InternalMessageInfo + +type SpaceMakeUnshareableRequest struct { + SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` + AclHead string `protobuf:"bytes,2,opt,name=aclHead,proto3" json:"aclHead,omitempty"` +} + +func (m *SpaceMakeUnshareableRequest) Reset() { *m = SpaceMakeUnshareableRequest{} } +func (m *SpaceMakeUnshareableRequest) String() string { return proto.CompactTextString(m) } +func (*SpaceMakeUnshareableRequest) ProtoMessage() {} +func (*SpaceMakeUnshareableRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d94f6f99586adae2, []int{15} +} +func (m *SpaceMakeUnshareableRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SpaceMakeUnshareableRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SpaceMakeUnshareableRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SpaceMakeUnshareableRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SpaceMakeUnshareableRequest.Merge(m, src) +} +func (m *SpaceMakeUnshareableRequest) XXX_Size() int { + return m.Size() +} +func (m *SpaceMakeUnshareableRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SpaceMakeUnshareableRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SpaceMakeUnshareableRequest proto.InternalMessageInfo + +func (m *SpaceMakeUnshareableRequest) GetSpaceId() string { + if m != nil { + return m.SpaceId + } + return "" +} + +func (m *SpaceMakeUnshareableRequest) GetAclHead() string { + if m != nil { + return m.AclHead + } + return "" +} + +type SpaceMakeUnshareableResponse struct { +} + +func (m *SpaceMakeUnshareableResponse) Reset() { *m = SpaceMakeUnshareableResponse{} } +func (m *SpaceMakeUnshareableResponse) String() string { return proto.CompactTextString(m) } +func (*SpaceMakeUnshareableResponse) ProtoMessage() {} +func (*SpaceMakeUnshareableResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d94f6f99586adae2, []int{16} +} +func (m *SpaceMakeUnshareableResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SpaceMakeUnshareableResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SpaceMakeUnshareableResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SpaceMakeUnshareableResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SpaceMakeUnshareableResponse.Merge(m, src) +} +func (m *SpaceMakeUnshareableResponse) XXX_Size() int { + return m.Size() +} +func (m *SpaceMakeUnshareableResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SpaceMakeUnshareableResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SpaceMakeUnshareableResponse proto.InternalMessageInfo + // NetworkConfigurationRequest contains currenId of the client configuration, it can be empty type NetworkConfigurationRequest struct { // currenId of the client configuration @@ -964,7 +1156,7 @@ func (m *NetworkConfigurationRequest) Reset() { *m = NetworkConfiguratio func (m *NetworkConfigurationRequest) String() string { return proto.CompactTextString(m) } func (*NetworkConfigurationRequest) ProtoMessage() {} func (*NetworkConfigurationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{13} + return fileDescriptor_d94f6f99586adae2, []int{17} } func (m *NetworkConfigurationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1016,7 +1208,7 @@ func (m *NetworkConfigurationResponse) Reset() { *m = NetworkConfigurati func (m *NetworkConfigurationResponse) String() string { return proto.CompactTextString(m) } func (*NetworkConfigurationResponse) ProtoMessage() {} func (*NetworkConfigurationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{14} + return fileDescriptor_d94f6f99586adae2, []int{18} } func (m *NetworkConfigurationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1087,7 +1279,7 @@ func (m *Node) Reset() { *m = Node{} } func (m *Node) String() string { return proto.CompactTextString(m) } func (*Node) ProtoMessage() {} func (*Node) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{15} + return fileDescriptor_d94f6f99586adae2, []int{19} } func (m *Node) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1147,7 +1339,7 @@ func (m *DeletionConfirmPayloadWithSignature) Reset() { *m = DeletionCon func (m *DeletionConfirmPayloadWithSignature) String() string { return proto.CompactTextString(m) } func (*DeletionConfirmPayloadWithSignature) ProtoMessage() {} func (*DeletionConfirmPayloadWithSignature) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{16} + return fileDescriptor_d94f6f99586adae2, []int{20} } func (m *DeletionConfirmPayloadWithSignature) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1208,7 +1400,7 @@ func (m *DeletionConfirmPayload) Reset() { *m = DeletionConfirmPayload{} func (m *DeletionConfirmPayload) String() string { return proto.CompactTextString(m) } func (*DeletionConfirmPayload) ProtoMessage() {} func (*DeletionConfirmPayload) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{17} + return fileDescriptor_d94f6f99586adae2, []int{21} } func (m *DeletionConfirmPayload) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1283,7 +1475,7 @@ func (m *DeletionLogRequest) Reset() { *m = DeletionLogRequest{} } func (m *DeletionLogRequest) String() string { return proto.CompactTextString(m) } func (*DeletionLogRequest) ProtoMessage() {} func (*DeletionLogRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{18} + return fileDescriptor_d94f6f99586adae2, []int{22} } func (m *DeletionLogRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1337,7 +1529,7 @@ func (m *DeletionLogResponse) Reset() { *m = DeletionLogResponse{} } func (m *DeletionLogResponse) String() string { return proto.CompactTextString(m) } func (*DeletionLogResponse) ProtoMessage() {} func (*DeletionLogResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{19} + return fileDescriptor_d94f6f99586adae2, []int{23} } func (m *DeletionLogResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1397,7 +1589,7 @@ func (m *DeletionLogRecord) Reset() { *m = DeletionLogRecord{} } func (m *DeletionLogRecord) String() string { return proto.CompactTextString(m) } func (*DeletionLogRecord) ProtoMessage() {} func (*DeletionLogRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{20} + return fileDescriptor_d94f6f99586adae2, []int{24} } func (m *DeletionLogRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1473,7 +1665,7 @@ func (m *SpaceDeleteRequest) Reset() { *m = SpaceDeleteRequest{} } func (m *SpaceDeleteRequest) String() string { return proto.CompactTextString(m) } func (*SpaceDeleteRequest) ProtoMessage() {} func (*SpaceDeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{21} + return fileDescriptor_d94f6f99586adae2, []int{25} } func (m *SpaceDeleteRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1539,7 +1731,7 @@ func (m *SpaceDeleteResponse) Reset() { *m = SpaceDeleteResponse{} } func (m *SpaceDeleteResponse) String() string { return proto.CompactTextString(m) } func (*SpaceDeleteResponse) ProtoMessage() {} func (*SpaceDeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{22} + return fileDescriptor_d94f6f99586adae2, []int{26} } func (m *SpaceDeleteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1585,7 +1777,7 @@ func (m *AccountDeleteRequest) Reset() { *m = AccountDeleteRequest{} } func (m *AccountDeleteRequest) String() string { return proto.CompactTextString(m) } func (*AccountDeleteRequest) ProtoMessage() {} func (*AccountDeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{23} + return fileDescriptor_d94f6f99586adae2, []int{27} } func (m *AccountDeleteRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1644,7 +1836,7 @@ func (m *AccountDeletionConfirmPayload) Reset() { *m = AccountDeletionCo func (m *AccountDeletionConfirmPayload) String() string { return proto.CompactTextString(m) } func (*AccountDeletionConfirmPayload) ProtoMessage() {} func (*AccountDeletionConfirmPayload) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{24} + return fileDescriptor_d94f6f99586adae2, []int{28} } func (m *AccountDeletionConfirmPayload) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1710,7 +1902,7 @@ func (m *AccountDeleteResponse) Reset() { *m = AccountDeleteResponse{} } func (m *AccountDeleteResponse) String() string { return proto.CompactTextString(m) } func (*AccountDeleteResponse) ProtoMessage() {} func (*AccountDeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{25} + return fileDescriptor_d94f6f99586adae2, []int{29} } func (m *AccountDeleteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1754,7 +1946,7 @@ func (m *AccountRevertDeletionRequest) Reset() { *m = AccountRevertDelet func (m *AccountRevertDeletionRequest) String() string { return proto.CompactTextString(m) } func (*AccountRevertDeletionRequest) ProtoMessage() {} func (*AccountRevertDeletionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{26} + return fileDescriptor_d94f6f99586adae2, []int{30} } func (m *AccountRevertDeletionRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1791,7 +1983,7 @@ func (m *AccountRevertDeletionResponse) Reset() { *m = AccountRevertDele func (m *AccountRevertDeletionResponse) String() string { return proto.CompactTextString(m) } func (*AccountRevertDeletionResponse) ProtoMessage() {} func (*AccountRevertDeletionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{27} + return fileDescriptor_d94f6f99586adae2, []int{31} } func (m *AccountRevertDeletionResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1830,7 +2022,7 @@ func (m *AclAddRecordRequest) Reset() { *m = AclAddRecordRequest{} } func (m *AclAddRecordRequest) String() string { return proto.CompactTextString(m) } func (*AclAddRecordRequest) ProtoMessage() {} func (*AclAddRecordRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{28} + return fileDescriptor_d94f6f99586adae2, []int{32} } func (m *AclAddRecordRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1883,7 +2075,7 @@ func (m *AclAddRecordResponse) Reset() { *m = AclAddRecordResponse{} } func (m *AclAddRecordResponse) String() string { return proto.CompactTextString(m) } func (*AclAddRecordResponse) ProtoMessage() {} func (*AclAddRecordResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{29} + return fileDescriptor_d94f6f99586adae2, []int{33} } func (m *AclAddRecordResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1937,7 +2129,7 @@ func (m *AclGetRecordsRequest) Reset() { *m = AclGetRecordsRequest{} } func (m *AclGetRecordsRequest) String() string { return proto.CompactTextString(m) } func (*AclGetRecordsRequest) ProtoMessage() {} func (*AclGetRecordsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{30} + return fileDescriptor_d94f6f99586adae2, []int{34} } func (m *AclGetRecordsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1989,7 +2181,7 @@ func (m *AclGetRecordsResponse) Reset() { *m = AclGetRecordsResponse{} } func (m *AclGetRecordsResponse) String() string { return proto.CompactTextString(m) } func (*AclGetRecordsResponse) ProtoMessage() {} func (*AclGetRecordsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{31} + return fileDescriptor_d94f6f99586adae2, []int{35} } func (m *AclGetRecordsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2025,6 +2217,126 @@ func (m *AclGetRecordsResponse) GetRecords() [][]byte { return nil } +type AccountLimitsSetRequest struct { + Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` + Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"` + FileStorageLimitBytes uint64 `protobuf:"varint,3,opt,name=fileStorageLimitBytes,proto3" json:"fileStorageLimitBytes,omitempty"` + SpaceMembersRead uint32 `protobuf:"varint,4,opt,name=spaceMembersRead,proto3" json:"spaceMembersRead,omitempty"` + SpaceMembersWrite uint32 `protobuf:"varint,5,opt,name=spaceMembersWrite,proto3" json:"spaceMembersWrite,omitempty"` + SharedSpacesLimit uint32 `protobuf:"varint,6,opt,name=sharedSpacesLimit,proto3" json:"sharedSpacesLimit,omitempty"` +} + +func (m *AccountLimitsSetRequest) Reset() { *m = AccountLimitsSetRequest{} } +func (m *AccountLimitsSetRequest) String() string { return proto.CompactTextString(m) } +func (*AccountLimitsSetRequest) ProtoMessage() {} +func (*AccountLimitsSetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d94f6f99586adae2, []int{36} +} +func (m *AccountLimitsSetRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AccountLimitsSetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AccountLimitsSetRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AccountLimitsSetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccountLimitsSetRequest.Merge(m, src) +} +func (m *AccountLimitsSetRequest) XXX_Size() int { + return m.Size() +} +func (m *AccountLimitsSetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AccountLimitsSetRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AccountLimitsSetRequest proto.InternalMessageInfo + +func (m *AccountLimitsSetRequest) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *AccountLimitsSetRequest) GetReason() string { + if m != nil { + return m.Reason + } + return "" +} + +func (m *AccountLimitsSetRequest) GetFileStorageLimitBytes() uint64 { + if m != nil { + return m.FileStorageLimitBytes + } + return 0 +} + +func (m *AccountLimitsSetRequest) GetSpaceMembersRead() uint32 { + if m != nil { + return m.SpaceMembersRead + } + return 0 +} + +func (m *AccountLimitsSetRequest) GetSpaceMembersWrite() uint32 { + if m != nil { + return m.SpaceMembersWrite + } + return 0 +} + +func (m *AccountLimitsSetRequest) GetSharedSpacesLimit() uint32 { + if m != nil { + return m.SharedSpacesLimit + } + return 0 +} + +type AccountLimitsSetResponse struct { +} + +func (m *AccountLimitsSetResponse) Reset() { *m = AccountLimitsSetResponse{} } +func (m *AccountLimitsSetResponse) String() string { return proto.CompactTextString(m) } +func (*AccountLimitsSetResponse) ProtoMessage() {} +func (*AccountLimitsSetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d94f6f99586adae2, []int{37} +} +func (m *AccountLimitsSetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AccountLimitsSetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AccountLimitsSetResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AccountLimitsSetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccountLimitsSetResponse.Merge(m, src) +} +func (m *AccountLimitsSetResponse) XXX_Size() int { + return m.Size() +} +func (m *AccountLimitsSetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AccountLimitsSetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AccountLimitsSetResponse proto.InternalMessageInfo + func init() { proto.RegisterEnum("coordinator.ErrorCodes", ErrorCodes_name, ErrorCodes_value) proto.RegisterEnum("coordinator.SpaceStatus", SpaceStatus_name, SpaceStatus_value) @@ -2033,18 +2345,22 @@ func init() { proto.RegisterEnum("coordinator.DeletionPayloadType", DeletionPayloadType_name, DeletionPayloadType_value) proto.RegisterEnum("coordinator.DeletionLogRecordStatus", DeletionLogRecordStatus_name, DeletionLogRecordStatus_value) proto.RegisterType((*SpaceSignRequest)(nil), "coordinator.SpaceSignRequest") + proto.RegisterType((*SpaceLimits)(nil), "coordinator.SpaceLimits") proto.RegisterType((*SpaceStatusPayload)(nil), "coordinator.SpaceStatusPayload") proto.RegisterType((*SpaceSignResponse)(nil), "coordinator.SpaceSignResponse") proto.RegisterType((*SpaceReceiptWithSignature)(nil), "coordinator.SpaceReceiptWithSignature") proto.RegisterType((*SpaceReceipt)(nil), "coordinator.SpaceReceipt") - proto.RegisterType((*FileLimitCheckRequest)(nil), "coordinator.FileLimitCheckRequest") - proto.RegisterType((*FileLimitCheckResponse)(nil), "coordinator.FileLimitCheckResponse") proto.RegisterType((*SpaceStatusCheckRequest)(nil), "coordinator.SpaceStatusCheckRequest") proto.RegisterType((*SpaceStatusCheckResponse)(nil), "coordinator.SpaceStatusCheckResponse") proto.RegisterType((*SpaceStatusCheckManyRequest)(nil), "coordinator.SpaceStatusCheckManyRequest") proto.RegisterType((*SpaceStatusCheckManyResponse)(nil), "coordinator.SpaceStatusCheckManyResponse") + proto.RegisterType((*AccountLimits)(nil), "coordinator.AccountLimits") proto.RegisterType((*SpaceStatusChangeRequest)(nil), "coordinator.SpaceStatusChangeRequest") proto.RegisterType((*SpaceStatusChangeResponse)(nil), "coordinator.SpaceStatusChangeResponse") + proto.RegisterType((*SpaceMakeShareableRequest)(nil), "coordinator.SpaceMakeShareableRequest") + proto.RegisterType((*SpaceMakeShareableResponse)(nil), "coordinator.SpaceMakeShareableResponse") + proto.RegisterType((*SpaceMakeUnshareableRequest)(nil), "coordinator.SpaceMakeUnshareableRequest") + proto.RegisterType((*SpaceMakeUnshareableResponse)(nil), "coordinator.SpaceMakeUnshareableResponse") proto.RegisterType((*NetworkConfigurationRequest)(nil), "coordinator.NetworkConfigurationRequest") proto.RegisterType((*NetworkConfigurationResponse)(nil), "coordinator.NetworkConfigurationResponse") proto.RegisterType((*Node)(nil), "coordinator.Node") @@ -2064,6 +2380,8 @@ func init() { proto.RegisterType((*AclAddRecordResponse)(nil), "coordinator.AclAddRecordResponse") proto.RegisterType((*AclGetRecordsRequest)(nil), "coordinator.AclGetRecordsRequest") proto.RegisterType((*AclGetRecordsResponse)(nil), "coordinator.AclGetRecordsResponse") + proto.RegisterType((*AccountLimitsSetRequest)(nil), "coordinator.AccountLimitsSetRequest") + proto.RegisterType((*AccountLimitsSetResponse)(nil), "coordinator.AccountLimitsSetResponse") } func init() { @@ -2071,109 +2389,126 @@ func init() { } var fileDescriptor_d94f6f99586adae2 = []byte{ - // 1626 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xcf, 0x6f, 0x13, 0xc7, - 0x17, 0xf7, 0x6e, 0x9c, 0xc4, 0x7e, 0x0e, 0x66, 0x33, 0xf9, 0x81, 0x31, 0xc6, 0x84, 0x85, 0x2f, - 0xdf, 0xe0, 0xef, 0x57, 0x40, 0x8d, 0x5a, 0x15, 0x51, 0xa9, 0x84, 0x40, 0x69, 0xf8, 0x11, 0xa2, - 0x0d, 0xa1, 0x6a, 0x39, 0x54, 0xcb, 0xee, 0xc4, 0x59, 0xc5, 0x9e, 0x75, 0x67, 0xc7, 0x84, 0xfc, - 0x17, 0xbd, 0xf5, 0xd4, 0x7b, 0xa5, 0xf6, 0x50, 0x55, 0xaa, 0x7a, 0xa8, 0xd4, 0x73, 0x8f, 0x1c, - 0x7b, 0x44, 0x70, 0xed, 0x1f, 0x51, 0xcd, 0xec, 0xec, 0xee, 0xec, 0x0f, 0x3b, 0xa9, 0x38, 0x70, - 0x49, 0x3c, 0x9f, 0x79, 0xef, 0xcd, 0xfb, 0x35, 0xef, 0xcd, 0x5b, 0xf8, 0xd0, 0xf1, 0x7d, 0xea, - 0x7a, 0xc4, 0x66, 0x3e, 0xbd, 0xaa, 0xfc, 0x1e, 0x52, 0x9f, 0xf9, 0x57, 0xc5, 0xdf, 0x40, 0xc5, - 0xaf, 0x08, 0x08, 0xd5, 0x14, 0xc8, 0xfc, 0x43, 0x03, 0x63, 0x7b, 0x68, 0x3b, 0x78, 0xdb, 0xeb, - 0x11, 0x0b, 0x7f, 0x33, 0xc2, 0x01, 0x43, 0x0d, 0x98, 0x0d, 0x38, 0xb6, 0xe1, 0x36, 0xb4, 0x15, - 0x6d, 0xb5, 0x6a, 0x45, 0x4b, 0xb4, 0x0c, 0x33, 0x7b, 0xd8, 0x76, 0x31, 0x6d, 0xe8, 0x2b, 0xda, - 0xea, 0x9c, 0x25, 0x57, 0x68, 0x05, 0x6a, 0x7e, 0xdf, 0xdd, 0x70, 0x31, 0x61, 0x1e, 0x3b, 0x6c, - 0x4c, 0x89, 0x4d, 0x15, 0x42, 0x5d, 0x58, 0x24, 0xf8, 0x20, 0x5a, 0xf2, 0xd3, 0x6c, 0x36, 0xa2, - 0xb8, 0x51, 0x16, 0xa4, 0x85, 0x7b, 0xc8, 0x84, 0xb9, 0x5d, 0x9f, 0x3a, 0x58, 0xea, 0xd5, 0x98, - 0x5e, 0xd1, 0x56, 0x2b, 0x56, 0x0a, 0x33, 0x7f, 0xd5, 0x00, 0x85, 0x06, 0x30, 0x9b, 0x8d, 0x82, - 0x2d, 0xfb, 0xb0, 0xef, 0xdb, 0x2e, 0xba, 0x06, 0x33, 0x81, 0x00, 0x84, 0x05, 0xf5, 0x6e, 0xe3, - 0x8a, 0xea, 0x08, 0x85, 0xc1, 0x92, 0x74, 0xe8, 0xff, 0x30, 0xef, 0xe2, 0x3e, 0x66, 0x9e, 0x4f, - 0x9e, 0x78, 0x03, 0x1c, 0x30, 0x7b, 0x30, 0x14, 0x56, 0x4e, 0x59, 0xf9, 0x0d, 0xf4, 0x29, 0xd4, - 0x86, 0x98, 0x0e, 0xbc, 0x20, 0xf0, 0x7c, 0x12, 0x08, 0x83, 0xeb, 0xdd, 0xb3, 0xf9, 0x43, 0xb6, - 0x12, 0x22, 0x4b, 0xe5, 0x30, 0x77, 0x60, 0x5e, 0xf1, 0x7b, 0x30, 0xf4, 0x49, 0x80, 0xd1, 0x2d, - 0x98, 0xa5, 0xd8, 0xc1, 0xde, 0x90, 0x09, 0xb5, 0x6b, 0xdd, 0x4b, 0x79, 0x89, 0x56, 0x48, 0xf0, - 0x85, 0xc7, 0xf6, 0x62, 0x4f, 0x59, 0x11, 0x9b, 0xb9, 0x0f, 0xa7, 0xc7, 0x52, 0xa1, 0x6b, 0xb0, - 0x10, 0x28, 0x9b, 0xd2, 0x57, 0xe2, 0xa8, 0x39, 0xab, 0x68, 0x0b, 0xb5, 0xa0, 0x1a, 0xc4, 0xa1, - 0x0a, 0x43, 0x9e, 0x00, 0xe6, 0x0f, 0x1a, 0xcc, 0xa9, 0xa7, 0x4d, 0x4e, 0x9c, 0x21, 0xc6, 0x74, - 0xc3, 0x15, 0x52, 0xaa, 0x96, 0x5c, 0xa1, 0x55, 0x38, 0x69, 0x3b, 0x8e, 0x3f, 0x22, 0x2c, 0x93, - 0x3c, 0x59, 0x98, 0xab, 0x42, 0x30, 0x3b, 0xf0, 0xe9, 0xfe, 0x86, 0x2b, 0xb2, 0xa6, 0x6a, 0x25, - 0x00, 0x6a, 0x03, 0xbc, 0xb0, 0xfb, 0x9e, 0xbb, 0x43, 0x98, 0xd7, 0x17, 0x89, 0x52, 0xb6, 0x14, - 0xc4, 0x7c, 0x06, 0x4b, 0x9f, 0x79, 0x7d, 0xfc, 0xd0, 0x1b, 0x78, 0x6c, 0x7d, 0x0f, 0x3b, 0xfb, - 0x51, 0xae, 0x17, 0x28, 0xa0, 0x15, 0x2b, 0xa0, 0x18, 0xa7, 0xa7, 0x8c, 0x33, 0x37, 0x61, 0x39, - 0x2b, 0x5c, 0x06, 0x74, 0x11, 0xa6, 0xfb, 0x1c, 0x15, 0x32, 0xcb, 0x56, 0xb8, 0xe0, 0xca, 0x06, - 0xcc, 0xa7, 0x76, 0x0f, 0x3f, 0xc0, 0x87, 0x52, 0x98, 0x82, 0x98, 0xd7, 0xe1, 0x94, 0x92, 0xa1, - 0x29, 0x75, 0xc7, 0x7a, 0xd8, 0xdc, 0x81, 0x46, 0x9e, 0x49, 0xaa, 0x71, 0x03, 0x66, 0x87, 0x4a, - 0xb0, 0x6b, 0xdd, 0x73, 0xe3, 0xae, 0x83, 0x0c, 0xbc, 0x15, 0xd1, 0x9b, 0x37, 0xe0, 0x4c, 0x56, - 0xec, 0x23, 0x9b, 0x1c, 0x46, 0xfa, 0x34, 0xa1, 0x22, 0x15, 0xe0, 0x37, 0x6d, 0x6a, 0xb5, 0x6a, - 0xc5, 0x6b, 0xf3, 0x19, 0xb4, 0x8a, 0x59, 0xa5, 0x56, 0x37, 0xa1, 0x22, 0x4f, 0x09, 0x79, 0x8f, - 0xa1, 0x56, 0xcc, 0x60, 0xbe, 0xd6, 0x32, 0xf6, 0xda, 0xa4, 0x87, 0x8f, 0x2e, 0x60, 0xca, 0x2d, - 0x97, 0x32, 0xe3, 0x70, 0xe6, 0x37, 0x78, 0x72, 0x64, 0xc0, 0x28, 0x3b, 0x33, 0x30, 0xb2, 0x60, - 0x21, 0x03, 0x3d, 0x39, 0x1c, 0x86, 0xd5, 0xad, 0xde, 0x5d, 0x49, 0x99, 0x75, 0x27, 0x4f, 0x67, - 0x15, 0x31, 0x9b, 0x4f, 0xe5, 0x5d, 0x4e, 0x5b, 0xf8, 0xee, 0x21, 0xbd, 0x09, 0x67, 0x36, 0xc3, - 0x8b, 0xb3, 0xee, 0x93, 0x5d, 0xaf, 0x37, 0xa2, 0x36, 0x3f, 0x3a, 0x72, 0x5e, 0x0b, 0xaa, 0xce, - 0x88, 0x52, 0xcc, 0x53, 0x5f, 0xba, 0x2f, 0x01, 0xcc, 0xdf, 0x35, 0x68, 0x15, 0x73, 0x4b, 0xc5, - 0x56, 0xe1, 0xa4, 0xa3, 0x6e, 0xc4, 0x42, 0xb2, 0x70, 0xfa, 0x46, 0xeb, 0xd9, 0x1b, 0xfd, 0x5f, - 0x98, 0x26, 0xbe, 0x8b, 0x79, 0x6d, 0xe5, 0xa9, 0x31, 0x9f, 0x32, 0x6f, 0xd3, 0x77, 0xb1, 0x15, - 0xee, 0xa3, 0x0e, 0x18, 0x0e, 0xc5, 0x76, 0x54, 0x9f, 0x77, 0x88, 0xf7, 0x52, 0xf8, 0xbd, 0x6c, - 0xe5, 0x70, 0xd3, 0x83, 0x32, 0x67, 0x55, 0xca, 0x91, 0x96, 0x2a, 0x47, 0x2d, 0xa8, 0xda, 0xae, - 0x4b, 0x71, 0x10, 0xe0, 0xa0, 0xa1, 0x8b, 0x7c, 0x4e, 0x00, 0xf4, 0x3f, 0x98, 0x66, 0x87, 0x43, - 0xa9, 0x52, 0xbd, 0xbb, 0x94, 0x53, 0x49, 0xc4, 0x32, 0xa4, 0x31, 0x07, 0x70, 0x21, 0x8a, 0xb4, - 0x70, 0x14, 0x1d, 0xc8, 0x40, 0xa4, 0x6b, 0x72, 0x41, 0x8a, 0x69, 0xc5, 0x29, 0x36, 0xb9, 0x16, - 0xff, 0xac, 0xc1, 0x72, 0xf1, 0x79, 0xef, 0xb1, 0x2a, 0xb7, 0xa0, 0xca, 0xe2, 0x5e, 0x3a, 0x2d, - 0x7a, 0x69, 0x02, 0x98, 0x77, 0x00, 0x45, 0x1a, 0x3f, 0xf4, 0x7b, 0xca, 0xdd, 0xb5, 0x77, 0x99, - 0x12, 0x9b, 0x68, 0x99, 0x14, 0x53, 0xae, 0xec, 0x09, 0x59, 0x4c, 0x4d, 0x0f, 0x16, 0x52, 0x52, - 0x64, 0x1a, 0x7e, 0x2c, 0x5a, 0xa9, 0x4f, 0xe3, 0xda, 0xd2, 0x2e, 0xbc, 0x84, 0x82, 0x85, 0x93, - 0x59, 0x11, 0x39, 0x57, 0x60, 0xcf, 0x0e, 0x1e, 0xf9, 0xd2, 0xcb, 0x15, 0x2b, 0x5a, 0x9a, 0xbf, - 0x69, 0x30, 0x9f, 0x63, 0x44, 0x75, 0xd0, 0xbd, 0x48, 0x57, 0xdd, 0x73, 0xc7, 0xf7, 0x09, 0xf4, - 0x49, 0xfc, 0x28, 0x09, 0xdf, 0x0b, 0x17, 0x27, 0xab, 0x94, 0x79, 0xa0, 0xa4, 0x9c, 0x59, 0xce, - 0x38, 0x93, 0xef, 0xee, 0x7a, 0x7d, 0x7c, 0x8f, 0xfa, 0xa3, 0xd0, 0xd5, 0x55, 0x2b, 0x01, 0xcc, - 0x5f, 0xa2, 0x57, 0x92, 0x38, 0xe4, 0x3d, 0xd6, 0xc9, 0x0e, 0x18, 0x11, 0x74, 0x47, 0x56, 0x02, - 0x69, 0x4b, 0x0e, 0x37, 0x37, 0x60, 0x21, 0xa5, 0xb3, 0x8c, 0x6c, 0x17, 0x16, 0x99, 0x7f, 0x5b, - 0xa2, 0x6e, 0xf2, 0x56, 0xd3, 0x84, 0x98, 0xc2, 0x3d, 0x93, 0xc0, 0xe2, 0x5a, 0x98, 0xb9, 0x69, - 0x07, 0x14, 0x9a, 0xa9, 0xfd, 0x0b, 0x33, 0xf5, 0x42, 0x33, 0xcd, 0xef, 0x35, 0x38, 0xab, 0x1e, - 0x98, 0xbf, 0x94, 0xe3, 0x2a, 0x50, 0xc1, 0xd5, 0xd3, 0x8f, 0x71, 0xf5, 0xa6, 0x26, 0x5e, 0xbd, - 0x6c, 0xb6, 0x98, 0x0f, 0x60, 0x29, 0xe3, 0x8f, 0x77, 0x70, 0x6e, 0x1b, 0x5a, 0x52, 0x98, 0x85, - 0x5f, 0x60, 0x1a, 0x5b, 0x1c, 0x3d, 0xd1, 0xcf, 0xc5, 0xbe, 0xc8, 0xee, 0x87, 0x87, 0xf2, 0x40, - 0xaf, 0x39, 0xfd, 0x35, 0xd7, 0x95, 0x57, 0xf1, 0xc8, 0xec, 0x6c, 0x24, 0xcd, 0x2f, 0x74, 0x4e, - 0xdc, 0xdb, 0x1e, 0xf2, 0x40, 0xab, 0xa2, 0xa4, 0x5d, 0x4d, 0xa8, 0x84, 0xf7, 0x3b, 0x16, 0x16, - 0xaf, 0x27, 0x48, 0xbb, 0x2f, 0xa4, 0xdd, 0xc3, 0x2c, 0x94, 0x16, 0x1c, 0x4b, 0x33, 0xdb, 0xe9, - 0x7f, 0x8e, 0xed, 0xf8, 0xf2, 0xcb, 0xa5, 0xf9, 0x01, 0x77, 0x79, 0x4a, 0x96, 0x54, 0xad, 0x91, - 0xae, 0x54, 0x73, 0x71, 0x25, 0xea, 0xfc, 0xa8, 0x01, 0xdc, 0xa5, 0xd4, 0xa7, 0xeb, 0xa2, 0xd1, - 0xd5, 0x01, 0x76, 0x08, 0x7e, 0x39, 0xc4, 0x0e, 0xc3, 0xae, 0x51, 0x42, 0x86, 0x7c, 0x7d, 0xcb, - 0x80, 0x18, 0x1a, 0x6a, 0xc0, 0x62, 0x82, 0xf0, 0x74, 0xc4, 0xc4, 0xf5, 0x48, 0xcf, 0xd0, 0x63, - 0xda, 0x75, 0xde, 0x11, 0xb1, 0x6b, 0x4c, 0x21, 0x04, 0x75, 0x81, 0x6c, 0xfa, 0xec, 0xee, 0x4b, - 0x2f, 0x60, 0x81, 0x51, 0x46, 0x4b, 0x72, 0x28, 0x11, 0x2f, 0x59, 0x0b, 0xdb, 0xce, 0x1e, 0x76, - 0x8d, 0x69, 0x4e, 0x9a, 0xca, 0x16, 0xd7, 0x98, 0x41, 0x06, 0xd4, 0x84, 0x6a, 0x8f, 0x77, 0x77, - 0x03, 0xcc, 0x8c, 0x9f, 0xf4, 0xce, 0x77, 0x1a, 0xd4, 0x94, 0x67, 0x07, 0x5a, 0x4e, 0x0d, 0x66, - 0xd1, 0xc1, 0x25, 0xd4, 0x86, 0xa6, 0xfa, 0x3a, 0x09, 0x55, 0x8c, 0x34, 0x36, 0xb4, 0xcc, 0x7e, - 0xb4, 0xb1, 0xcd, 0x6c, 0xca, 0xf9, 0xf5, 0x8c, 0xdc, 0x48, 0xa3, 0xa9, 0xd8, 0xf8, 0x10, 0x57, - 0xcc, 0xea, 0xdc, 0x97, 0x33, 0xae, 0x32, 0x8c, 0xa1, 0x33, 0xf2, 0x8d, 0xad, 0x60, 0x3b, 0x64, - 0x9f, 0xf8, 0x07, 0xc4, 0x28, 0xa1, 0xd3, 0xb0, 0x94, 0xdd, 0x7c, 0x7c, 0x40, 0x30, 0x35, 0xb4, - 0xce, 0x01, 0x54, 0xa2, 0x4e, 0x8f, 0x6a, 0x30, 0xfb, 0x84, 0x62, 0xbc, 0xb6, 0xb5, 0x61, 0x94, - 0xf8, 0x82, 0x0f, 0x01, 0x7c, 0xa1, 0x71, 0x8f, 0xad, 0x27, 0xa5, 0x9d, 0x63, 0x22, 0x04, 0xeb, - 0x3c, 0xe0, 0x24, 0x18, 0x05, 0x1c, 0x99, 0x42, 0xf3, 0x70, 0x62, 0xd3, 0x1e, 0x78, 0xa4, 0xc7, - 0x25, 0x72, 0xa8, 0xcc, 0x8d, 0xd8, 0xb2, 0x0f, 0x07, 0x98, 0xb0, 0x2d, 0xea, 0x3b, 0x38, 0x08, - 0x3c, 0xd2, 0xe3, 0x3b, 0xd3, 0x9d, 0x1b, 0x49, 0x9f, 0x53, 0x1e, 0x89, 0xa8, 0x02, 0x65, 0xae, - 0x43, 0xa8, 0x80, 0xac, 0x31, 0x86, 0xc6, 0x17, 0x32, 0x64, 0x86, 0xde, 0xb9, 0x05, 0xa7, 0xc6, - 0x34, 0x17, 0x34, 0x03, 0xfa, 0xe3, 0x7d, 0xa3, 0xc4, 0x55, 0xb1, 0xf0, 0xc0, 0x7f, 0x81, 0xb7, - 0x28, 0x1e, 0xda, 0x14, 0x1b, 0x1a, 0x02, 0x98, 0x09, 0x21, 0x43, 0xef, 0xfe, 0x5d, 0x81, 0x9a, - 0x62, 0x10, 0xba, 0x0f, 0xd5, 0x78, 0x7a, 0x45, 0x05, 0x63, 0xaf, 0xf2, 0x35, 0xa1, 0xd9, 0x1e, - 0xb7, 0x2d, 0xf3, 0xff, 0x4b, 0xa8, 0xa7, 0xa7, 0x27, 0x64, 0xa6, 0x38, 0x0a, 0xe7, 0xb6, 0xe6, - 0x85, 0x89, 0x34, 0x52, 0xf4, 0xd7, 0xd1, 0xc7, 0x8d, 0x64, 0x02, 0x41, 0x17, 0xc7, 0xbd, 0x93, - 0x53, 0xe2, 0xff, 0x73, 0x04, 0x95, 0x3c, 0x60, 0x3f, 0x95, 0x73, 0xf1, 0x88, 0x83, 0x56, 0x27, - 0xb2, 0x2b, 0x03, 0x54, 0xf3, 0xf2, 0x31, 0x28, 0xe5, 0x61, 0xcf, 0xa3, 0x4f, 0x06, 0xca, 0x3c, - 0x80, 0x26, 0x28, 0xaa, 0x4c, 0x44, 0xcd, 0x4b, 0x47, 0x91, 0x25, 0x06, 0x15, 0xbd, 0xee, 0x33, - 0x06, 0x4d, 0x18, 0x1f, 0x32, 0x06, 0x4d, 0x1c, 0x15, 0xb6, 0xa0, 0xa6, 0xe4, 0x25, 0x3a, 0x37, - 0xfe, 0x39, 0x14, 0x8a, 0x5e, 0x19, 0x4f, 0x90, 0x48, 0x54, 0x4a, 0x22, 0x2a, 0x98, 0x89, 0x52, - 0xfd, 0x3f, 0x23, 0xb1, 0xe8, 0xb5, 0xf1, 0x14, 0x4e, 0xa4, 0x6a, 0x1f, 0x3a, 0x9f, 0x62, 0x29, - 0x7a, 0x55, 0x34, 0xcd, 0x49, 0x24, 0x52, 0x2e, 0x89, 0x3b, 0x70, 0xba, 0x29, 0xa2, 0xcb, 0x45, - 0xcc, 0x85, 0x8d, 0xb5, 0xd9, 0x39, 0x0e, 0xa9, 0x3c, 0x6f, 0x1b, 0xe6, 0xd4, 0xc6, 0x88, 0x56, - 0x32, 0xbc, 0xb9, 0xf6, 0xdb, 0x3c, 0x3f, 0x81, 0x42, 0x75, 0x8e, 0xd2, 0xd3, 0x72, 0xce, 0xc9, - 0xf7, 0xce, 0x9c, 0x73, 0x0a, 0x5a, 0xe2, 0xed, 0x8f, 0xfe, 0x7c, 0xd3, 0xd6, 0x5e, 0xbd, 0x69, - 0x6b, 0xaf, 0xdf, 0xb4, 0xb5, 0x6f, 0xdf, 0xb6, 0x4b, 0xaf, 0xde, 0xb6, 0x4b, 0x7f, 0xbd, 0x6d, - 0x97, 0xbe, 0x6a, 0x4d, 0xfa, 0xe6, 0xf9, 0x7c, 0x46, 0xfc, 0xbb, 0xfe, 0x4f, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x83, 0x2d, 0x56, 0x38, 0x1a, 0x15, 0x00, 0x00, + // 1896 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0xcd, 0x73, 0x13, 0xc9, + 0x15, 0xd7, 0x8c, 0x65, 0x5b, 0x7a, 0xb2, 0xcd, 0xb8, 0x6d, 0x83, 0x10, 0x42, 0x98, 0x09, 0x01, + 0xa3, 0xa4, 0x80, 0x88, 0x90, 0x0a, 0x45, 0x52, 0xc1, 0x98, 0x8f, 0x88, 0x60, 0xe3, 0x8c, 0x30, + 0x54, 0xe5, 0x42, 0x8d, 0x67, 0xda, 0xf2, 0x94, 0xa5, 0x1e, 0xa5, 0xa7, 0x85, 0xd1, 0x39, 0xc7, + 0x5c, 0x72, 0xcb, 0x69, 0xef, 0x7b, 0xd8, 0xc3, 0xd6, 0x5e, 0xf6, 0xb0, 0x55, 0x7b, 0xdc, 0xda, + 0x23, 0xc7, 0x3d, 0x52, 0xf0, 0x4f, 0xec, 0x71, 0xab, 0x7b, 0x7a, 0x46, 0x3d, 0x1f, 0x92, 0xbd, + 0xc5, 0x81, 0x8b, 0xed, 0x7e, 0xef, 0xf5, 0x7b, 0xaf, 0x7f, 0xfd, 0xde, 0xeb, 0xf7, 0xc6, 0x70, + 0xc7, 0xf1, 0x7d, 0xea, 0x7a, 0xc4, 0x66, 0x3e, 0xbd, 0xa9, 0xfc, 0x3d, 0xa0, 0x3e, 0xf3, 0x6f, + 0x8a, 0x9f, 0x81, 0x4a, 0xbf, 0x21, 0x48, 0xa8, 0xa2, 0x90, 0xcc, 0xef, 0x35, 0x30, 0x3a, 0x03, + 0xdb, 0xc1, 0x1d, 0xaf, 0x4b, 0x2c, 0xfc, 0xef, 0x21, 0x0e, 0x18, 0xaa, 0xc2, 0x7c, 0xc0, 0x69, + 0x6d, 0xb7, 0xaa, 0xad, 0x6b, 0x1b, 0x65, 0x2b, 0x5a, 0xa2, 0xb3, 0x30, 0x77, 0x88, 0x6d, 0x17, + 0xd3, 0xaa, 0xbe, 0xae, 0x6d, 0x2c, 0x58, 0x72, 0x85, 0xd6, 0xa1, 0xe2, 0xf7, 0xdc, 0xb6, 0x8b, + 0x09, 0xf3, 0xd8, 0xa8, 0x3a, 0x23, 0x98, 0x2a, 0x09, 0xb5, 0x60, 0x95, 0xe0, 0xe3, 0x68, 0xc9, + 0xad, 0xd9, 0x6c, 0x48, 0x71, 0xb5, 0x28, 0x44, 0x73, 0x79, 0xc8, 0x84, 0x85, 0x03, 0x9f, 0x3a, + 0x58, 0xfa, 0x55, 0x9d, 0x5d, 0xd7, 0x36, 0x4a, 0x56, 0x82, 0x66, 0x76, 0xa0, 0x22, 0xfc, 0x7f, + 0xe6, 0xf5, 0x3d, 0x16, 0x70, 0x47, 0x28, 0xb6, 0xdd, 0x6d, 0xdc, 0xdf, 0xc7, 0x34, 0x10, 0xee, + 0x2f, 0x5a, 0x2a, 0x89, 0x2b, 0x3d, 0xa6, 0x1e, 0xc3, 0x91, 0x88, 0x2e, 0x44, 0x12, 0x34, 0xf3, + 0x3f, 0x3a, 0xa0, 0x10, 0x15, 0x66, 0xb3, 0x61, 0xb0, 0x6b, 0x8f, 0x7a, 0xbe, 0xed, 0xa2, 0x5b, + 0x30, 0x17, 0x08, 0x82, 0xd0, 0xbb, 0xd4, 0xaa, 0xde, 0x50, 0xd1, 0x55, 0x36, 0x58, 0x52, 0x0e, + 0xfd, 0x1e, 0x96, 0x5d, 0xdc, 0xc3, 0xcc, 0xf3, 0xc9, 0x0b, 0xaf, 0x8f, 0x03, 0x66, 0xf7, 0x07, + 0xc2, 0xe2, 0x8c, 0x95, 0x65, 0xa0, 0xbf, 0x41, 0x65, 0x80, 0x69, 0xdf, 0x0b, 0x02, 0xcf, 0x27, + 0x81, 0x40, 0x71, 0xa9, 0x75, 0x31, 0x6b, 0x64, 0x77, 0x2c, 0x64, 0xa9, 0x3b, 0xb8, 0x83, 0x3d, + 0x81, 0x83, 0x80, 0xb5, 0x92, 0xe7, 0x60, 0x88, 0x93, 0x25, 0xe5, 0x50, 0x0d, 0x4a, 0x5e, 0xd0, + 0x39, 0xb4, 0x29, 0x76, 0x25, 0xbc, 0xf1, 0xda, 0xdc, 0x83, 0x65, 0x25, 0x34, 0x82, 0x81, 0x4f, + 0x02, 0x8c, 0xee, 0xc3, 0x3c, 0xc5, 0x0e, 0xf6, 0x06, 0x4c, 0x80, 0x50, 0x69, 0x5d, 0xcd, 0xda, + 0xb0, 0x42, 0x81, 0x57, 0x1e, 0x3b, 0x8c, 0x2f, 0xd3, 0x8a, 0xb6, 0x99, 0x47, 0x70, 0x7e, 0xa2, + 0x14, 0xba, 0x05, 0x2b, 0x81, 0xc2, 0x94, 0xc8, 0x0b, 0x53, 0x0b, 0x56, 0x1e, 0x0b, 0xd5, 0xa1, + 0x1c, 0xc4, 0xd1, 0x14, 0x46, 0xe5, 0x98, 0x60, 0x7e, 0xa9, 0xc1, 0x82, 0x6a, 0x6d, 0x7a, 0x6c, + 0x0f, 0x30, 0xa6, 0x6d, 0x57, 0x68, 0x29, 0x5b, 0x72, 0x85, 0x36, 0xe0, 0x8c, 0xed, 0x38, 0xfe, + 0x90, 0xb0, 0x54, 0x7c, 0xa7, 0xc9, 0xdc, 0x15, 0x82, 0xd9, 0xb1, 0x4f, 0x8f, 0xda, 0xae, 0xb8, + 0x81, 0xb2, 0x35, 0x26, 0xa0, 0x06, 0xc0, 0x1b, 0xbb, 0xe7, 0xb9, 0x7b, 0x84, 0x79, 0x3d, 0x01, + 0x76, 0xd1, 0x52, 0x28, 0xe6, 0x6d, 0x38, 0xa7, 0x84, 0xd0, 0xd6, 0x21, 0x76, 0x8e, 0x4e, 0x4c, + 0x48, 0x73, 0x0f, 0xaa, 0xd9, 0x4d, 0xf2, 0xaa, 0xee, 0xc2, 0xfc, 0x40, 0xc1, 0xaf, 0xd2, 0xba, + 0x34, 0x29, 0x5e, 0x25, 0x96, 0x56, 0x24, 0x6f, 0xde, 0x85, 0x0b, 0x69, 0xb5, 0xdb, 0x36, 0x19, + 0x45, 0xfe, 0xd4, 0xa0, 0x24, 0x1d, 0xe0, 0xa9, 0x30, 0xb3, 0x51, 0xb6, 0xe2, 0xb5, 0xf9, 0x85, + 0x06, 0xf5, 0xfc, 0xbd, 0xd2, 0xad, 0x7b, 0x50, 0x92, 0x66, 0xc2, 0xcd, 0xa7, 0xf0, 0x2b, 0xde, + 0x80, 0xee, 0xc3, 0xa2, 0x44, 0x3d, 0x0c, 0x64, 0x71, 0x57, 0x95, 0x56, 0x2d, 0xa1, 0x61, 0x53, + 0x95, 0xb0, 0x92, 0x1b, 0xcc, 0xbf, 0xc2, 0x62, 0x82, 0xcf, 0x73, 0x34, 0x10, 0x01, 0x2f, 0x0c, + 0x07, 0x82, 0x2a, 0x0b, 0x47, 0x96, 0x61, 0xbe, 0xd7, 0x52, 0x88, 0xdb, 0xa4, 0x8b, 0x4f, 0x2e, + 0x9c, 0x4a, 0x21, 0x90, 0x87, 0x8a, 0xe3, 0x2c, 0xcb, 0xe0, 0x21, 0x97, 0x22, 0x46, 0x21, 0x97, + 0x22, 0x23, 0x0b, 0x56, 0x52, 0xa4, 0x17, 0xa3, 0x41, 0x58, 0x55, 0x97, 0x5a, 0xeb, 0x09, 0x54, + 0x1e, 0x66, 0xe5, 0xac, 0xbc, 0xcd, 0xe6, 0x4b, 0x99, 0xa0, 0xc9, 0x13, 0x7e, 0x7a, 0x50, 0xdd, + 0x91, 0x7a, 0xb7, 0xed, 0x23, 0x2c, 0x4a, 0x8c, 0xbd, 0xdf, 0x3b, 0x19, 0x3a, 0xb3, 0x0e, 0xb5, + 0xbc, 0x6d, 0xa1, 0x3f, 0xe6, 0x3f, 0x65, 0xa4, 0x72, 0xee, 0x1e, 0x09, 0x4e, 0xad, 0x96, 0x73, + 0x6c, 0xa7, 0xf7, 0x77, 0x6c, 0x47, 0xf7, 0x10, 0x2d, 0xcd, 0x86, 0x0c, 0xe0, 0x8c, 0x4a, 0x69, + 0xf2, 0x1e, 0x5c, 0xd8, 0x09, 0xb3, 0x7a, 0xcb, 0x27, 0x07, 0x5e, 0x77, 0x48, 0x6d, 0x0e, 0x61, + 0x64, 0xb2, 0x0e, 0x65, 0x67, 0x48, 0x29, 0xe6, 0x85, 0x41, 0x1a, 0x1d, 0x13, 0xcc, 0xef, 0x34, + 0xa8, 0xe7, 0xef, 0x96, 0x00, 0x6f, 0xc0, 0x19, 0x47, 0x65, 0xc4, 0x4a, 0xd2, 0xe4, 0x64, 0xb9, + 0xd1, 0xd3, 0xe5, 0xe6, 0x1a, 0xcc, 0x12, 0xdf, 0xc5, 0xfc, 0x19, 0xe1, 0x39, 0xb6, 0x9c, 0xb8, + 0xa6, 0x1d, 0xdf, 0xc5, 0x56, 0xc8, 0x47, 0x4d, 0x30, 0x1c, 0x8a, 0xed, 0xe8, 0x29, 0xda, 0x23, + 0xde, 0x5b, 0x11, 0x3f, 0x45, 0x2b, 0x43, 0x37, 0x3d, 0x28, 0xf2, 0xad, 0x4a, 0xad, 0xd4, 0x12, + 0xb5, 0xb2, 0x0e, 0x65, 0xdb, 0x75, 0x29, 0x0e, 0x02, 0xcc, 0x53, 0x93, 0x57, 0x86, 0x31, 0x01, + 0xfd, 0x0e, 0x66, 0xd9, 0x68, 0x20, 0x5d, 0x5a, 0x6a, 0xad, 0x65, 0x5c, 0x12, 0x31, 0x19, 0xca, + 0x98, 0x7d, 0xf8, 0x4d, 0x14, 0xb1, 0x02, 0x28, 0xda, 0x97, 0x01, 0x95, 0x7c, 0x30, 0x72, 0x52, + 0x45, 0xcb, 0x4f, 0x95, 0xe9, 0x0f, 0xc5, 0xd7, 0x1a, 0x9c, 0xcd, 0xb7, 0xf7, 0x19, 0x9f, 0x8c, + 0x3a, 0x94, 0x59, 0xdc, 0x36, 0xcc, 0x8a, 0xb6, 0x61, 0x4c, 0x30, 0x1f, 0x02, 0x8a, 0x3c, 0x7e, + 0xe6, 0x77, 0x95, 0x88, 0xb7, 0x0f, 0x98, 0x72, 0x37, 0xd1, 0x12, 0xad, 0xc2, 0xac, 0x78, 0xf5, + 0x65, 0xcb, 0x13, 0x2e, 0x4c, 0x0f, 0x56, 0x12, 0x5a, 0x64, 0x18, 0xfe, 0x59, 0xbc, 0xf3, 0x3e, + 0x8d, 0x8b, 0x74, 0x23, 0xb7, 0x98, 0x88, 0x2d, 0x5c, 0xcc, 0x8a, 0xc4, 0xb9, 0x03, 0x87, 0x76, + 0xb0, 0xed, 0x4b, 0x94, 0x4b, 0x56, 0xb4, 0x34, 0xbf, 0xd5, 0x60, 0x39, 0xb3, 0x11, 0x2d, 0x81, + 0xee, 0x45, 0xbe, 0xea, 0x5e, 0x02, 0x6e, 0x3d, 0x09, 0xf7, 0x5f, 0xe2, 0xfe, 0x2b, 0x6c, 0x8d, + 0xae, 0x4c, 0x77, 0x29, 0xd5, 0x8b, 0x25, 0xc0, 0x2c, 0xa6, 0xc0, 0xe4, 0xdc, 0x03, 0xaf, 0x87, + 0x9f, 0x50, 0x7f, 0x18, 0x42, 0x5d, 0xb6, 0xc6, 0x04, 0xf3, 0x1b, 0x4d, 0x36, 0x84, 0xc2, 0xc8, + 0x67, 0xac, 0xf7, 0x4d, 0x30, 0x22, 0xd2, 0x43, 0x59, 0x09, 0xe4, 0x59, 0x32, 0x74, 0xb3, 0x0d, + 0x2b, 0x09, 0x9f, 0xe5, 0xcd, 0xb6, 0x60, 0x95, 0xf9, 0x0f, 0x24, 0xd5, 0x1d, 0xb7, 0xa5, 0x9a, + 0x50, 0x93, 0xcb, 0x33, 0x09, 0xac, 0xca, 0x47, 0x33, 0x09, 0x40, 0xee, 0x31, 0xb5, 0x5f, 0x71, + 0x4c, 0x3d, 0xf7, 0x98, 0xbc, 0x89, 0xb8, 0xa8, 0x1a, 0xcc, 0x26, 0xe5, 0xa4, 0x0a, 0x94, 0x93, + 0x7a, 0xfa, 0x29, 0x52, 0x6f, 0x66, 0x6a, 0xea, 0xa5, 0xa3, 0xc5, 0xfc, 0x07, 0xac, 0xa5, 0xf0, + 0xf8, 0x04, 0x70, 0x1b, 0x50, 0x97, 0xca, 0x2c, 0xfc, 0x06, 0xd3, 0xf8, 0xc4, 0xd1, 0x88, 0x73, + 0x29, 0xc6, 0x22, 0xcd, 0x97, 0x0f, 0x52, 0x1b, 0x56, 0x36, 0x9d, 0xde, 0xa6, 0xeb, 0xca, 0x54, + 0x3c, 0xcd, 0xdb, 0x37, 0x48, 0x5c, 0x40, 0xfc, 0x46, 0x3f, 0xe3, 0x17, 0xad, 0xaa, 0x92, 0xe7, + 0xaa, 0x41, 0x29, 0xcc, 0xef, 0x58, 0x59, 0xbc, 0x9e, 0xa2, 0xed, 0xa9, 0xd0, 0xf6, 0x04, 0xb3, + 0x50, 0x5b, 0xf0, 0x29, 0xaf, 0xf2, 0x1f, 0x38, 0xe4, 0x09, 0x5d, 0xd2, 0xb5, 0x6a, 0xb2, 0x52, + 0x2d, 0xc4, 0x95, 0xc8, 0xfc, 0xaf, 0x0e, 0xe7, 0x12, 0xbd, 0x5e, 0x87, 0xef, 0x8e, 0x5b, 0x58, + 0x2f, 0x0a, 0x10, 0x79, 0xa0, 0x68, 0xcd, 0x63, 0x8b, 0x62, 0x3b, 0xf0, 0x49, 0x54, 0xd6, 0xc3, + 0x15, 0xfa, 0x23, 0xac, 0xf1, 0x92, 0xd0, 0x61, 0x3e, 0xb5, 0xbb, 0xe1, 0x24, 0xf5, 0x60, 0xc4, + 0x70, 0x58, 0x8e, 0x8a, 0x56, 0x3e, 0x93, 0xa7, 0xac, 0x38, 0x9d, 0x1c, 0x2e, 0x2d, 0x7e, 0xb6, + 0xa2, 0xa8, 0xc0, 0x19, 0xba, 0xe8, 0x45, 0x15, 0xda, 0x2b, 0x3e, 0x94, 0x8a, 0x6a, 0xc4, 0x7b, + 0xd1, 0x34, 0x23, 0xbf, 0x73, 0x9d, 0x9b, 0xd4, 0xb9, 0xd6, 0xa0, 0x9a, 0x05, 0x23, 0xc4, 0xb0, + 0xf9, 0xb3, 0x06, 0xf0, 0x88, 0x52, 0x9f, 0x6e, 0x89, 0x96, 0x60, 0x09, 0x60, 0x8f, 0xe0, 0xb7, + 0x03, 0xec, 0x30, 0xec, 0x1a, 0x05, 0x64, 0xc8, 0x21, 0x4a, 0x86, 0xae, 0xa1, 0xa1, 0x2a, 0xac, + 0x8e, 0x29, 0x3c, 0x71, 0x31, 0x71, 0x3d, 0xd2, 0x35, 0xf4, 0x58, 0x76, 0x8b, 0xf7, 0x0e, 0xd8, + 0x35, 0x66, 0x10, 0x82, 0x25, 0x41, 0xd9, 0xf1, 0xd9, 0xa3, 0xb7, 0x5e, 0xc0, 0x02, 0xa3, 0x88, + 0xd6, 0xe4, 0x6c, 0x29, 0x5c, 0xb1, 0xb0, 0xed, 0x1c, 0x62, 0xd7, 0x98, 0xe5, 0xa2, 0x89, 0xbc, + 0x72, 0x8d, 0x39, 0xb4, 0x08, 0xe5, 0xc7, 0x3e, 0xdd, 0xf7, 0x5c, 0x17, 0x13, 0x63, 0x1e, 0xad, + 0x82, 0xb1, 0x19, 0x86, 0x44, 0x3b, 0xd8, 0xe6, 0x83, 0x2f, 0xe9, 0x1a, 0x25, 0x74, 0x06, 0x2a, + 0x9b, 0x4e, 0x6f, 0xc7, 0x27, 0x8f, 0xfa, 0x03, 0x36, 0x32, 0xca, 0xb1, 0x81, 0x1d, 0x9f, 0xc5, + 0x4d, 0xa3, 0x01, 0xc8, 0x80, 0x8a, 0x38, 0xe7, 0xf3, 0x83, 0x83, 0x00, 0x33, 0xe3, 0x2b, 0xbd, + 0xf9, 0x7f, 0x4d, 0x7e, 0x41, 0x08, 0x9f, 0x0b, 0x74, 0x36, 0x31, 0xfa, 0x47, 0xa7, 0x28, 0xa0, + 0x86, 0x6c, 0x43, 0x65, 0x73, 0x1b, 0x9e, 0x37, 0x3a, 0xbe, 0xa1, 0xa5, 0xf8, 0x11, 0xa3, 0xc3, + 0x6c, 0xca, 0xf7, 0xeb, 0x29, 0xbd, 0xd1, 0xf1, 0x66, 0x62, 0x24, 0x43, 0xba, 0x82, 0x51, 0xf3, + 0xa9, 0xfc, 0x34, 0xa3, 0x8c, 0xfb, 0xe8, 0x82, 0x1c, 0x12, 0x15, 0xda, 0x1e, 0x39, 0x22, 0xfe, + 0x31, 0x31, 0x0a, 0xe8, 0x3c, 0xac, 0xa5, 0x99, 0xcf, 0x8f, 0x09, 0xa6, 0x86, 0xd6, 0x3c, 0x86, + 0x52, 0xd4, 0x60, 0xa1, 0x0a, 0xcc, 0xbf, 0xa0, 0x18, 0x6f, 0xee, 0xb6, 0x8d, 0x02, 0x5f, 0x3c, + 0xf6, 0x7a, 0x62, 0xa1, 0x71, 0xf8, 0xb7, 0xc6, 0x2f, 0x2a, 0xa7, 0x89, 0xfb, 0xdc, 0xe2, 0x31, + 0x42, 0x82, 0x61, 0xc0, 0x29, 0x33, 0x68, 0x19, 0x16, 0x77, 0xec, 0xbe, 0x47, 0xba, 0x5c, 0x23, + 0x27, 0x15, 0xf9, 0x21, 0x76, 0xed, 0x51, 0x1f, 0x13, 0xb6, 0x4b, 0x7d, 0x07, 0x8b, 0x5b, 0xe1, + 0x9c, 0xd9, 0xe6, 0xdd, 0x71, 0x7b, 0xa1, 0xcc, 0x18, 0xa8, 0x04, 0x45, 0xee, 0x43, 0xe8, 0x80, + 0x2c, 0xed, 0x86, 0xc6, 0x17, 0xf2, 0xfe, 0x0d, 0xbd, 0x79, 0x1f, 0xce, 0x4d, 0x78, 0xd3, 0xd1, + 0x1c, 0xe8, 0xcf, 0x8f, 0x8c, 0x02, 0x77, 0xc5, 0xc2, 0x7d, 0xff, 0x0d, 0xde, 0xa5, 0x78, 0x60, + 0x53, 0x6c, 0x68, 0x08, 0x60, 0x2e, 0x24, 0x19, 0x7a, 0xeb, 0x07, 0x80, 0x8a, 0x72, 0x20, 0xf4, + 0x14, 0xca, 0xf1, 0x17, 0x0d, 0x94, 0xf3, 0x61, 0x45, 0xf9, 0x08, 0x56, 0x6b, 0x4c, 0x62, 0xcb, + 0xb2, 0xf3, 0x3a, 0xfa, 0x70, 0x36, 0x1e, 0x73, 0xd1, 0x95, 0x49, 0xb3, 0x90, 0x3a, 0xcd, 0xd7, + 0x7e, 0x7b, 0x82, 0x94, 0x34, 0x70, 0x94, 0x08, 0x8c, 0x78, 0x8e, 0x46, 0x1b, 0x53, 0xb7, 0x2b, + 0x63, 0x7a, 0xed, 0xfa, 0x29, 0x24, 0xa5, 0xb1, 0xfd, 0xe8, 0x5b, 0x8f, 0x32, 0xf3, 0xa1, 0x29, + 0x8e, 0x2a, 0x53, 0x6f, 0xed, 0xea, 0x49, 0x62, 0xd2, 0x06, 0x96, 0x19, 0x90, 0x18, 0xe4, 0x50, + 0xce, 0xee, 0xbc, 0x01, 0xb1, 0x76, 0xed, 0x44, 0xb9, 0x14, 0x6e, 0xa9, 0xf1, 0x2d, 0x0f, 0xb7, + 0xfc, 0xa1, 0x31, 0x0f, 0xb7, 0x09, 0xb3, 0x20, 0x37, 0x96, 0x37, 0xcd, 0xa5, 0x8c, 0x4d, 0x19, + 0x17, 0x53, 0xc6, 0xa6, 0x8e, 0x86, 0xbb, 0x50, 0x51, 0x12, 0x02, 0x5d, 0x9a, 0xdc, 0xfe, 0x86, + 0xaa, 0xd7, 0x27, 0x0b, 0x8c, 0x35, 0x2a, 0x85, 0x1d, 0xe5, 0xcc, 0xf2, 0x89, 0x7e, 0x2f, 0xa5, + 0x31, 0xaf, 0xbb, 0x7c, 0x19, 0x7f, 0x5e, 0x91, 0x3a, 0x2f, 0xe7, 0x7d, 0x9a, 0x49, 0x6a, 0x35, + 0xa7, 0x89, 0x48, 0xbd, 0x24, 0xee, 0xb8, 0x92, 0x4d, 0x10, 0xba, 0x9e, 0xb7, 0x39, 0xb7, 0x91, + 0xaa, 0x35, 0x4f, 0x23, 0x2a, 0xed, 0x75, 0x60, 0x41, 0x6d, 0x84, 0xd0, 0x7a, 0x6a, 0x6f, 0xa6, + 0xdd, 0xaa, 0x5d, 0x9e, 0x22, 0xa1, 0x82, 0xa3, 0xf4, 0x30, 0x19, 0x70, 0xb2, 0xbd, 0x52, 0x06, + 0x9c, 0xbc, 0x16, 0xe8, 0x35, 0x7f, 0x13, 0x93, 0x4f, 0x7b, 0xaa, 0x16, 0x4d, 0x68, 0x83, 0x52, + 0xb5, 0x68, 0x52, 0x7f, 0xf0, 0xe0, 0x4f, 0x3f, 0x7e, 0x68, 0x68, 0xef, 0x3e, 0x34, 0xb4, 0xf7, + 0x1f, 0x1a, 0xda, 0xff, 0x3e, 0x36, 0x0a, 0xef, 0x3e, 0x36, 0x0a, 0x3f, 0x7d, 0x6c, 0x14, 0xfe, + 0x55, 0x9f, 0xf6, 0x4f, 0x88, 0xfd, 0x39, 0xf1, 0xeb, 0xf6, 0x2f, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x44, 0xc8, 0x68, 0xc2, 0xab, 0x18, 0x00, 0x00, } func (m *SpaceSignRequest) Marshal() (dAtA []byte, err error) { @@ -2237,6 +2572,39 @@ func (m *SpaceSignRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *SpaceLimits) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SpaceLimits) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SpaceLimits) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.WriteMembers != 0 { + i = encodeVarintCoordinator(dAtA, i, uint64(m.WriteMembers)) + i-- + dAtA[i] = 0x10 + } + if m.ReadMembers != 0 { + i = encodeVarintCoordinator(dAtA, i, uint64(m.ReadMembers)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func (m *SpaceStatusPayload) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2257,6 +2625,28 @@ func (m *SpaceStatusPayload) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.IsShared { + i-- + if m.IsShared { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.Limits != nil { + { + size, err := m.Limits.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCoordinator(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } if m.Permissions != 0 { i = encodeVarintCoordinator(dAtA, i, uint64(m.Permissions)) i-- @@ -2403,78 +2793,6 @@ func (m *SpaceReceipt) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *FileLimitCheckRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FileLimitCheckRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *FileLimitCheckRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.SpaceId) > 0 { - i -= len(m.SpaceId) - copy(dAtA[i:], m.SpaceId) - i = encodeVarintCoordinator(dAtA, i, uint64(len(m.SpaceId))) - i-- - dAtA[i] = 0x12 - } - if len(m.AccountIdentity) > 0 { - i -= len(m.AccountIdentity) - copy(dAtA[i:], m.AccountIdentity) - i = encodeVarintCoordinator(dAtA, i, uint64(len(m.AccountIdentity))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *FileLimitCheckResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FileLimitCheckResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *FileLimitCheckResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.StorageKey) > 0 { - i -= len(m.StorageKey) - copy(dAtA[i:], m.StorageKey) - i = encodeVarintCoordinator(dAtA, i, uint64(len(m.StorageKey))) - i-- - dAtA[i] = 0x12 - } - if m.Limit != 0 { - i = encodeVarintCoordinator(dAtA, i, uint64(m.Limit)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - func (m *SpaceStatusCheckRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2592,6 +2910,18 @@ func (m *SpaceStatusCheckManyResponse) MarshalToSizedBuffer(dAtA []byte) (int, e _ = i var l int _ = l + if m.AccountLimits != nil { + { + size, err := m.AccountLimits.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCoordinator(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } if len(m.Payloads) > 0 { for iNdEx := len(m.Payloads) - 1; iNdEx >= 0; iNdEx-- { { @@ -2609,6 +2939,34 @@ func (m *SpaceStatusCheckManyResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } +func (m *AccountLimits) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AccountLimits) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccountLimits) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SharedSpacesLimit != 0 { + i = encodeVarintCoordinator(dAtA, i, uint64(m.SharedSpacesLimit)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func (m *SpaceStatusChangeRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2693,6 +3051,119 @@ func (m *SpaceStatusChangeResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } +func (m *SpaceMakeShareableRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SpaceMakeShareableRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SpaceMakeShareableRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SpaceId) > 0 { + i -= len(m.SpaceId) + copy(dAtA[i:], m.SpaceId) + i = encodeVarintCoordinator(dAtA, i, uint64(len(m.SpaceId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SpaceMakeShareableResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SpaceMakeShareableResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SpaceMakeShareableResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *SpaceMakeUnshareableRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SpaceMakeUnshareableRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SpaceMakeUnshareableRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AclHead) > 0 { + i -= len(m.AclHead) + copy(dAtA[i:], m.AclHead) + i = encodeVarintCoordinator(dAtA, i, uint64(len(m.AclHead))) + i-- + dAtA[i] = 0x12 + } + if len(m.SpaceId) > 0 { + i -= len(m.SpaceId) + copy(dAtA[i:], m.SpaceId) + i = encodeVarintCoordinator(dAtA, i, uint64(len(m.SpaceId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SpaceMakeUnshareableResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SpaceMakeUnshareableResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SpaceMakeUnshareableResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func (m *NetworkConfigurationRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2800,20 +3271,20 @@ func (m *Node) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if len(m.Types) > 0 { - dAtA5 := make([]byte, len(m.Types)*10) - var j4 int + dAtA7 := make([]byte, len(m.Types)*10) + var j6 int for _, num := range m.Types { for num >= 1<<7 { - dAtA5[j4] = uint8(uint64(num)&0x7f | 0x80) + dAtA7[j6] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j4++ + j6++ } - dAtA5[j4] = uint8(num) - j4++ + dAtA7[j6] = uint8(num) + j6++ } - i -= j4 - copy(dAtA[i:], dAtA5[:j4]) - i = encodeVarintCoordinator(dAtA, i, uint64(j4)) + i -= j6 + copy(dAtA[i:], dAtA7[:j6]) + i = encodeVarintCoordinator(dAtA, i, uint64(j6)) i-- dAtA[i] = 0x1a } @@ -3445,6 +3916,86 @@ func (m *AclGetRecordsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *AccountLimitsSetRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AccountLimitsSetRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccountLimitsSetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SharedSpacesLimit != 0 { + i = encodeVarintCoordinator(dAtA, i, uint64(m.SharedSpacesLimit)) + i-- + dAtA[i] = 0x30 + } + if m.SpaceMembersWrite != 0 { + i = encodeVarintCoordinator(dAtA, i, uint64(m.SpaceMembersWrite)) + i-- + dAtA[i] = 0x28 + } + if m.SpaceMembersRead != 0 { + i = encodeVarintCoordinator(dAtA, i, uint64(m.SpaceMembersRead)) + i-- + dAtA[i] = 0x20 + } + if m.FileStorageLimitBytes != 0 { + i = encodeVarintCoordinator(dAtA, i, uint64(m.FileStorageLimitBytes)) + i-- + dAtA[i] = 0x18 + } + if len(m.Reason) > 0 { + i -= len(m.Reason) + copy(dAtA[i:], m.Reason) + i = encodeVarintCoordinator(dAtA, i, uint64(len(m.Reason))) + i-- + dAtA[i] = 0x12 + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintCoordinator(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *AccountLimitsSetResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AccountLimitsSetResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccountLimitsSetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintCoordinator(dAtA []byte, offset int, v uint64) int { offset -= sovCoordinator(v) base := offset @@ -3484,6 +4035,21 @@ func (m *SpaceSignRequest) Size() (n int) { return n } +func (m *SpaceLimits) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ReadMembers != 0 { + n += 1 + sovCoordinator(uint64(m.ReadMembers)) + } + if m.WriteMembers != 0 { + n += 1 + sovCoordinator(uint64(m.WriteMembers)) + } + return n +} + func (m *SpaceStatusPayload) Size() (n int) { if m == nil { return 0 @@ -3499,6 +4065,13 @@ func (m *SpaceStatusPayload) Size() (n int) { if m.Permissions != 0 { n += 1 + sovCoordinator(uint64(m.Permissions)) } + if m.Limits != nil { + l = m.Limits.Size() + n += 1 + l + sovCoordinator(uint64(l)) + } + if m.IsShared { + n += 2 + } return n } @@ -3560,39 +4133,6 @@ func (m *SpaceReceipt) Size() (n int) { return n } -func (m *FileLimitCheckRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.AccountIdentity) - if l > 0 { - n += 1 + l + sovCoordinator(uint64(l)) - } - l = len(m.SpaceId) - if l > 0 { - n += 1 + l + sovCoordinator(uint64(l)) - } - return n -} - -func (m *FileLimitCheckResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Limit != 0 { - n += 1 + sovCoordinator(uint64(m.Limit)) - } - l = len(m.StorageKey) - if l > 0 { - n += 1 + l + sovCoordinator(uint64(l)) - } - return n -} - func (m *SpaceStatusCheckRequest) Size() (n int) { if m == nil { return 0 @@ -3646,6 +4186,22 @@ func (m *SpaceStatusCheckManyResponse) Size() (n int) { n += 1 + l + sovCoordinator(uint64(l)) } } + if m.AccountLimits != nil { + l = m.AccountLimits.Size() + n += 1 + l + sovCoordinator(uint64(l)) + } + return n +} + +func (m *AccountLimits) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SharedSpacesLimit != 0 { + n += 1 + sovCoordinator(uint64(m.SharedSpacesLimit)) + } return n } @@ -3686,6 +4242,54 @@ func (m *SpaceStatusChangeResponse) Size() (n int) { return n } +func (m *SpaceMakeShareableRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SpaceId) + if l > 0 { + n += 1 + l + sovCoordinator(uint64(l)) + } + return n +} + +func (m *SpaceMakeShareableResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *SpaceMakeUnshareableRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SpaceId) + if l > 0 { + n += 1 + l + sovCoordinator(uint64(l)) + } + l = len(m.AclHead) + if l > 0 { + n += 1 + l + sovCoordinator(uint64(l)) + } + return n +} + +func (m *SpaceMakeUnshareableResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func (m *NetworkConfigurationRequest) Size() (n int) { if m == nil { return 0 @@ -4030,6 +4634,44 @@ func (m *AclGetRecordsResponse) Size() (n int) { return n } +func (m *AccountLimitsSetRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovCoordinator(uint64(l)) + } + l = len(m.Reason) + if l > 0 { + n += 1 + l + sovCoordinator(uint64(l)) + } + if m.FileStorageLimitBytes != 0 { + n += 1 + sovCoordinator(uint64(m.FileStorageLimitBytes)) + } + if m.SpaceMembersRead != 0 { + n += 1 + sovCoordinator(uint64(m.SpaceMembersRead)) + } + if m.SpaceMembersWrite != 0 { + n += 1 + sovCoordinator(uint64(m.SpaceMembersWrite)) + } + if m.SharedSpacesLimit != 0 { + n += 1 + sovCoordinator(uint64(m.SharedSpacesLimit)) + } + return n +} + +func (m *AccountLimitsSetResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovCoordinator(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -4240,6 +4882,94 @@ func (m *SpaceSignRequest) Unmarshal(dAtA []byte) error { } return nil } +func (m *SpaceLimits) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SpaceLimits: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SpaceLimits: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ReadMembers", wireType) + } + m.ReadMembers = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ReadMembers |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field WriteMembers", wireType) + } + m.WriteMembers = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.WriteMembers |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipCoordinator(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCoordinator + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *SpaceStatusPayload) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4326,6 +5056,62 @@ func (m *SpaceStatusPayload) Unmarshal(dAtA []byte) error { break } } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Limits", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCoordinator + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCoordinator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Limits == nil { + m.Limits = &SpaceLimits{} + } + if err := m.Limits.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsShared", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsShared = bool(v != 0) default: iNdEx = preIndex skippy, err := skipCoordinator(dAtA[iNdEx:]) @@ -4750,223 +5536,6 @@ func (m *SpaceReceipt) Unmarshal(dAtA []byte) error { } return nil } -func (m *FileLimitCheckRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoordinator - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FileLimitCheckRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FileLimitCheckRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AccountIdentity", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoordinator - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthCoordinator - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthCoordinator - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AccountIdentity = append(m.AccountIdentity[:0], dAtA[iNdEx:postIndex]...) - if m.AccountIdentity == nil { - m.AccountIdentity = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SpaceId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoordinator - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCoordinator - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCoordinator - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SpaceId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCoordinator(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCoordinator - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *FileLimitCheckResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoordinator - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FileLimitCheckResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FileLimitCheckResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) - } - m.Limit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoordinator - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Limit |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StorageKey", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoordinator - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCoordinator - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCoordinator - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StorageKey = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCoordinator(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCoordinator - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *SpaceStatusCheckRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5280,6 +5849,111 @@ func (m *SpaceStatusCheckManyResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccountLimits", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCoordinator + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCoordinator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AccountLimits == nil { + m.AccountLimits = &AccountLimits{} + } + if err := m.AccountLimits.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCoordinator(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCoordinator + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AccountLimits) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AccountLimits: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccountLimits: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SharedSpacesLimit", wireType) + } + m.SharedSpacesLimit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SharedSpacesLimit |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipCoordinator(dAtA[iNdEx:]) @@ -5554,6 +6228,302 @@ func (m *SpaceStatusChangeResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *SpaceMakeShareableRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SpaceMakeShareableRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SpaceMakeShareableRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpaceId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCoordinator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCoordinator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SpaceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCoordinator(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCoordinator + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SpaceMakeShareableResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SpaceMakeShareableResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SpaceMakeShareableResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipCoordinator(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCoordinator + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SpaceMakeUnshareableRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SpaceMakeUnshareableRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SpaceMakeUnshareableRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpaceId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCoordinator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCoordinator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SpaceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AclHead", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCoordinator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCoordinator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AclHead = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCoordinator(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCoordinator + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SpaceMakeUnshareableResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SpaceMakeUnshareableResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SpaceMakeUnshareableResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipCoordinator(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCoordinator + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *NetworkConfigurationRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -7808,6 +8778,246 @@ func (m *AclGetRecordsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *AccountLimitsSetRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AccountLimitsSetRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccountLimitsSetRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCoordinator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCoordinator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCoordinator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCoordinator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Reason = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FileStorageLimitBytes", wireType) + } + m.FileStorageLimitBytes = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FileStorageLimitBytes |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SpaceMembersRead", wireType) + } + m.SpaceMembersRead = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SpaceMembersRead |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SpaceMembersWrite", wireType) + } + m.SpaceMembersWrite = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SpaceMembersWrite |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SharedSpacesLimit", wireType) + } + m.SharedSpacesLimit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SharedSpacesLimit |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipCoordinator(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCoordinator + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AccountLimitsSetResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AccountLimitsSetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccountLimitsSetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipCoordinator(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCoordinator + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipCoordinator(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/coordinator/coordinatorproto/coordinator_drpc.pb.go b/coordinator/coordinatorproto/coordinator_drpc.pb.go index 2f92679f..cb798a19 100644 --- a/coordinator/coordinatorproto/coordinator_drpc.pb.go +++ b/coordinator/coordinatorproto/coordinator_drpc.pb.go @@ -41,10 +41,11 @@ type DRPCCoordinatorClient interface { DRPCConn() drpc.Conn SpaceSign(ctx context.Context, in *SpaceSignRequest) (*SpaceSignResponse, error) - FileLimitCheck(ctx context.Context, in *FileLimitCheckRequest) (*FileLimitCheckResponse, error) SpaceStatusCheck(ctx context.Context, in *SpaceStatusCheckRequest) (*SpaceStatusCheckResponse, error) SpaceStatusCheckMany(ctx context.Context, in *SpaceStatusCheckManyRequest) (*SpaceStatusCheckManyResponse, error) SpaceStatusChange(ctx context.Context, in *SpaceStatusChangeRequest) (*SpaceStatusChangeResponse, error) + SpaceMakeShareable(ctx context.Context, in *SpaceMakeShareableRequest) (*SpaceMakeShareableResponse, error) + SpaceMakeUnshareable(ctx context.Context, in *SpaceMakeUnshareableRequest) (*SpaceMakeUnshareableResponse, error) NetworkConfiguration(ctx context.Context, in *NetworkConfigurationRequest) (*NetworkConfigurationResponse, error) DeletionLog(ctx context.Context, in *DeletionLogRequest) (*DeletionLogResponse, error) SpaceDelete(ctx context.Context, in *SpaceDeleteRequest) (*SpaceDeleteResponse, error) @@ -52,6 +53,7 @@ type DRPCCoordinatorClient interface { AccountRevertDeletion(ctx context.Context, in *AccountRevertDeletionRequest) (*AccountRevertDeletionResponse, error) AclAddRecord(ctx context.Context, in *AclAddRecordRequest) (*AclAddRecordResponse, error) AclGetRecords(ctx context.Context, in *AclGetRecordsRequest) (*AclGetRecordsResponse, error) + AccountLimitsSet(ctx context.Context, in *AccountLimitsSetRequest) (*AccountLimitsSetResponse, error) } type drpcCoordinatorClient struct { @@ -73,15 +75,6 @@ func (c *drpcCoordinatorClient) SpaceSign(ctx context.Context, in *SpaceSignRequ return out, nil } -func (c *drpcCoordinatorClient) FileLimitCheck(ctx context.Context, in *FileLimitCheckRequest) (*FileLimitCheckResponse, error) { - out := new(FileLimitCheckResponse) - err := c.cc.Invoke(ctx, "/coordinator.Coordinator/FileLimitCheck", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, in, out) - if err != nil { - return nil, err - } - return out, nil -} - func (c *drpcCoordinatorClient) SpaceStatusCheck(ctx context.Context, in *SpaceStatusCheckRequest) (*SpaceStatusCheckResponse, error) { out := new(SpaceStatusCheckResponse) err := c.cc.Invoke(ctx, "/coordinator.Coordinator/SpaceStatusCheck", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, in, out) @@ -109,6 +102,24 @@ func (c *drpcCoordinatorClient) SpaceStatusChange(ctx context.Context, in *Space return out, nil } +func (c *drpcCoordinatorClient) SpaceMakeShareable(ctx context.Context, in *SpaceMakeShareableRequest) (*SpaceMakeShareableResponse, error) { + out := new(SpaceMakeShareableResponse) + err := c.cc.Invoke(ctx, "/coordinator.Coordinator/SpaceMakeShareable", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *drpcCoordinatorClient) SpaceMakeUnshareable(ctx context.Context, in *SpaceMakeUnshareableRequest) (*SpaceMakeUnshareableResponse, error) { + out := new(SpaceMakeUnshareableResponse) + err := c.cc.Invoke(ctx, "/coordinator.Coordinator/SpaceMakeUnshareable", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + func (c *drpcCoordinatorClient) NetworkConfiguration(ctx context.Context, in *NetworkConfigurationRequest) (*NetworkConfigurationResponse, error) { out := new(NetworkConfigurationResponse) err := c.cc.Invoke(ctx, "/coordinator.Coordinator/NetworkConfiguration", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, in, out) @@ -172,12 +183,22 @@ func (c *drpcCoordinatorClient) AclGetRecords(ctx context.Context, in *AclGetRec return out, nil } +func (c *drpcCoordinatorClient) AccountLimitsSet(ctx context.Context, in *AccountLimitsSetRequest) (*AccountLimitsSetResponse, error) { + out := new(AccountLimitsSetResponse) + err := c.cc.Invoke(ctx, "/coordinator.Coordinator/AccountLimitsSet", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + type DRPCCoordinatorServer interface { SpaceSign(context.Context, *SpaceSignRequest) (*SpaceSignResponse, error) - FileLimitCheck(context.Context, *FileLimitCheckRequest) (*FileLimitCheckResponse, error) SpaceStatusCheck(context.Context, *SpaceStatusCheckRequest) (*SpaceStatusCheckResponse, error) SpaceStatusCheckMany(context.Context, *SpaceStatusCheckManyRequest) (*SpaceStatusCheckManyResponse, error) SpaceStatusChange(context.Context, *SpaceStatusChangeRequest) (*SpaceStatusChangeResponse, error) + SpaceMakeShareable(context.Context, *SpaceMakeShareableRequest) (*SpaceMakeShareableResponse, error) + SpaceMakeUnshareable(context.Context, *SpaceMakeUnshareableRequest) (*SpaceMakeUnshareableResponse, error) NetworkConfiguration(context.Context, *NetworkConfigurationRequest) (*NetworkConfigurationResponse, error) DeletionLog(context.Context, *DeletionLogRequest) (*DeletionLogResponse, error) SpaceDelete(context.Context, *SpaceDeleteRequest) (*SpaceDeleteResponse, error) @@ -185,6 +206,7 @@ type DRPCCoordinatorServer interface { AccountRevertDeletion(context.Context, *AccountRevertDeletionRequest) (*AccountRevertDeletionResponse, error) AclAddRecord(context.Context, *AclAddRecordRequest) (*AclAddRecordResponse, error) AclGetRecords(context.Context, *AclGetRecordsRequest) (*AclGetRecordsResponse, error) + AccountLimitsSet(context.Context, *AccountLimitsSetRequest) (*AccountLimitsSetResponse, error) } type DRPCCoordinatorUnimplementedServer struct{} @@ -193,10 +215,6 @@ func (s *DRPCCoordinatorUnimplementedServer) SpaceSign(context.Context, *SpaceSi return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } -func (s *DRPCCoordinatorUnimplementedServer) FileLimitCheck(context.Context, *FileLimitCheckRequest) (*FileLimitCheckResponse, error) { - return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) -} - func (s *DRPCCoordinatorUnimplementedServer) SpaceStatusCheck(context.Context, *SpaceStatusCheckRequest) (*SpaceStatusCheckResponse, error) { return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } @@ -209,6 +227,14 @@ func (s *DRPCCoordinatorUnimplementedServer) SpaceStatusChange(context.Context, return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } +func (s *DRPCCoordinatorUnimplementedServer) SpaceMakeShareable(context.Context, *SpaceMakeShareableRequest) (*SpaceMakeShareableResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + +func (s *DRPCCoordinatorUnimplementedServer) SpaceMakeUnshareable(context.Context, *SpaceMakeUnshareableRequest) (*SpaceMakeUnshareableResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + func (s *DRPCCoordinatorUnimplementedServer) NetworkConfiguration(context.Context, *NetworkConfigurationRequest) (*NetworkConfigurationResponse, error) { return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } @@ -237,9 +263,13 @@ func (s *DRPCCoordinatorUnimplementedServer) AclGetRecords(context.Context, *Acl return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } +func (s *DRPCCoordinatorUnimplementedServer) AccountLimitsSet(context.Context, *AccountLimitsSetRequest) (*AccountLimitsSetResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + type DRPCCoordinatorDescription struct{} -func (DRPCCoordinatorDescription) NumMethods() int { return 12 } +func (DRPCCoordinatorDescription) NumMethods() int { return 14 } func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { switch n { @@ -253,15 +283,6 @@ func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Rec ) }, DRPCCoordinatorServer.SpaceSign, true case 1: - return "/coordinator.Coordinator/FileLimitCheck", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCCoordinatorServer). - FileLimitCheck( - ctx, - in1.(*FileLimitCheckRequest), - ) - }, DRPCCoordinatorServer.FileLimitCheck, true - case 2: return "/coordinator.Coordinator/SpaceStatusCheck", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCCoordinatorServer). @@ -270,7 +291,7 @@ func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Rec in1.(*SpaceStatusCheckRequest), ) }, DRPCCoordinatorServer.SpaceStatusCheck, true - case 3: + case 2: return "/coordinator.Coordinator/SpaceStatusCheckMany", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCCoordinatorServer). @@ -279,7 +300,7 @@ func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Rec in1.(*SpaceStatusCheckManyRequest), ) }, DRPCCoordinatorServer.SpaceStatusCheckMany, true - case 4: + case 3: return "/coordinator.Coordinator/SpaceStatusChange", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCCoordinatorServer). @@ -288,7 +309,25 @@ func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Rec in1.(*SpaceStatusChangeRequest), ) }, DRPCCoordinatorServer.SpaceStatusChange, true + case 4: + return "/coordinator.Coordinator/SpaceMakeShareable", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCCoordinatorServer). + SpaceMakeShareable( + ctx, + in1.(*SpaceMakeShareableRequest), + ) + }, DRPCCoordinatorServer.SpaceMakeShareable, true case 5: + return "/coordinator.Coordinator/SpaceMakeUnshareable", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCCoordinatorServer). + SpaceMakeUnshareable( + ctx, + in1.(*SpaceMakeUnshareableRequest), + ) + }, DRPCCoordinatorServer.SpaceMakeUnshareable, true + case 6: return "/coordinator.Coordinator/NetworkConfiguration", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCCoordinatorServer). @@ -297,7 +336,7 @@ func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Rec in1.(*NetworkConfigurationRequest), ) }, DRPCCoordinatorServer.NetworkConfiguration, true - case 6: + case 7: return "/coordinator.Coordinator/DeletionLog", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCCoordinatorServer). @@ -306,7 +345,7 @@ func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Rec in1.(*DeletionLogRequest), ) }, DRPCCoordinatorServer.DeletionLog, true - case 7: + case 8: return "/coordinator.Coordinator/SpaceDelete", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCCoordinatorServer). @@ -315,7 +354,7 @@ func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Rec in1.(*SpaceDeleteRequest), ) }, DRPCCoordinatorServer.SpaceDelete, true - case 8: + case 9: return "/coordinator.Coordinator/AccountDelete", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCCoordinatorServer). @@ -324,7 +363,7 @@ func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Rec in1.(*AccountDeleteRequest), ) }, DRPCCoordinatorServer.AccountDelete, true - case 9: + case 10: return "/coordinator.Coordinator/AccountRevertDeletion", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCCoordinatorServer). @@ -333,7 +372,7 @@ func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Rec in1.(*AccountRevertDeletionRequest), ) }, DRPCCoordinatorServer.AccountRevertDeletion, true - case 10: + case 11: return "/coordinator.Coordinator/AclAddRecord", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCCoordinatorServer). @@ -342,7 +381,7 @@ func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Rec in1.(*AclAddRecordRequest), ) }, DRPCCoordinatorServer.AclAddRecord, true - case 11: + case 12: return "/coordinator.Coordinator/AclGetRecords", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCCoordinatorServer). @@ -351,6 +390,15 @@ func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Rec in1.(*AclGetRecordsRequest), ) }, DRPCCoordinatorServer.AclGetRecords, true + case 13: + return "/coordinator.Coordinator/AccountLimitsSet", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCCoordinatorServer). + AccountLimitsSet( + ctx, + in1.(*AccountLimitsSetRequest), + ) + }, DRPCCoordinatorServer.AccountLimitsSet, true default: return "", nil, nil, nil, false } @@ -376,22 +424,6 @@ func (x *drpcCoordinator_SpaceSignStream) SendAndClose(m *SpaceSignResponse) err return x.CloseSend() } -type DRPCCoordinator_FileLimitCheckStream interface { - drpc.Stream - SendAndClose(*FileLimitCheckResponse) error -} - -type drpcCoordinator_FileLimitCheckStream struct { - drpc.Stream -} - -func (x *drpcCoordinator_FileLimitCheckStream) SendAndClose(m *FileLimitCheckResponse) error { - if err := x.MsgSend(m, drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}); err != nil { - return err - } - return x.CloseSend() -} - type DRPCCoordinator_SpaceStatusCheckStream interface { drpc.Stream SendAndClose(*SpaceStatusCheckResponse) error @@ -440,6 +472,38 @@ func (x *drpcCoordinator_SpaceStatusChangeStream) SendAndClose(m *SpaceStatusCha return x.CloseSend() } +type DRPCCoordinator_SpaceMakeShareableStream interface { + drpc.Stream + SendAndClose(*SpaceMakeShareableResponse) error +} + +type drpcCoordinator_SpaceMakeShareableStream struct { + drpc.Stream +} + +func (x *drpcCoordinator_SpaceMakeShareableStream) SendAndClose(m *SpaceMakeShareableResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}); err != nil { + return err + } + return x.CloseSend() +} + +type DRPCCoordinator_SpaceMakeUnshareableStream interface { + drpc.Stream + SendAndClose(*SpaceMakeUnshareableResponse) error +} + +type drpcCoordinator_SpaceMakeUnshareableStream struct { + drpc.Stream +} + +func (x *drpcCoordinator_SpaceMakeUnshareableStream) SendAndClose(m *SpaceMakeUnshareableResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}); err != nil { + return err + } + return x.CloseSend() +} + type DRPCCoordinator_NetworkConfigurationStream interface { drpc.Stream SendAndClose(*NetworkConfigurationResponse) error @@ -551,3 +615,19 @@ func (x *drpcCoordinator_AclGetRecordsStream) SendAndClose(m *AclGetRecordsRespo } return x.CloseSend() } + +type DRPCCoordinator_AccountLimitsSetStream interface { + drpc.Stream + SendAndClose(*AccountLimitsSetResponse) error +} + +type drpcCoordinator_AccountLimitsSetStream struct { + drpc.Stream +} + +func (x *drpcCoordinator_AccountLimitsSetStream) SendAndClose(m *AccountLimitsSetResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}); err != nil { + return err + } + return x.CloseSend() +} diff --git a/coordinator/coordinatorproto/errors.go b/coordinator/coordinatorproto/errors.go index aaaf1c41..713dd0cc 100644 --- a/coordinator/coordinatorproto/errors.go +++ b/coordinator/coordinatorproto/errors.go @@ -16,4 +16,8 @@ var ( ErrSpaceNotExists = errGroup.Register(errors.New("space not exists"), uint64(ErrorCodes_SpaceNotExists)) ErrSpaceLimitReached = errGroup.Register(errors.New("space limit reached"), uint64(ErrorCodes_SpaceLimitReached)) ErrAccountIsDeleted = errGroup.Register(errors.New("account is deleted"), uint64(ErrorCodes_AccountDeleted)) + ErrForbidden = errGroup.Register(errors.New("forbidden"), uint64(ErrorCodes_Forbidden)) + ErrAclHeadIsMissing = errGroup.Register(errors.New("acl head is missing"), uint64(ErrorCodes_AclHeadIsMissing)) + ErrAclNonEmpty = errGroup.Register(errors.New("acl is not empty"), uint64(ErrorCodes_AclNonEmpty)) + ErrSpaceNotShareable = errGroup.Register(errors.New("space not shareable"), uint64(ErrorCodes_SpaceNotShareable)) ) diff --git a/coordinator/coordinatorproto/protos/coordinator.proto b/coordinator/coordinatorproto/protos/coordinator.proto index ac8d9528..67ce6266 100644 --- a/coordinator/coordinatorproto/protos/coordinator.proto +++ b/coordinator/coordinatorproto/protos/coordinator.proto @@ -7,12 +7,6 @@ service Coordinator { // SpaceSign signs a space creation operation rpc SpaceSign(SpaceSignRequest) returns (SpaceSignResponse); - // FileLimitCheck checks a limit by account and space - // can be used only: - // - if a handshake identity matches a given identity - // - if a requester contains in nodeconf list - rpc FileLimitCheck(FileLimitCheckRequest) returns (FileLimitCheckResponse); - // SpaceStatusCheck checks the status of space and tells if it is deleted or not rpc SpaceStatusCheck(SpaceStatusCheckRequest) returns (SpaceStatusCheckResponse); @@ -22,6 +16,12 @@ service Coordinator { // SpaceStatusChange changes the status of space - Deprecated rpc SpaceStatusChange(SpaceStatusChangeRequest) returns (SpaceStatusChangeResponse); + // SpaceMakeShareable makes space shareable + rpc SpaceMakeShareable(SpaceMakeShareableRequest) returns (SpaceMakeShareableResponse); + + // SpaceMakeUnshareable marks space unshareable + rpc SpaceMakeUnshareable(SpaceMakeUnshareableRequest) returns (SpaceMakeUnshareableResponse); + // NetworkConfiguration retrieves the latest network configuration rpc NetworkConfiguration(NetworkConfigurationRequest) returns (NetworkConfigurationResponse); @@ -41,6 +41,8 @@ service Coordinator { rpc AclAddRecord(AclAddRecordRequest) returns (AclAddRecordResponse); // AclGetRecords gets acl records rpc AclGetRecords(AclGetRecordsRequest) returns (AclGetRecordsResponse); + // AccountLimitsSet sets limits to the account. Can be used only by a network config member + rpc AccountLimitsSet(AccountLimitsSetRequest) returns (AccountLimitsSetResponse); } message SpaceSignRequest { @@ -64,6 +66,10 @@ enum ErrorCodes { SpaceNotExists = 4; SpaceLimitReached = 5; AccountDeleted = 6; + Forbidden = 7; + AclHeadIsMissing = 8; + AclNonEmpty = 9; + SpaceNotShareable = 10; ErrorOffset = 300; } @@ -80,10 +86,17 @@ enum SpacePermissions { SpacePermissionsOwner = 1; } +message SpaceLimits { + uint32 readMembers = 1; + uint32 writeMembers = 2; +} + message SpaceStatusPayload { SpaceStatus status = 1; int64 deletionTimestamp = 2; SpacePermissions permissions = 3; + SpaceLimits limits = 4; + bool isShared = 5; } message SpaceSignResponse { @@ -110,21 +123,6 @@ message SpaceReceipt { uint64 validUntil = 5; } -// FileLimitCheckRequest contains an account identity and spaceId -// control node checks that identity owns a given space -message FileLimitCheckRequest { - bytes accountIdentity = 1; - string spaceId = 2; -} - -// FileLimitCheckResponse returns a current space limit in bytes -message FileLimitCheckResponse { - // Limit in bytes - uint64 limit = 1; - // StorageKey tells a key that filenode should use to save files - string storageKey = 2; -} - // SpaceStatusCheckRequest contains the spaceId of requested space message SpaceStatusCheckRequest { string spaceId = 1; @@ -143,8 +141,15 @@ message SpaceStatusCheckManyRequest { // SpaceStatusCheckManyResponse contains the current statuses of spaces message SpaceStatusCheckManyResponse { repeated SpaceStatusPayload payloads = 1; + AccountLimits accountLimits = 2; } +// AccountLimits describes account level limit +message AccountLimits { + uint32 sharedSpacesLimit = 1; +} + + // SpaceStatusChangeRequest contains the deletionChange if we want to delete space, or it is empty otherwise message SpaceStatusChangeRequest { string spaceId = 1; @@ -158,6 +163,19 @@ message SpaceStatusChangeResponse { SpaceStatusPayload payload = 1; } +message SpaceMakeShareableRequest { + string spaceId = 1; +} + +message SpaceMakeShareableResponse {} + +message SpaceMakeUnshareableRequest { + string spaceId = 1; + string aclHead = 2; +} + +message SpaceMakeUnshareableResponse {} + // NetworkConfigurationRequest contains currenId of the client configuration, it can be empty message NetworkConfigurationRequest { // currenId of the client configuration @@ -335,4 +353,16 @@ message AclGetRecordsRequest { // AclGetRecordsResponse contains list of marshaled consensusproto.RawRecordWithId message AclGetRecordsResponse { repeated bytes records = 1; -} \ No newline at end of file +} + +message AccountLimitsSetRequest { + string identity = 1; + string reason = 2; + uint64 fileStorageLimitBytes = 3; + uint32 spaceMembersRead = 4; + uint32 spaceMembersWrite = 5; + uint32 sharedSpacesLimit = 6; +} + + +message AccountLimitsSetResponse {} diff --git a/go.mod b/go.mod index 42945de5..6008fe2b 100644 --- a/go.mod +++ b/go.mod @@ -1,15 +1,16 @@ module github.com/anyproto/any-sync -go 1.19 +go 1.22 require ( filippo.io/edwards25519 v1.1.0 github.com/anyproto/go-chash v0.1.0 github.com/anyproto/go-slip10 v1.0.0 github.com/anyproto/go-slip21 v1.0.0 + github.com/btcsuite/btcd v0.22.1 + github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/cespare/xxhash v1.1.0 github.com/cheggaaa/mb/v3 v3.0.2 - github.com/ethereum/go-ethereum v1.13.12 github.com/gobwas/glob v0.2.3 github.com/goccy/go-graphviz v0.1.2 github.com/gogo/protobuf v1.3.2 @@ -20,22 +21,22 @@ require ( github.com/ipfs/go-block-format v0.2.0 github.com/ipfs/go-cid v0.4.1 github.com/ipfs/go-ipld-format v0.6.0 - github.com/libp2p/go-libp2p v0.32.2 - github.com/miguelmota/go-ethereum-hdwallet v0.1.2 + github.com/libp2p/go-libp2p v0.33.2 github.com/mr-tron/base58 v1.2.0 github.com/multiformats/go-multibase v0.2.0 github.com/multiformats/go-multihash v0.2.3 - github.com/prometheus/client_golang v1.19.0 - github.com/quic-go/quic-go v0.40.1 - github.com/stretchr/testify v1.8.4 + github.com/prometheus/client_golang v1.19.1 + github.com/quic-go/quic-go v0.44.0 + github.com/stretchr/testify v1.9.0 github.com/tyler-smith/go-bip39 v1.1.0 github.com/zeebo/blake3 v0.2.3 go.uber.org/atomic v1.11.0 go.uber.org/mock v0.4.0 go.uber.org/zap v1.27.0 - golang.org/x/crypto v0.20.0 - golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 - golang.org/x/net v0.21.0 + golang.org/x/crypto v0.23.0 + golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 + golang.org/x/net v0.25.0 + golang.org/x/time v0.5.0 gopkg.in/yaml.v3 v3.0.1 storj.io/drpc v0.0.34 ) @@ -43,28 +44,20 @@ require ( require ( github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/bits-and-blooms/bitset v1.10.0 // indirect - github.com/btcsuite/btcd v0.22.1 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect - github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/consensys/bavard v0.1.13 // indirect - github.com/consensys/gnark-crypto v0.12.1 // indirect github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect - github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect - github.com/ethereum/c-kzg-4844 v0.4.0 // indirect github.com/fogleman/gg v1.3.0 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect - github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/google/pprof v0.0.0-20240402174815-29b9bb013b0f // indirect github.com/hashicorp/golang-lru/v2 v2.0.5 // indirect - github.com/holiman/uint256 v1.2.4 // indirect github.com/ipfs/bbloom v0.0.4 // indirect github.com/ipfs/go-bitfield v1.1.0 // indirect github.com/ipfs/go-datastore v0.6.0 // indirect @@ -76,38 +69,34 @@ require ( github.com/ipld/go-ipld-prime v0.21.0 // indirect github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect github.com/jbenet/goprocess v0.1.4 // indirect - github.com/klauspost/cpuid/v2 v2.2.5 // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/minio/sha256-simd v1.0.1 // indirect - github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect - github.com/multiformats/go-multiaddr v0.12.0 // indirect + github.com/multiformats/go-multiaddr v0.12.3 // indirect github.com/multiformats/go-multicodec v0.9.0 // indirect github.com/multiformats/go-multistream v0.5.0 // indirect github.com/multiformats/go-varint v0.0.7 // indirect - github.com/onsi/ginkgo/v2 v2.15.0 // indirect + github.com/onsi/ginkgo/v2 v2.17.1 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polydawn/refmt v0.89.0 // indirect - github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/client_model v0.6.0 // indirect github.com/prometheus/common v0.48.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect - github.com/quic-go/qtls-go1-20 v0.4.1 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/supranational/blst v0.3.11 // indirect github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f // indirect github.com/zeebo/errs v1.3.0 // indirect go.opentelemetry.io/otel v1.14.0 // indirect go.opentelemetry.io/otel/trace v1.14.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/image v0.14.0 // indirect - golang.org/x/mod v0.15.0 // indirect - golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.17.0 // indirect - golang.org/x/tools v0.17.0 // indirect - google.golang.org/protobuf v1.32.0 // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/tools v0.21.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect lukechampine.com/blake3 v1.2.1 // indirect - rsc.io/tmplfunc v0.0.3 // indirect ) diff --git a/go.sum b/go.sum index 9d732cf7..ce5a3407 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,8 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= -github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= @@ -17,15 +14,12 @@ github.com/anyproto/go-slip21 v1.0.0 h1:CI7lUqTIwmPOEGVAj4jyNLoICvueh++0U2HoAi3m github.com/anyproto/go-slip21 v1.0.0/go.mod h1:gbIJt7HAdr5DuT4f2pFTKCBSUWYsm/fysHBNqgsuxT0= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= +github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88= -github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.1 h1:CnwP9LM/M9xuRrGSCGeMVs9iv09uMqwsVX7EeIpgV2c= github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= -github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= -github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= @@ -43,24 +37,13 @@ github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cheggaaa/mb/v3 v3.0.2 h1:jd1Xx0zzihZlXL6HmnRXVCI1BHuXz/kY+VzX9WbvNDU= github.com/cheggaaa/mb/v3 v3.0.2/go.mod h1:zCt2QeYukhd/g0bIdNqF+b/kKz1hnLFNDkP49qN5kqI= -github.com/cockroachdb/errors v1.8.1 h1:A5+txlVZfOqFBDa4mGz2bUWSp0aHElvHX2bKkdbQu+Y= -github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f h1:o/kfcElHqOiXqcou5a3rIlMc7oJbMQkeLk0VQJ7zgqY= -github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 h1:aPEJyR4rPBvDmeyi+l/FS/VtA00IWvjeFvjen1m1l1A= -github.com/cockroachdb/redact v1.0.8 h1:8QG/764wK+vmEYoOlfobpe12EQcS81ukx/a4hdVMxNw= -github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 h1:IKgmqgMQlVJIZj19CdocBeSfSaiCbEBZGKODaixqtHM= -github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= -github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= -github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= -github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= -github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= github.com/corona10/goimagehash v1.0.2 h1:pUfB0LnsJASMPGEZLj7tGY251vF+qLGqOgEP4rUs6kA= +github.com/corona10/goimagehash v1.0.2/go.mod h1:/l9umBhvcHQXVtQO1V6Gp1yD20STawkhRnnX0D1bvVI= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 h1:HVTnpeuvF6Owjd5mniCL8DEXo7uYXdQEmOP4FJbV5tg= github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3/go.mod h1:p1d6YEZWvFzEh4KLyvBcVSnrfNDDvK2zfK/4x2v/4pE= -github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 h1:d28BXYi+wUpz1KBmiF9bWrjEMacUEREV6MBi2ODnrfQ= -github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBShovmncxvA= -github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0= +github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -68,25 +51,23 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR6AkioZ1ySsx5yxlDQZ8stG2b88gTPxgJU= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= +github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= -github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY= -github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= -github.com/ethereum/go-ethereum v1.13.12 h1:iDr9UM2JWkngBHGovRJEQn4Kor7mT4gt9rUZqB5M29Y= -github.com/ethereum/go-ethereum v1.13.12/go.mod h1:hKL2Qcj1OvStXNSEDbucexqnEt1Wh4Cz329XsjAalZY= -github.com/flynn/noise v1.0.0 h1:DlTHqmzmvcEiKj+4RYo/imoswx/4r6iBlCMfVtrMXpQ= +github.com/flynn/noise v1.1.0 h1:KjPQoQCEFdZDiP03phOvGi11+SVVhBG2wOWAorLsstg= +github.com/flynn/noise v1.1.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8= github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= +github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 h1:BAIP2GihuqhwdILrV+7GJel5lyPV3u1+PgzrWLc0TkE= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= @@ -94,35 +75,35 @@ github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/goccy/go-graphviz v0.1.2 h1:sWSJ6w13BCm/ZOUTHDVrdvbsxqN8yyzaFcHrH/hQ9Yg= github.com/goccy/go-graphviz v0.1.2/go.mod h1:pMYpbAqJT10V8dzV1JN/g/wUlG/0imKPzn3ZsrchGCI= -github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= -github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5 h1:E/LAvt58di64hlYjx7AsNS6C/ysHWYo+2qPCZKTQhRo= -github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= -github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= +github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= +github.com/google/pprof v0.0.0-20240402174815-29b9bb013b0f h1:f00RU+zOX+B3rLAmMMkzHUF2h1z4DeYR9tTCvEq2REY= +github.com/google/pprof v0.0.0-20240402174815-29b9bb013b0f/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c h1:7lF+Vz0LqiRidnzC1Oq86fpX1q/iEv2KJdrCtttYjT4= +github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/hashicorp/golang-lru/v2 v2.0.5 h1:wW7h1TG88eUIJ2i69gaE3uNVtEPIagzhGvHgwfx2Vm4= github.com/hashicorp/golang-lru/v2 v2.0.5/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= -github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= -github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= +github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs= github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0= github.com/ipfs/boxo v0.13.1 h1:nQ5oQzcMZR3oL41REJDcTbrvDvuZh3J9ckc9+ILeRQI= @@ -136,9 +117,13 @@ github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LK github.com/ipfs/go-datastore v0.6.0 h1:JKyz+Gvz1QEZw0LsX1IBn+JFCJQH4SJVFtM4uWU0Myk= github.com/ipfs/go-datastore v0.6.0/go.mod h1:rt5M3nNbSO/8q1t4LNkLyUwRs8HupMeN/8O4Vn9YAT8= github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= +github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= +github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk= github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ= +github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= github.com/ipfs/go-ipfs-pq v0.0.3 h1:YpoHVJB+jzK15mr/xsWC574tyDLkezVrDNeaalQBsTE= +github.com/ipfs/go-ipfs-pq v0.0.3/go.mod h1:btNw5hsHBpRcSSgZtiNm/SLj5gYIZ18AKtv3kERkRb4= github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8= github.com/ipfs/go-ipfs-util v0.0.2/go.mod h1:CbPtkWJzjLdEcezDns2XYaehFVNXG9zrdrtMecczcsQ= github.com/ipfs/go-ipld-format v0.6.0 h1:VEJlA2kQ3LqFSIm5Vu6eIlSxD/Ze90xtc4Meten1F5U= @@ -150,11 +135,13 @@ github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOL github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= github.com/ipfs/go-peertaskqueue v0.8.1 h1:YhxAs1+wxb5jk7RvS0LHdyiILpNmRIRnZVztekOF0pg= +github.com/ipfs/go-peertaskqueue v0.8.1/go.mod h1:Oxxd3eaK279FxeydSPPVGHzbwVeHjatZ2GA8XD+KbPU= github.com/ipld/go-codec-dagpb v1.6.0 h1:9nYazfyu9B1p3NAgfVdpRco3Fs2nFC72DqVsMj6rOcc= github.com/ipld/go-codec-dagpb v1.6.0/go.mod h1:ANzFhfP2uMJxRBr8CE+WQWs5UsNa0pYtmKZ+agnUw9s= github.com/ipld/go-ipld-prime v0.21.0 h1:n4JmcpOlPDIxBcY037SVfpd1G+Sj1nKZah0m6QH9C2E= github.com/ipld/go-ipld-prime v0.21.0/go.mod h1:3RLqy//ERg/y5oShXXdx5YIp50cFGOanyMctpPjsvxQ= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= +github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk= github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk= @@ -167,44 +154,47 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4= +github.com/klauspost/compress v1.17.6 h1:60eq2E/jlfwQXtvZEeBUYADs+BwKBWURIY+Gj2eRGjI= +github.com/klauspost/compress v1.17.6/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c= -github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= -github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= +github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/koron/go-ssdp v0.0.4 h1:1IDwrghSKYM7yLf7XCzbByg2sJ/JcNOZRXS2jczTwz0= +github.com/koron/go-ssdp v0.0.4/go.mod h1:oDXq+E5IL5q0U8uSBcoAXzTzInwy5lEgC91HoKtbmZk= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= -github.com/libp2p/go-cidranger v1.1.0 h1:ewPN8EZ0dd1LSnrtuwd4709PXVcITVeuwbag38yPW7c= -github.com/libp2p/go-libp2p v0.32.2 h1:s8GYN4YJzgUoyeYNPdW7JZeZ5Ee31iNaIBfGYMAY4FQ= -github.com/libp2p/go-libp2p v0.32.2/go.mod h1:E0LKe+diV/ZVJVnOJby8VC5xzHF0660osg71skcxJvk= -github.com/libp2p/go-libp2p-asn-util v0.3.0 h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLEQHwOCZ7s8s= +github.com/libp2p/go-libp2p v0.33.2 h1:vCdwnFxoGOXMKmaGHlDSnL4bM3fQeW8pgIa9DECnb40= +github.com/libp2p/go-libp2p v0.33.2/go.mod h1:zTeppLuCvUIkT118pFVzA8xzP/p2dJYOMApCkFh0Yww= +github.com/libp2p/go-libp2p-asn-util v0.4.1 h1:xqL7++IKD9TBFMgnLPZR6/6iYhawHKHl950SO9L6n94= +github.com/libp2p/go-libp2p-asn-util v0.4.1/go.mod h1:d/NI6XZ9qxw67b4e+NgpQexCIiFYJjErASrYW4PFDN8= github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0= +github.com/libp2p/go-libp2p-record v0.2.0/go.mod h1:I+3zMkvvg5m2OcSdoL0KPljyJyvNDFGKX7QdlpYUcwk= github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA= +github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg= github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0= +github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM= github.com/libp2p/go-nat v0.2.0 h1:Tyz+bUFAYqGyJ/ppPPymMGbIgNRH+WqC5QrT5fKrrGk= +github.com/libp2p/go-nat v0.2.0/go.mod h1:3MJr+GRpRkyT65EpVPBstXLvOlAPzUVlG6Pwg9ohLJk= github.com/libp2p/go-netroute v0.2.1 h1:V8kVrpD8GK0Riv15/7VN6RbUQ3URNZVosw7H2v9tksU= +github.com/libp2p/go-netroute v0.2.1/go.mod h1:hraioZr0fhBjG0ZRXJJ6Zj2IVEVNx6tDTFQfSmcq7mQ= github.com/libp2p/go-yamux/v4 v4.0.1 h1:FfDR4S1wj6Bw2Pqbc8Uz7pCxeRBPbwsBbEdfwiCypkQ= +github.com/libp2p/go-yamux/v4 v4.0.1/go.mod h1:NWjl8ZTLOGlozrXSOZ/HlfG++39iKNnM5wwmtQP1YB4= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= -github.com/miekg/dns v1.1.56 h1:5imZaSeoRNvpM9SzWNhEcP9QliKiz20/dA2QabIGVnE= -github.com/miguelmota/go-ethereum-hdwallet v0.1.2 h1:mz9LO6V7QCRkLYb0AH17t5R8KeqCe3E+hx9YXpmZeXA= -github.com/miguelmota/go-ethereum-hdwallet v0.1.2/go.mod h1:fdNwFSoBFVBPnU0xpOd6l2ueqsPSH/Gch5kIvSvTGk8= +github.com/miekg/dns v1.1.58 h1:ca2Hdkz+cDg/7eNF6V56jjzuZ4aCAE+DbVkILdQWG/4= +github.com/miekg/dns v1.1.58/go.mod h1:Ypv+3b/KadlvW9vJfXOTf300O4UqaHFzFCuHz+rPkBY= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= -github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= -github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= -github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= @@ -212,10 +202,12 @@ github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aG github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= -github.com/multiformats/go-multiaddr v0.12.0 h1:1QlibTFkoXJuDjjYsMHhE73TnzJQl8FSWatk/0gxGzE= -github.com/multiformats/go-multiaddr v0.12.0/go.mod h1:WmZXgObOQOYp9r3cslLlppkrz1FYSHmE834dfz/lWu8= +github.com/multiformats/go-multiaddr v0.12.3 h1:hVBXvPRcKG0w80VinQ23P5t7czWgg65BmIvQKjDydU8= +github.com/multiformats/go-multiaddr v0.12.3/go.mod h1:sBXrNzucqkFJhvKOiwwLyqamGa/P5EIXNPLovyhQCII= github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A= +github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk= github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= +github.com/multiformats/go-multiaddr-fmt v0.1.0/go.mod h1:hGtDIW4PU4BqJ50gW2quDuPVjyWNZxToGUh/HwTZYJo= github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= github.com/multiformats/go-multicodec v0.9.0 h1:pb/dlPnzee/Sxv/j4PmkDRxCOi3hXTz3IbPKOXWJkmg= @@ -229,13 +221,14 @@ github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXS github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5 h1:BvoENQQU+fZ9uukda/RzCAL/191HHwJA5b13R6diVlY= -github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= +github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= -github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= +github.com/onsi/ginkgo/v2 v2.17.1 h1:V++EzdbhI4ZV4ev0UTIj0PzhzOcReJFyJaLjtSF55M8= +github.com/onsi/ginkgo/v2 v2.17.1/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= +github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -243,24 +236,23 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/polydawn/refmt v0.89.0 h1:ADJTApkvkeBZsN0tBTx8QjpD9JkmxbKp0cxfr9qszm4= github.com/polydawn/refmt v0.89.0/go.mod h1:/zvteZs/GwLtCgZ4BL6CBsk9IKIlexP43ObX9AxTqTw= -github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU= -github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k= -github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= +github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= +github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= github.com/prometheus/common v0.48.0 h1:QO8U2CdOzSn1BBsmXJXduaaW+dY/5QLjfB8svtSzKKE= github.com/prometheus/common v0.48.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= -github.com/quic-go/qtls-go1-20 v0.4.1 h1:D33340mCNDAIKBqXuAvexTNMUByrYmFYVfKfDN5nfFs= -github.com/quic-go/qtls-go1-20 v0.4.1/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= -github.com/quic-go/quic-go v0.40.1 h1:X3AGzUNFs0jVuO3esAGnTfvdgvL4fq655WaOi1snv1Q= -github.com/quic-go/quic-go v0.40.1/go.mod h1:PeN7kuVJ4xZbxSv/4OX6S1USOX8MJvydwpTx31vx60c= +github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= +github.com/quic-go/quic-go v0.44.0 h1:So5wOr7jyO4vzL2sd8/pD9Kesciv91zSk8BoFngItQ0= +github.com/quic-go/quic-go v0.44.0/go.mod h1:z4cx/9Ny9UtGITIPzmPTXh1ULfOyWh4qGQlpnPcWmek= github.com/quic-go/webtransport-go v0.6.0 h1:CvNsKqc4W2HljHJnoT+rMmbRJybShZ0YPFDD3NxaZLY= -github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/quic-go/webtransport-go v0.6.0/go.mod h1:9KjU4AEBqEQidGHNDkZrb8CAa1abRaosM2yGOyiikEc= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs= github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= @@ -274,17 +266,13 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= -github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= -github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= -github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= -github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/warpfork/go-testmark v0.12.1 h1:rMgCpJfwy1sJ50x0M0NgyphxYYPMOODIJHhsXyEHU0s= +github.com/warpfork/go-testmark v0.12.1/go.mod h1:kHwy7wfvGSPh1rQJYKayD4AbtNaeyZdcGi9tNJTaa5Y= github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0 h1:GDDkbFiaK8jsSDJfjId/PEGEShv6ugrt4kYsC5UIDaQ= github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E= @@ -294,6 +282,7 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zeebo/assert v1.1.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= +github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= github.com/zeebo/blake3 v0.2.3 h1:TFoLXsjeXqRNFxSbk35Dk4YtszE/MQQGK10BH4ptoTg= github.com/zeebo/blake3 v0.2.3/go.mod h1:mjJjZpnsyIVtVgTOSpJ9vmRE4wgDeyt2HU3qXvvKCaQ= github.com/zeebo/errs v1.3.0 h1:hmiaKqgYZzcVgRL1Vkc1Mn2914BbzB0IBxs+ebeutGs= @@ -309,6 +298,7 @@ go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= @@ -324,18 +314,18 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200602180216-279210d13fed/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.20.0 h1:jmAMJJZXr5KiCw05dfYK9QnqaqKLYXijU23lsEdcQqg= -golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ= -golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 h1:/RIbNt/Zr7rVhIkQhooTxCxFcdWLGIKnZA4IXNFSrvo= -golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= +golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= golang.org/x/image v0.14.0 h1:tNgSxAFe3jC4uYqvZdTr84SZoM1KfwdC9SKIFrLjFn4= golang.org/x/image v0.14.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= -golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -343,15 +333,15 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -363,12 +353,15 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -376,30 +369,30 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= -golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= +golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw= +golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= -rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= -rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= storj.io/drpc v0.0.34 h1:q9zlQKfJ5A7x8NQNFk8x7eKUF78FMhmAbZLnFK+og7I= storj.io/drpc v0.0.34/go.mod h1:Y9LZaa8esL1PW2IDMqJE7CFSNq7d5bQ3RI7mGPtmKMg= diff --git a/nameservice/nameserviceclient/mock/mock_nameserviceclient.go b/nameservice/nameserviceclient/mock/mock_nameserviceclient.go index a90bee8e..05c4a2af 100644 --- a/nameservice/nameserviceclient/mock/mock_nameserviceclient.go +++ b/nameservice/nameserviceclient/mock/mock_nameserviceclient.go @@ -40,18 +40,49 @@ func (m *MockAnyNsClientServiceBase) EXPECT() *MockAnyNsClientServiceBaseMockRec return m.recorder } -// Close mocks base method. -func (m *MockAnyNsClientServiceBase) Close(ctx context.Context) error { +// BatchGetNameByAddress mocks base method. +func (m *MockAnyNsClientServiceBase) BatchGetNameByAddress(ctx context.Context, in *nameserviceproto.BatchNameByAddressRequest) (*nameserviceproto.BatchNameByAddressResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Close", ctx) - ret0, _ := ret[0].(error) - return ret0 + ret := m.ctrl.Call(m, "BatchGetNameByAddress", ctx, in) + ret0, _ := ret[0].(*nameserviceproto.BatchNameByAddressResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Close indicates an expected call of Close. -func (mr *MockAnyNsClientServiceBaseMockRecorder) Close(ctx any) *gomock.Call { +// BatchGetNameByAddress indicates an expected call of BatchGetNameByAddress. +func (mr *MockAnyNsClientServiceBaseMockRecorder) BatchGetNameByAddress(ctx, in any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockAnyNsClientServiceBase)(nil).Close), ctx) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BatchGetNameByAddress", reflect.TypeOf((*MockAnyNsClientServiceBase)(nil).BatchGetNameByAddress), ctx, in) +} + +// BatchGetNameByAnyId mocks base method. +func (m *MockAnyNsClientServiceBase) BatchGetNameByAnyId(ctx context.Context, in *nameserviceproto.BatchNameByAnyIdRequest) (*nameserviceproto.BatchNameByAddressResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BatchGetNameByAnyId", ctx, in) + ret0, _ := ret[0].(*nameserviceproto.BatchNameByAddressResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BatchGetNameByAnyId indicates an expected call of BatchGetNameByAnyId. +func (mr *MockAnyNsClientServiceBaseMockRecorder) BatchGetNameByAnyId(ctx, in any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BatchGetNameByAnyId", reflect.TypeOf((*MockAnyNsClientServiceBase)(nil).BatchGetNameByAnyId), ctx, in) +} + +// BatchIsNameAvailable mocks base method. +func (m *MockAnyNsClientServiceBase) BatchIsNameAvailable(ctx context.Context, in *nameserviceproto.BatchNameAvailableRequest) (*nameserviceproto.BatchNameAvailableResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BatchIsNameAvailable", ctx, in) + ret0, _ := ret[0].(*nameserviceproto.BatchNameAvailableResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BatchIsNameAvailable indicates an expected call of BatchIsNameAvailable. +func (mr *MockAnyNsClientServiceBaseMockRecorder) BatchIsNameAvailable(ctx, in any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BatchIsNameAvailable", reflect.TypeOf((*MockAnyNsClientServiceBase)(nil).BatchIsNameAvailable), ctx, in) } // GetNameByAddress mocks base method. @@ -69,6 +100,21 @@ func (mr *MockAnyNsClientServiceBaseMockRecorder) GetNameByAddress(ctx, in any) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNameByAddress", reflect.TypeOf((*MockAnyNsClientServiceBase)(nil).GetNameByAddress), ctx, in) } +// GetNameByAnyId mocks base method. +func (m *MockAnyNsClientServiceBase) GetNameByAnyId(ctx context.Context, in *nameserviceproto.NameByAnyIdRequest) (*nameserviceproto.NameByAddressResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetNameByAnyId", ctx, in) + ret0, _ := ret[0].(*nameserviceproto.NameByAddressResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetNameByAnyId indicates an expected call of GetNameByAnyId. +func (mr *MockAnyNsClientServiceBaseMockRecorder) GetNameByAnyId(ctx, in any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNameByAnyId", reflect.TypeOf((*MockAnyNsClientServiceBase)(nil).GetNameByAnyId), ctx, in) +} + // Init mocks base method. func (m *MockAnyNsClientServiceBase) Init(a *app.App) error { m.ctrl.T.Helper() @@ -112,20 +158,6 @@ func (mr *MockAnyNsClientServiceBaseMockRecorder) Name() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockAnyNsClientServiceBase)(nil).Name)) } -// Run mocks base method. -func (m *MockAnyNsClientServiceBase) Run(ctx context.Context) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Run", ctx) - ret0, _ := ret[0].(error) - return ret0 -} - -// Run indicates an expected call of Run. -func (mr *MockAnyNsClientServiceBaseMockRecorder) Run(ctx any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Run", reflect.TypeOf((*MockAnyNsClientServiceBase)(nil).Run), ctx) -} - // MockAnyNsClientService is a mock of AnyNsClientService interface. type MockAnyNsClientService struct { ctrl *gomock.Controller @@ -164,18 +196,64 @@ func (mr *MockAnyNsClientServiceMockRecorder) AdminFundUserAccount(ctx, in any) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AdminFundUserAccount", reflect.TypeOf((*MockAnyNsClientService)(nil).AdminFundUserAccount), ctx, in) } -// Close mocks base method. -func (m *MockAnyNsClientService) Close(ctx context.Context) error { +// AdminRegisterName mocks base method. +func (m *MockAnyNsClientService) AdminRegisterName(ctx context.Context, in *nameserviceproto.NameRegisterRequestSigned) (*nameserviceproto.OperationResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Close", ctx) - ret0, _ := ret[0].(error) - return ret0 + ret := m.ctrl.Call(m, "AdminRegisterName", ctx, in) + ret0, _ := ret[0].(*nameserviceproto.OperationResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Close indicates an expected call of Close. -func (mr *MockAnyNsClientServiceMockRecorder) Close(ctx any) *gomock.Call { +// AdminRegisterName indicates an expected call of AdminRegisterName. +func (mr *MockAnyNsClientServiceMockRecorder) AdminRegisterName(ctx, in any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockAnyNsClientService)(nil).Close), ctx) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AdminRegisterName", reflect.TypeOf((*MockAnyNsClientService)(nil).AdminRegisterName), ctx, in) +} + +// BatchGetNameByAddress mocks base method. +func (m *MockAnyNsClientService) BatchGetNameByAddress(ctx context.Context, in *nameserviceproto.BatchNameByAddressRequest) (*nameserviceproto.BatchNameByAddressResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BatchGetNameByAddress", ctx, in) + ret0, _ := ret[0].(*nameserviceproto.BatchNameByAddressResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BatchGetNameByAddress indicates an expected call of BatchGetNameByAddress. +func (mr *MockAnyNsClientServiceMockRecorder) BatchGetNameByAddress(ctx, in any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BatchGetNameByAddress", reflect.TypeOf((*MockAnyNsClientService)(nil).BatchGetNameByAddress), ctx, in) +} + +// BatchGetNameByAnyId mocks base method. +func (m *MockAnyNsClientService) BatchGetNameByAnyId(ctx context.Context, in *nameserviceproto.BatchNameByAnyIdRequest) (*nameserviceproto.BatchNameByAddressResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BatchGetNameByAnyId", ctx, in) + ret0, _ := ret[0].(*nameserviceproto.BatchNameByAddressResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BatchGetNameByAnyId indicates an expected call of BatchGetNameByAnyId. +func (mr *MockAnyNsClientServiceMockRecorder) BatchGetNameByAnyId(ctx, in any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BatchGetNameByAnyId", reflect.TypeOf((*MockAnyNsClientService)(nil).BatchGetNameByAnyId), ctx, in) +} + +// BatchIsNameAvailable mocks base method. +func (m *MockAnyNsClientService) BatchIsNameAvailable(ctx context.Context, in *nameserviceproto.BatchNameAvailableRequest) (*nameserviceproto.BatchNameAvailableResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BatchIsNameAvailable", ctx, in) + ret0, _ := ret[0].(*nameserviceproto.BatchNameAvailableResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BatchIsNameAvailable indicates an expected call of BatchIsNameAvailable. +func (mr *MockAnyNsClientServiceMockRecorder) BatchIsNameAvailable(ctx, in any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BatchIsNameAvailable", reflect.TypeOf((*MockAnyNsClientService)(nil).BatchIsNameAvailable), ctx, in) } // CreateOperation mocks base method. @@ -208,6 +286,21 @@ func (mr *MockAnyNsClientServiceMockRecorder) GetNameByAddress(ctx, in any) *gom return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNameByAddress", reflect.TypeOf((*MockAnyNsClientService)(nil).GetNameByAddress), ctx, in) } +// GetNameByAnyId mocks base method. +func (m *MockAnyNsClientService) GetNameByAnyId(ctx context.Context, in *nameserviceproto.NameByAnyIdRequest) (*nameserviceproto.NameByAddressResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetNameByAnyId", ctx, in) + ret0, _ := ret[0].(*nameserviceproto.NameByAddressResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetNameByAnyId indicates an expected call of GetNameByAnyId. +func (mr *MockAnyNsClientServiceMockRecorder) GetNameByAnyId(ctx, in any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNameByAnyId", reflect.TypeOf((*MockAnyNsClientService)(nil).GetNameByAnyId), ctx, in) +} + // GetOperation mocks base method. func (m *MockAnyNsClientService) GetOperation(ctx context.Context, in *nameserviceproto.GetOperationStatusRequest) (*nameserviceproto.OperationResponse, error) { m.ctrl.T.Helper() @@ -280,17 +373,3 @@ func (mr *MockAnyNsClientServiceMockRecorder) Name() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockAnyNsClientService)(nil).Name)) } - -// Run mocks base method. -func (m *MockAnyNsClientService) Run(ctx context.Context) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Run", ctx) - ret0, _ := ret[0].(error) - return ret0 -} - -// Run indicates an expected call of Run. -func (mr *MockAnyNsClientServiceMockRecorder) Run(ctx any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Run", reflect.TypeOf((*MockAnyNsClientService)(nil).Run), ctx) -} diff --git a/nameservice/nameserviceclient/nameserviceclient.go b/nameservice/nameserviceclient/nameserviceclient.go index 0641405b..e0e07cf2 100644 --- a/nameservice/nameserviceclient/nameserviceclient.go +++ b/nameservice/nameserviceclient/nameserviceclient.go @@ -2,6 +2,7 @@ package nameserviceclient import ( "context" + "errors" "github.com/anyproto/any-sync/app" "github.com/anyproto/any-sync/app/logger" @@ -25,6 +26,12 @@ type AnyNsClientServiceBase interface { IsNameAvailable(ctx context.Context, in *nsp.NameAvailableRequest) (out *nsp.NameAvailableResponse, err error) // reverse resolve GetNameByAddress(ctx context.Context, in *nsp.NameByAddressRequest) (out *nsp.NameByAddressResponse, err error) + GetNameByAnyId(ctx context.Context, in *nsp.NameByAnyIdRequest) (out *nsp.NameByAddressResponse, err error) + + BatchIsNameAvailable(ctx context.Context, in *nsp.BatchNameAvailableRequest) (out *nsp.BatchNameAvailableResponse, err error) + // reverse resolve + BatchGetNameByAddress(ctx context.Context, in *nsp.BatchNameByAddressRequest) (out *nsp.BatchNameByAddressResponse, err error) + BatchGetNameByAnyId(ctx context.Context, in *nsp.BatchNameByAnyIdRequest) (out *nsp.BatchNameByAddressResponse, err error) app.Component } @@ -34,6 +41,8 @@ type AnyNsClientService interface { GetUserAccount(ctx context.Context, in *nsp.GetUserAccountRequest) (out *nsp.UserAccount, err error) AdminFundUserAccount(ctx context.Context, in *nsp.AdminFundUserAccountRequestSigned) (out *nsp.OperationResponse, err error) + AdminRegisterName(ctx context.Context, in *nsp.NameRegisterRequestSigned) (out *nsp.OperationResponse, err error) + GetOperation(ctx context.Context, in *nsp.GetOperationStatusRequest) (out *nsp.OperationResponse, err error) CreateOperation(ctx context.Context, in *nsp.CreateUserOperationRequestSigned) (out *nsp.OperationResponse, err error) @@ -60,9 +69,14 @@ func New() AnyNsClientService { } func (s *service) doClient(ctx context.Context, fn func(cl nsp.DRPCAnynsClient) error) error { + if len(s.nodeconf.NamingNodePeers()) == 0 { + log.Error("no namingNode peers configured") + return errors.New("no namingNode peers configured") + } + // it will try to connect to the Naming Node // please enable "namingNode" type of node in the config (in the network.nodes array) - peer, err := s.pool.Get(ctx, s.nodeconf.NamingNodePeers()[0]) + peer, err := s.pool.GetOneOf(ctx, s.nodeconf.NamingNodePeers()) log.Info("trying to connect to namingNode peer: ", zap.Any("peer", peer)) if err != nil { @@ -117,6 +131,47 @@ func (s *service) GetNameByAddress(ctx context.Context, in *nsp.NameByAddressReq return } +func (s *service) GetNameByAnyId(ctx context.Context, in *nsp.NameByAnyIdRequest) (out *nsp.NameByAddressResponse, err error) { + err = s.doClient(ctx, func(cl nsp.DRPCAnynsClient) error { + if out, err = cl.GetNameByAnyId(ctx, in); err != nil { + return rpcerr.Unwrap(err) + } + return nil + }) + return +} + +func (s *service) BatchIsNameAvailable(ctx context.Context, in *nsp.BatchNameAvailableRequest) (out *nsp.BatchNameAvailableResponse, err error) { + err = s.doClient(ctx, func(cl nsp.DRPCAnynsClient) error { + if out, err = cl.BatchIsNameAvailable(ctx, in); err != nil { + return rpcerr.Unwrap(err) + } + return nil + }) + return +} + +// reverse resolve +func (s *service) BatchGetNameByAddress(ctx context.Context, in *nsp.BatchNameByAddressRequest) (out *nsp.BatchNameByAddressResponse, err error) { + err = s.doClient(ctx, func(cl nsp.DRPCAnynsClient) error { + if out, err = cl.BatchGetNameByAddress(ctx, in); err != nil { + return rpcerr.Unwrap(err) + } + return nil + }) + return +} + +func (s *service) BatchGetNameByAnyId(ctx context.Context, in *nsp.BatchNameByAnyIdRequest) (out *nsp.BatchNameByAddressResponse, err error) { + err = s.doClient(ctx, func(cl nsp.DRPCAnynsClient) error { + if out, err = cl.BatchGetNameByAnyId(ctx, in); err != nil { + return rpcerr.Unwrap(err) + } + return nil + }) + return +} + // AA func (s *service) GetUserAccount(ctx context.Context, in *nsp.GetUserAccountRequest) (out *nsp.UserAccount, err error) { err = s.doClientAA(ctx, func(cl nsp.DRPCAnynsAccountAbstractionClient) error { @@ -138,6 +193,16 @@ func (s *service) AdminFundUserAccount(ctx context.Context, in *nsp.AdminFundUse return } +func (s *service) AdminRegisterName(ctx context.Context, in *nsp.NameRegisterRequestSigned) (out *nsp.OperationResponse, err error) { + err = s.doClient(ctx, func(cl nsp.DRPCAnynsClient) error { + if out, err = cl.AdminNameRegisterSigned(ctx, in); err != nil { + return rpcerr.Unwrap(err) + } + return nil + }) + return +} + func (s *service) GetOperation(ctx context.Context, in *nsp.GetOperationStatusRequest) (out *nsp.OperationResponse, err error) { err = s.doClientAA(ctx, func(cl nsp.DRPCAnynsAccountAbstractionClient) error { if out, err = cl.GetOperation(ctx, in); err != nil { diff --git a/nameservice/nameserviceproto/nameservice.pb.go b/nameservice/nameserviceproto/nameservice.pb.go index 5e2a81cc..8bdb1fbf 100644 --- a/nameservice/nameserviceproto/nameservice.pb.go +++ b/nameservice/nameserviceproto/nameservice.pb.go @@ -67,16 +67,62 @@ func (m *NameAvailableRequest) GetFullName() string { return "" } +type BatchNameAvailableRequest struct { + // Names including .any suffix + FullNames []string `protobuf:"bytes,1,rep,name=fullNames,proto3" json:"fullNames,omitempty"` +} + +func (m *BatchNameAvailableRequest) Reset() { *m = BatchNameAvailableRequest{} } +func (m *BatchNameAvailableRequest) String() string { return proto.CompactTextString(m) } +func (*BatchNameAvailableRequest) ProtoMessage() {} +func (*BatchNameAvailableRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_06bca2ea4304f305, []int{1} +} +func (m *BatchNameAvailableRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BatchNameAvailableRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BatchNameAvailableRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BatchNameAvailableRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BatchNameAvailableRequest.Merge(m, src) +} +func (m *BatchNameAvailableRequest) XXX_Size() int { + return m.Size() +} +func (m *BatchNameAvailableRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BatchNameAvailableRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BatchNameAvailableRequest proto.InternalMessageInfo + +func (m *BatchNameAvailableRequest) GetFullNames() []string { + if m != nil { + return m.FullNames + } + return nil +} + type NameByAddressRequest struct { - // An Ethereum address that owns that name - OwnerEthAddress string `protobuf:"bytes,1,opt,name=ownerEthAddress,proto3" json:"ownerEthAddress,omitempty"` + // EOA -> SCW -> name + // A SCW Ethereum address that owns that name + OwnerScwEthAddress string `protobuf:"bytes,1,opt,name=ownerScwEthAddress,proto3" json:"ownerScwEthAddress,omitempty"` } func (m *NameByAddressRequest) Reset() { *m = NameByAddressRequest{} } func (m *NameByAddressRequest) String() string { return proto.CompactTextString(m) } func (*NameByAddressRequest) ProtoMessage() {} func (*NameByAddressRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_06bca2ea4304f305, []int{1} + return fileDescriptor_06bca2ea4304f305, []int{2} } func (m *NameByAddressRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -105,34 +151,170 @@ func (m *NameByAddressRequest) XXX_DiscardUnknown() { var xxx_messageInfo_NameByAddressRequest proto.InternalMessageInfo -func (m *NameByAddressRequest) GetOwnerEthAddress() string { +func (m *NameByAddressRequest) GetOwnerScwEthAddress() string { if m != nil { - return m.OwnerEthAddress + return m.OwnerScwEthAddress } return "" } +type BatchNameByAddressRequest struct { + // EOA -> SCW -> name + // A SCW Ethereum address that owns that name + OwnerScwEthAddresses []string `protobuf:"bytes,1,rep,name=ownerScwEthAddresses,proto3" json:"ownerScwEthAddresses,omitempty"` +} + +func (m *BatchNameByAddressRequest) Reset() { *m = BatchNameByAddressRequest{} } +func (m *BatchNameByAddressRequest) String() string { return proto.CompactTextString(m) } +func (*BatchNameByAddressRequest) ProtoMessage() {} +func (*BatchNameByAddressRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_06bca2ea4304f305, []int{3} +} +func (m *BatchNameByAddressRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BatchNameByAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BatchNameByAddressRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BatchNameByAddressRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BatchNameByAddressRequest.Merge(m, src) +} +func (m *BatchNameByAddressRequest) XXX_Size() int { + return m.Size() +} +func (m *BatchNameByAddressRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BatchNameByAddressRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BatchNameByAddressRequest proto.InternalMessageInfo + +func (m *BatchNameByAddressRequest) GetOwnerScwEthAddresses() []string { + if m != nil { + return m.OwnerScwEthAddresses + } + return nil +} + +type NameByAnyIdRequest struct { + AnyAddress string `protobuf:"bytes,1,opt,name=anyAddress,proto3" json:"anyAddress,omitempty"` +} + +func (m *NameByAnyIdRequest) Reset() { *m = NameByAnyIdRequest{} } +func (m *NameByAnyIdRequest) String() string { return proto.CompactTextString(m) } +func (*NameByAnyIdRequest) ProtoMessage() {} +func (*NameByAnyIdRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_06bca2ea4304f305, []int{4} +} +func (m *NameByAnyIdRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NameByAnyIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NameByAnyIdRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *NameByAnyIdRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_NameByAnyIdRequest.Merge(m, src) +} +func (m *NameByAnyIdRequest) XXX_Size() int { + return m.Size() +} +func (m *NameByAnyIdRequest) XXX_DiscardUnknown() { + xxx_messageInfo_NameByAnyIdRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_NameByAnyIdRequest proto.InternalMessageInfo + +func (m *NameByAnyIdRequest) GetAnyAddress() string { + if m != nil { + return m.AnyAddress + } + return "" +} + +type BatchNameByAnyIdRequest struct { + AnyAddresses []string `protobuf:"bytes,1,rep,name=anyAddresses,proto3" json:"anyAddresses,omitempty"` +} + +func (m *BatchNameByAnyIdRequest) Reset() { *m = BatchNameByAnyIdRequest{} } +func (m *BatchNameByAnyIdRequest) String() string { return proto.CompactTextString(m) } +func (*BatchNameByAnyIdRequest) ProtoMessage() {} +func (*BatchNameByAnyIdRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_06bca2ea4304f305, []int{5} +} +func (m *BatchNameByAnyIdRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BatchNameByAnyIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BatchNameByAnyIdRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BatchNameByAnyIdRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BatchNameByAnyIdRequest.Merge(m, src) +} +func (m *BatchNameByAnyIdRequest) XXX_Size() int { + return m.Size() +} +func (m *BatchNameByAnyIdRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BatchNameByAnyIdRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BatchNameByAnyIdRequest proto.InternalMessageInfo + +func (m *BatchNameByAnyIdRequest) GetAnyAddresses() []string { + if m != nil { + return m.AnyAddresses + } + return nil +} + type NameAvailableResponse struct { Available bool `protobuf:"varint,1,opt,name=available,proto3" json:"available,omitempty"` - // An Ethereum address that owns that name + // EOA -> SCW -> name // This field is non-empty only if name is "already registered" - OwnerEthAddress string `protobuf:"bytes,2,opt,name=ownerEthAddress,proto3" json:"ownerEthAddress,omitempty"` + OwnerScwEthAddress string `protobuf:"bytes,2,opt,name=ownerScwEthAddress,proto3" json:"ownerScwEthAddress,omitempty"` + // This field is non-empty only if name is "already registered" + OwnerEthAddress string `protobuf:"bytes,3,opt,name=ownerEthAddress,proto3" json:"ownerEthAddress,omitempty"` // A content hash attached to this name // This field is non-empty only if name is "already registered" - OwnerAnyAddress string `protobuf:"bytes,3,opt,name=ownerAnyAddress,proto3" json:"ownerAnyAddress,omitempty"` + OwnerAnyAddress string `protobuf:"bytes,4,opt,name=ownerAnyAddress,proto3" json:"ownerAnyAddress,omitempty"` // A SpaceID attached to this name // This field is non-empty only if name is "already registered" - SpaceId string `protobuf:"bytes,4,opt,name=spaceId,proto3" json:"spaceId,omitempty"` - // doestn't work with marashalling/unmarshalling - // google.protobuf.Timestamp nameExpires = 5 [(gogoproto.stdtime) = true]; - NameExpires int64 `protobuf:"varint,5,opt,name=nameExpires,proto3" json:"nameExpires,omitempty"` + SpaceId string `protobuf:"bytes,5,opt,name=spaceId,proto3" json:"spaceId,omitempty"` + // doesn't work with marashalling/unmarshalling + //google.protobuf.Timestamp nameExpires = 5 [(gogoproto.stdtime) = true]; + NameExpires int64 `protobuf:"varint,6,opt,name=nameExpires,proto3" json:"nameExpires,omitempty"` } func (m *NameAvailableResponse) Reset() { *m = NameAvailableResponse{} } func (m *NameAvailableResponse) String() string { return proto.CompactTextString(m) } func (*NameAvailableResponse) ProtoMessage() {} func (*NameAvailableResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_06bca2ea4304f305, []int{2} + return fileDescriptor_06bca2ea4304f305, []int{6} } func (m *NameAvailableResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -168,6 +350,13 @@ func (m *NameAvailableResponse) GetAvailable() bool { return false } +func (m *NameAvailableResponse) GetOwnerScwEthAddress() string { + if m != nil { + return m.OwnerScwEthAddress + } + return "" +} + func (m *NameAvailableResponse) GetOwnerEthAddress() string { if m != nil { return m.OwnerEthAddress @@ -196,6 +385,50 @@ func (m *NameAvailableResponse) GetNameExpires() int64 { return 0 } +type BatchNameAvailableResponse struct { + Results []*NameAvailableResponse `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` +} + +func (m *BatchNameAvailableResponse) Reset() { *m = BatchNameAvailableResponse{} } +func (m *BatchNameAvailableResponse) String() string { return proto.CompactTextString(m) } +func (*BatchNameAvailableResponse) ProtoMessage() {} +func (*BatchNameAvailableResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_06bca2ea4304f305, []int{7} +} +func (m *BatchNameAvailableResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BatchNameAvailableResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BatchNameAvailableResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BatchNameAvailableResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BatchNameAvailableResponse.Merge(m, src) +} +func (m *BatchNameAvailableResponse) XXX_Size() int { + return m.Size() +} +func (m *BatchNameAvailableResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BatchNameAvailableResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BatchNameAvailableResponse proto.InternalMessageInfo + +func (m *BatchNameAvailableResponse) GetResults() []*NameAvailableResponse { + if m != nil { + return m.Results + } + return nil +} + type NameByAddressResponse struct { Found bool `protobuf:"varint,1,opt,name=found,proto3" json:"found,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` @@ -205,7 +438,7 @@ func (m *NameByAddressResponse) Reset() { *m = NameByAddressResponse{} } func (m *NameByAddressResponse) String() string { return proto.CompactTextString(m) } func (*NameByAddressResponse) ProtoMessage() {} func (*NameByAddressResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_06bca2ea4304f305, []int{3} + return fileDescriptor_06bca2ea4304f305, []int{8} } func (m *NameByAddressResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -248,11 +481,61 @@ func (m *NameByAddressResponse) GetName() string { return "" } +type BatchNameByAddressResponse struct { + Results []*NameByAddressResponse `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` +} + +func (m *BatchNameByAddressResponse) Reset() { *m = BatchNameByAddressResponse{} } +func (m *BatchNameByAddressResponse) String() string { return proto.CompactTextString(m) } +func (*BatchNameByAddressResponse) ProtoMessage() {} +func (*BatchNameByAddressResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_06bca2ea4304f305, []int{9} +} +func (m *BatchNameByAddressResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BatchNameByAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BatchNameByAddressResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BatchNameByAddressResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BatchNameByAddressResponse.Merge(m, src) +} +func (m *BatchNameByAddressResponse) XXX_Size() int { + return m.Size() +} +func (m *BatchNameByAddressResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BatchNameByAddressResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BatchNameByAddressResponse proto.InternalMessageInfo + +func (m *BatchNameByAddressResponse) GetResults() []*NameByAddressResponse { + if m != nil { + return m.Results + } + return nil +} + func init() { proto.RegisterType((*NameAvailableRequest)(nil), "NameAvailableRequest") + proto.RegisterType((*BatchNameAvailableRequest)(nil), "BatchNameAvailableRequest") proto.RegisterType((*NameByAddressRequest)(nil), "NameByAddressRequest") + proto.RegisterType((*BatchNameByAddressRequest)(nil), "BatchNameByAddressRequest") + proto.RegisterType((*NameByAnyIdRequest)(nil), "NameByAnyIdRequest") + proto.RegisterType((*BatchNameByAnyIdRequest)(nil), "BatchNameByAnyIdRequest") proto.RegisterType((*NameAvailableResponse)(nil), "NameAvailableResponse") + proto.RegisterType((*BatchNameAvailableResponse)(nil), "BatchNameAvailableResponse") proto.RegisterType((*NameByAddressResponse)(nil), "NameByAddressResponse") + proto.RegisterType((*BatchNameByAddressResponse)(nil), "BatchNameByAddressResponse") } func init() { @@ -260,28 +543,43 @@ func init() { } var fileDescriptor_06bca2ea4304f305 = []byte{ - // 330 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0x31, 0x6f, 0xf2, 0x30, - 0x10, 0x8d, 0x3f, 0xe0, 0x2b, 0x5c, 0x07, 0x2a, 0x0b, 0xaa, 0x08, 0x21, 0x0b, 0x79, 0x62, 0x02, - 0x89, 0xaa, 0x9d, 0x1b, 0x2a, 0x54, 0xb1, 0x74, 0xc8, 0xd8, 0xcd, 0x90, 0x43, 0x45, 0x0a, 0x4e, - 0x1a, 0x07, 0x5a, 0xfe, 0x05, 0x7f, 0xaa, 0x52, 0x47, 0xc6, 0x8e, 0x15, 0xfc, 0x91, 0x0a, 0xc7, - 0x81, 0x90, 0x46, 0x5d, 0x12, 0xdf, 0xf3, 0xbd, 0xbb, 0x77, 0xef, 0x0c, 0xb7, 0x52, 0x2c, 0x50, - 0x61, 0xb4, 0x9a, 0x4f, 0xb1, 0x9f, 0x39, 0x87, 0x51, 0x10, 0x07, 0x7d, 0xfd, 0x55, 0x59, 0xbc, - 0xa7, 0x21, 0x3e, 0x80, 0xc6, 0x93, 0x58, 0xa0, 0xb3, 0x12, 0x73, 0x5f, 0x4c, 0x7c, 0x74, 0xf1, - 0x75, 0x89, 0x2a, 0xa6, 0x2d, 0xa8, 0xce, 0x96, 0xbe, 0x7f, 0xb8, 0xb3, 0x49, 0x87, 0x74, 0x6b, - 0xee, 0x31, 0xe6, 0xf7, 0x09, 0x67, 0xb8, 0x76, 0x3c, 0x2f, 0x42, 0xa5, 0x52, 0x4e, 0x17, 0xea, - 0xc1, 0x9b, 0xc4, 0x68, 0x14, 0xbf, 0x98, 0x1b, 0x43, 0xcd, 0xc3, 0xfc, 0x83, 0x40, 0x33, 0xd7, - 0x56, 0x85, 0x81, 0x54, 0x48, 0xdb, 0x50, 0x13, 0x29, 0xa8, 0xd9, 0x55, 0xf7, 0x04, 0x14, 0x75, - 0xf8, 0x57, 0xd8, 0xe1, 0x98, 0xe9, 0xc8, 0x54, 0xa5, 0x5d, 0xca, 0x64, 0x9e, 0x60, 0x6a, 0xc3, - 0x85, 0x0a, 0xc5, 0x14, 0xc7, 0x9e, 0x5d, 0xd6, 0x19, 0x69, 0x48, 0x3b, 0x70, 0x79, 0x30, 0x6c, - 0xf4, 0x1e, 0xce, 0x23, 0x54, 0x76, 0xa5, 0x43, 0xba, 0x25, 0x37, 0x0b, 0x71, 0x27, 0x19, 0x23, - 0xe3, 0x84, 0x19, 0xa3, 0x01, 0x95, 0x59, 0xb0, 0x94, 0x9e, 0x19, 0x21, 0x09, 0x28, 0x85, 0xf2, - 0x81, 0x6d, 0x34, 0xeb, 0xf3, 0x60, 0x43, 0xa0, 0xe2, 0xc8, 0xb5, 0x54, 0x74, 0x08, 0xf5, 0xb1, - 0x3a, 0x73, 0x85, 0x36, 0x7b, 0x45, 0xcb, 0x69, 0x5d, 0xf7, 0x0a, 0xcd, 0xe3, 0x16, 0x7d, 0x80, - 0xab, 0x47, 0x8c, 0xcf, 0x34, 0x99, 0x22, 0xf9, 0x6d, 0x99, 0x22, 0xbf, 0xa4, 0x73, 0x6b, 0x78, - 0xf7, 0xb9, 0x63, 0x64, 0xbb, 0x63, 0xe4, 0x7b, 0xc7, 0xc8, 0x66, 0xcf, 0xac, 0xed, 0x9e, 0x59, - 0x5f, 0x7b, 0x66, 0x3d, 0xb7, 0xff, 0x7a, 0x64, 0x93, 0xff, 0xfa, 0x77, 0xf3, 0x13, 0x00, 0x00, - 0xff, 0xff, 0xe0, 0x5b, 0xc6, 0xb3, 0x8b, 0x02, 0x00, 0x00, + // 562 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4d, 0x6f, 0xd3, 0x40, + 0x10, 0xb5, 0x49, 0xd2, 0x36, 0x53, 0x44, 0xd1, 0x36, 0xa1, 0xc6, 0xad, 0xac, 0x68, 0x4f, 0x39, + 0x6d, 0x51, 0xf8, 0x10, 0x1c, 0x10, 0x72, 0x50, 0x41, 0x11, 0x52, 0x2a, 0xdc, 0x1b, 0x17, 0xb4, + 0x8d, 0xb7, 0xad, 0xa5, 0x64, 0x1d, 0xbc, 0x4e, 0x4b, 0xfe, 0x05, 0x17, 0xfe, 0x13, 0xc7, 0x1e, + 0x39, 0xa2, 0xe4, 0x37, 0x70, 0x47, 0x5e, 0xdb, 0xf1, 0xfa, 0xab, 0xa8, 0x97, 0xd6, 0xfb, 0xe6, + 0xcd, 0xdb, 0x37, 0x4f, 0x3b, 0x81, 0x97, 0x9c, 0xce, 0x98, 0x60, 0xc1, 0xb5, 0x37, 0x61, 0xc7, + 0xca, 0xf7, 0x3c, 0xf0, 0x43, 0xff, 0x58, 0xfe, 0x15, 0x2a, 0x4e, 0x24, 0x64, 0xbe, 0xbe, 0x67, + 0xdb, 0x57, 0x4a, 0xe3, 0x4e, 0x3c, 0x80, 0xce, 0x98, 0xce, 0x98, 0x7d, 0x4d, 0xbd, 0x29, 0x3d, + 0x9f, 0x32, 0x87, 0x7d, 0x5b, 0x30, 0x11, 0x22, 0x13, 0x76, 0x2e, 0x16, 0xd3, 0x69, 0x54, 0x33, + 0xf4, 0x9e, 0xde, 0x6f, 0x3b, 0x9b, 0x33, 0x7e, 0x03, 0x4f, 0x87, 0x34, 0x9c, 0x5c, 0x55, 0x36, + 0x1e, 0x41, 0x3b, 0x25, 0x0a, 0x43, 0xef, 0x35, 0xfa, 0x6d, 0x27, 0x03, 0xf0, 0x87, 0xf8, 0xba, + 0xe1, 0xd2, 0x76, 0xdd, 0x80, 0x09, 0x91, 0x76, 0x11, 0x40, 0xfe, 0x0d, 0x67, 0xc1, 0xd9, 0xe4, + 0xe6, 0x24, 0xbc, 0x4a, 0x8a, 0xc9, 0xc5, 0x15, 0x15, 0x7c, 0xaa, 0x58, 0x28, 0x89, 0x0d, 0xa0, + 0x53, 0x6e, 0xd9, 0xb8, 0xa9, 0xac, 0xe1, 0x17, 0x80, 0x12, 0x2d, 0xbe, 0x1c, 0xb9, 0xa9, 0x92, + 0x05, 0x40, 0xf9, 0x32, 0x6f, 0x47, 0x41, 0xf0, 0x5b, 0x38, 0x50, 0x6d, 0xa8, 0xad, 0x18, 0x1e, + 0x66, 0xc4, 0xcd, 0xe5, 0x39, 0x0c, 0xff, 0xd5, 0xa1, 0x5b, 0x08, 0x51, 0xcc, 0x7d, 0x2e, 0x58, + 0x94, 0x22, 0x4d, 0x41, 0x79, 0xef, 0x8e, 0x93, 0x01, 0x35, 0x69, 0x3d, 0xa8, 0x4b, 0x0b, 0xf5, + 0x61, 0x4f, 0xa2, 0x0a, 0xb9, 0x21, 0xc9, 0x45, 0x78, 0xc3, 0xb4, 0xb3, 0xa9, 0x9b, 0x0a, 0x33, + 0x83, 0x91, 0x01, 0xdb, 0x62, 0x4e, 0x27, 0x6c, 0xe4, 0x1a, 0x2d, 0xc9, 0x48, 0x8f, 0xa8, 0x07, + 0xbb, 0xd1, 0x53, 0x3b, 0xf9, 0x3e, 0xf7, 0x02, 0x26, 0x8c, 0xad, 0x9e, 0xde, 0x6f, 0x38, 0x2a, + 0x84, 0xc7, 0x60, 0x56, 0x3d, 0xa0, 0x64, 0xf6, 0x67, 0xb0, 0x1d, 0x30, 0xb1, 0x98, 0x86, 0x71, + 0x68, 0xbb, 0x83, 0x27, 0xa4, 0x92, 0xe8, 0xa4, 0x34, 0x6c, 0xc7, 0x31, 0x2a, 0x0f, 0x21, 0x91, + 0xea, 0x40, 0xeb, 0xc2, 0x5f, 0x70, 0x37, 0x89, 0x30, 0x3e, 0x20, 0x04, 0xcd, 0xc8, 0x4d, 0x12, + 0x98, 0xfc, 0xce, 0x59, 0x2a, 0xeb, 0xd4, 0x58, 0x2a, 0x11, 0x37, 0x96, 0x06, 0x3f, 0x9b, 0xd0, + 0xb2, 0xf9, 0x92, 0x0b, 0x34, 0x84, 0xbd, 0x91, 0xc8, 0x0d, 0x80, 0xba, 0xa4, 0x6a, 0x75, 0xcc, + 0x9a, 0x39, 0xb1, 0x86, 0x3e, 0x43, 0x47, 0xba, 0x2b, 0x0a, 0x99, 0xa4, 0x76, 0x11, 0xcd, 0x43, + 0x52, 0x9f, 0x31, 0xd6, 0xd0, 0x7b, 0x78, 0xfc, 0x91, 0x85, 0xb9, 0x29, 0x12, 0x5f, 0xc5, 0x7d, + 0x32, 0x6b, 0x86, 0xc5, 0x1a, 0x72, 0xa0, 0x2b, 0x2f, 0x29, 0x29, 0x29, 0xc6, 0x4a, 0x72, 0x87, + 0xa4, 0x3e, 0x69, 0xac, 0xa1, 0x77, 0xf0, 0x28, 0x93, 0x8b, 0x36, 0x0a, 0xed, 0x93, 0xf2, 0x7e, + 0xdd, 0x61, 0x6a, 0x0c, 0xfb, 0x05, 0x53, 0x52, 0xc5, 0x20, 0x35, 0xab, 0xfa, 0x3f, 0x43, 0x9f, + 0xe0, 0xc0, 0x76, 0x67, 0x1e, 0x8f, 0xea, 0x0e, 0xbb, 0xf4, 0x44, 0xc8, 0x82, 0x33, 0xef, 0x92, + 0x33, 0x17, 0x99, 0x44, 0x05, 0x13, 0xbd, 0xb8, 0x66, 0x22, 0x72, 0x3a, 0x67, 0x01, 0x0d, 0x3d, + 0x9f, 0x67, 0x62, 0xc3, 0x57, 0xbf, 0x56, 0x96, 0x7e, 0xbb, 0xb2, 0xf4, 0x3f, 0x2b, 0x4b, 0xff, + 0xb1, 0xb6, 0xb4, 0xdb, 0xb5, 0xa5, 0xfd, 0x5e, 0x5b, 0xda, 0x97, 0xa3, 0xbb, 0x7e, 0xc3, 0xcf, + 0xb7, 0xe4, 0xbf, 0xe7, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc3, 0x04, 0xfe, 0x4d, 0x21, 0x06, + 0x00, 0x00, } func (m *NameAvailableRequest) Marshal() (dAtA []byte, err error) { @@ -314,6 +612,38 @@ func (m *NameAvailableRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *BatchNameAvailableRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BatchNameAvailableRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BatchNameAvailableRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FullNames) > 0 { + for iNdEx := len(m.FullNames) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.FullNames[iNdEx]) + copy(dAtA[i:], m.FullNames[iNdEx]) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.FullNames[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *NameByAddressRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -334,16 +664,110 @@ func (m *NameByAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.OwnerEthAddress) > 0 { - i -= len(m.OwnerEthAddress) - copy(dAtA[i:], m.OwnerEthAddress) - i = encodeVarintNameservice(dAtA, i, uint64(len(m.OwnerEthAddress))) + if len(m.OwnerScwEthAddress) > 0 { + i -= len(m.OwnerScwEthAddress) + copy(dAtA[i:], m.OwnerScwEthAddress) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.OwnerScwEthAddress))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } +func (m *BatchNameByAddressRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BatchNameByAddressRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BatchNameByAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OwnerScwEthAddresses) > 0 { + for iNdEx := len(m.OwnerScwEthAddresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.OwnerScwEthAddresses[iNdEx]) + copy(dAtA[i:], m.OwnerScwEthAddresses[iNdEx]) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.OwnerScwEthAddresses[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *NameByAnyIdRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NameByAnyIdRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NameByAnyIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AnyAddress) > 0 { + i -= len(m.AnyAddress) + copy(dAtA[i:], m.AnyAddress) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.AnyAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BatchNameByAnyIdRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BatchNameByAnyIdRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BatchNameByAnyIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AnyAddresses) > 0 { + for iNdEx := len(m.AnyAddresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.AnyAddresses[iNdEx]) + copy(dAtA[i:], m.AnyAddresses[iNdEx]) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.AnyAddresses[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *NameAvailableResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -367,27 +791,34 @@ func (m *NameAvailableResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.NameExpires != 0 { i = encodeVarintNameservice(dAtA, i, uint64(m.NameExpires)) i-- - dAtA[i] = 0x28 + dAtA[i] = 0x30 } if len(m.SpaceId) > 0 { i -= len(m.SpaceId) copy(dAtA[i:], m.SpaceId) i = encodeVarintNameservice(dAtA, i, uint64(len(m.SpaceId))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x2a } if len(m.OwnerAnyAddress) > 0 { i -= len(m.OwnerAnyAddress) copy(dAtA[i:], m.OwnerAnyAddress) i = encodeVarintNameservice(dAtA, i, uint64(len(m.OwnerAnyAddress))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } if len(m.OwnerEthAddress) > 0 { i -= len(m.OwnerEthAddress) copy(dAtA[i:], m.OwnerEthAddress) i = encodeVarintNameservice(dAtA, i, uint64(len(m.OwnerEthAddress))) i-- + dAtA[i] = 0x1a + } + if len(m.OwnerScwEthAddress) > 0 { + i -= len(m.OwnerScwEthAddress) + copy(dAtA[i:], m.OwnerScwEthAddress) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.OwnerScwEthAddress))) + i-- dAtA[i] = 0x12 } if m.Available { @@ -403,6 +834,43 @@ func (m *NameAvailableResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *BatchNameAvailableResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BatchNameAvailableResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BatchNameAvailableResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Results) > 0 { + for iNdEx := len(m.Results) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Results[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNameservice(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *NameByAddressResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -443,6 +911,43 @@ func (m *NameByAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *BatchNameByAddressResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BatchNameByAddressResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BatchNameByAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Results) > 0 { + for iNdEx := len(m.Results) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Results[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNameservice(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintNameservice(dAtA []byte, offset int, v uint64) int { offset -= sovNameservice(v) base := offset @@ -467,19 +972,77 @@ func (m *NameAvailableRequest) Size() (n int) { return n } +func (m *BatchNameAvailableRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.FullNames) > 0 { + for _, s := range m.FullNames { + l = len(s) + n += 1 + l + sovNameservice(uint64(l)) + } + } + return n +} + func (m *NameByAddressRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.OwnerEthAddress) + l = len(m.OwnerScwEthAddress) if l > 0 { n += 1 + l + sovNameservice(uint64(l)) } return n } +func (m *BatchNameByAddressRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.OwnerScwEthAddresses) > 0 { + for _, s := range m.OwnerScwEthAddresses { + l = len(s) + n += 1 + l + sovNameservice(uint64(l)) + } + } + return n +} + +func (m *NameByAnyIdRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AnyAddress) + if l > 0 { + n += 1 + l + sovNameservice(uint64(l)) + } + return n +} + +func (m *BatchNameByAnyIdRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.AnyAddresses) > 0 { + for _, s := range m.AnyAddresses { + l = len(s) + n += 1 + l + sovNameservice(uint64(l)) + } + } + return n +} + func (m *NameAvailableResponse) Size() (n int) { if m == nil { return 0 @@ -489,6 +1052,10 @@ func (m *NameAvailableResponse) Size() (n int) { if m.Available { n += 2 } + l = len(m.OwnerScwEthAddress) + if l > 0 { + n += 1 + l + sovNameservice(uint64(l)) + } l = len(m.OwnerEthAddress) if l > 0 { n += 1 + l + sovNameservice(uint64(l)) @@ -507,6 +1074,21 @@ func (m *NameAvailableResponse) Size() (n int) { return n } +func (m *BatchNameAvailableResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Results) > 0 { + for _, e := range m.Results { + l = e.Size() + n += 1 + l + sovNameservice(uint64(l)) + } + } + return n +} + func (m *NameByAddressResponse) Size() (n int) { if m == nil { return 0 @@ -523,6 +1105,21 @@ func (m *NameByAddressResponse) Size() (n int) { return n } +func (m *BatchNameByAddressResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Results) > 0 { + for _, e := range m.Results { + l = e.Size() + n += 1 + l + sovNameservice(uint64(l)) + } + } + return n +} + func sovNameservice(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -611,6 +1208,88 @@ func (m *NameAvailableRequest) Unmarshal(dAtA []byte) error { } return nil } +func (m *BatchNameAvailableRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BatchNameAvailableRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BatchNameAvailableRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FullNames", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FullNames = append(m.FullNames, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNameservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNameservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *NameByAddressRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -642,7 +1321,7 @@ func (m *NameByAddressRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerEthAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OwnerScwEthAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -670,7 +1349,253 @@ func (m *NameByAddressRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OwnerEthAddress = string(dAtA[iNdEx:postIndex]) + m.OwnerScwEthAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNameservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNameservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BatchNameByAddressRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BatchNameByAddressRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BatchNameByAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerScwEthAddresses", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerScwEthAddresses = append(m.OwnerScwEthAddresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNameservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNameservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NameByAnyIdRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NameByAnyIdRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NameByAnyIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AnyAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AnyAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNameservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNameservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BatchNameByAnyIdRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BatchNameByAnyIdRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BatchNameByAnyIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AnyAddresses", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AnyAddresses = append(m.AnyAddresses, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -743,6 +1668,38 @@ func (m *NameAvailableResponse) Unmarshal(dAtA []byte) error { } m.Available = bool(v != 0) case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerScwEthAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerScwEthAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field OwnerEthAddress", wireType) } @@ -774,7 +1731,7 @@ func (m *NameAvailableResponse) Unmarshal(dAtA []byte) error { } m.OwnerEthAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field OwnerAnyAddress", wireType) } @@ -806,7 +1763,7 @@ func (m *NameAvailableResponse) Unmarshal(dAtA []byte) error { } m.OwnerAnyAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SpaceId", wireType) } @@ -838,7 +1795,7 @@ func (m *NameAvailableResponse) Unmarshal(dAtA []byte) error { } m.SpaceId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NameExpires", wireType) } @@ -878,6 +1835,90 @@ func (m *NameAvailableResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *BatchNameAvailableResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BatchNameAvailableResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BatchNameAvailableResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Results", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Results = append(m.Results, &NameAvailableResponse{}) + if err := m.Results[len(m.Results)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNameservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNameservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *NameByAddressResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -980,6 +2021,90 @@ func (m *NameByAddressResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *BatchNameByAddressResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BatchNameByAddressResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BatchNameByAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Results", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Results = append(m.Results, &NameByAddressResponse{}) + if err := m.Results[len(m.Results)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNameservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNameservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipNameservice(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/nameservice/nameserviceproto/nameservice_aa.pb.go b/nameservice/nameserviceproto/nameservice_aa.pb.go index 7909dc16..ce0af1c2 100644 --- a/nameservice/nameserviceproto/nameservice_aa.pb.go +++ b/nameservice/nameserviceproto/nameservice_aa.pb.go @@ -470,7 +470,9 @@ type CreateUserOperationRequest struct { SignedData []byte `protobuf:"bytes,2,opt,name=signedData,proto3" json:"signedData,omitempty"` Context []byte `protobuf:"bytes,3,opt,name=context,proto3" json:"context,omitempty"` OwnerEthAddress string `protobuf:"bytes,4,opt,name=ownerEthAddress,proto3" json:"ownerEthAddress,omitempty"` - OwnerAnyID string `protobuf:"bytes,5,opt,name=ownerAnyID,proto3" json:"ownerAnyID,omitempty"` + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() + OwnerAnyID string `protobuf:"bytes,5,opt,name=ownerAnyID,proto3" json:"ownerAnyID,omitempty"` // all operations currently are towards single name, please specify it // we can use it for caching, etc purps. FullName string `protobuf:"bytes,6,opt,name=fullName,proto3" json:"fullName,omitempty"` @@ -608,11 +610,17 @@ func (m *CreateUserOperationRequestSigned) GetSignature() []byte { type NameRegisterRequest struct { FullName string `protobuf:"bytes,1,opt,name=fullName,proto3" json:"fullName,omitempty"` // A content hash attached to this name + // This should not be empty! + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() OwnerAnyAddress string `protobuf:"bytes,2,opt,name=ownerAnyAddress,proto3" json:"ownerAnyAddress,omitempty"` // An Ethereum address that owns that name OwnerEthAddress string `protobuf:"bytes,3,opt,name=ownerEthAddress,proto3" json:"ownerEthAddress,omitempty"` - // A SpaceID attached to this name - SpaceId string `protobuf:"bytes,4,opt,name=spaceId,proto3" json:"spaceId,omitempty"` + // if false -> name ownership will belong to ownerEthAddress + // if true -> name ownership will belong to SCW of ownerEthAddress (AccountAbstraction) + RegisterToSmartContractWallet bool `protobuf:"varint,4,opt,name=registerToSmartContractWallet,proto3" json:"registerToSmartContractWallet,omitempty"` + // How many months to register the name for + RegisterPeriodMonths uint32 `protobuf:"varint,5,opt,name=registerPeriodMonths,proto3" json:"registerPeriodMonths,omitempty"` } func (m *NameRegisterRequest) Reset() { *m = NameRegisterRequest{} } @@ -669,13 +677,157 @@ func (m *NameRegisterRequest) GetOwnerEthAddress() string { return "" } -func (m *NameRegisterRequest) GetSpaceId() string { +func (m *NameRegisterRequest) GetRegisterToSmartContractWallet() bool { + if m != nil { + return m.RegisterToSmartContractWallet + } + return false +} + +func (m *NameRegisterRequest) GetRegisterPeriodMonths() uint32 { + if m != nil { + return m.RegisterPeriodMonths + } + return 0 +} + +type NameRegisterRequestSigned struct { + // NameRegisterRequest struct + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + // payload signed by payload.ownerEthAddress + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (m *NameRegisterRequestSigned) Reset() { *m = NameRegisterRequestSigned{} } +func (m *NameRegisterRequestSigned) String() string { return proto.CompactTextString(m) } +func (*NameRegisterRequestSigned) ProtoMessage() {} +func (*NameRegisterRequestSigned) Descriptor() ([]byte, []int) { + return fileDescriptor_c9d3f9b8b141e804, []int{10} +} +func (m *NameRegisterRequestSigned) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NameRegisterRequestSigned) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NameRegisterRequestSigned.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *NameRegisterRequestSigned) XXX_Merge(src proto.Message) { + xxx_messageInfo_NameRegisterRequestSigned.Merge(m, src) +} +func (m *NameRegisterRequestSigned) XXX_Size() int { + return m.Size() +} +func (m *NameRegisterRequestSigned) XXX_DiscardUnknown() { + xxx_messageInfo_NameRegisterRequestSigned.DiscardUnknown(m) +} + +var xxx_messageInfo_NameRegisterRequestSigned proto.InternalMessageInfo + +func (m *NameRegisterRequestSigned) GetPayload() []byte { + if m != nil { + return m.Payload + } + return nil +} + +func (m *NameRegisterRequestSigned) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +type NameRegisterForSpaceRequest struct { + FullName string `protobuf:"bytes,1,opt,name=fullName,proto3" json:"fullName,omitempty"` + // A content hash attached to this name + // This should not be empty! + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() + OwnerAnyAddress string `protobuf:"bytes,2,opt,name=ownerAnyAddress,proto3" json:"ownerAnyAddress,omitempty"` + // An Ethereum address that owns that name + OwnerEthAddress string `protobuf:"bytes,3,opt,name=ownerEthAddress,proto3" json:"ownerEthAddress,omitempty"` + // A SpaceID attached to this name + SpaceId string `protobuf:"bytes,4,opt,name=spaceId,proto3" json:"spaceId,omitempty"` + // How many months to register the name for + RegisterPeriodMonths uint32 `protobuf:"varint,5,opt,name=registerPeriodMonths,proto3" json:"registerPeriodMonths,omitempty"` +} + +func (m *NameRegisterForSpaceRequest) Reset() { *m = NameRegisterForSpaceRequest{} } +func (m *NameRegisterForSpaceRequest) String() string { return proto.CompactTextString(m) } +func (*NameRegisterForSpaceRequest) ProtoMessage() {} +func (*NameRegisterForSpaceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c9d3f9b8b141e804, []int{11} +} +func (m *NameRegisterForSpaceRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NameRegisterForSpaceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NameRegisterForSpaceRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *NameRegisterForSpaceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_NameRegisterForSpaceRequest.Merge(m, src) +} +func (m *NameRegisterForSpaceRequest) XXX_Size() int { + return m.Size() +} +func (m *NameRegisterForSpaceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_NameRegisterForSpaceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_NameRegisterForSpaceRequest proto.InternalMessageInfo + +func (m *NameRegisterForSpaceRequest) GetFullName() string { + if m != nil { + return m.FullName + } + return "" +} + +func (m *NameRegisterForSpaceRequest) GetOwnerAnyAddress() string { + if m != nil { + return m.OwnerAnyAddress + } + return "" +} + +func (m *NameRegisterForSpaceRequest) GetOwnerEthAddress() string { + if m != nil { + return m.OwnerEthAddress + } + return "" +} + +func (m *NameRegisterForSpaceRequest) GetSpaceId() string { if m != nil { return m.SpaceId } return "" } +func (m *NameRegisterForSpaceRequest) GetRegisterPeriodMonths() uint32 { + if m != nil { + return m.RegisterPeriodMonths + } + return 0 +} + type GetOperationStatusRequest struct { OperationId string `protobuf:"bytes,1,opt,name=operationId,proto3" json:"operationId,omitempty"` } @@ -684,7 +836,7 @@ func (m *GetOperationStatusRequest) Reset() { *m = GetOperationStatusReq func (m *GetOperationStatusRequest) String() string { return proto.CompactTextString(m) } func (*GetOperationStatusRequest) ProtoMessage() {} func (*GetOperationStatusRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_c9d3f9b8b141e804, []int{10} + return fileDescriptor_c9d3f9b8b141e804, []int{12} } func (m *GetOperationStatusRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -729,7 +881,7 @@ func (m *OperationResponse) Reset() { *m = OperationResponse{} } func (m *OperationResponse) String() string { return proto.CompactTextString(m) } func (*OperationResponse) ProtoMessage() {} func (*OperationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c9d3f9b8b141e804, []int{11} + return fileDescriptor_c9d3f9b8b141e804, []int{13} } func (m *OperationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -784,6 +936,8 @@ func init() { proto.RegisterType((*CreateUserOperationRequest)(nil), "CreateUserOperationRequest") proto.RegisterType((*CreateUserOperationRequestSigned)(nil), "CreateUserOperationRequestSigned") proto.RegisterType((*NameRegisterRequest)(nil), "NameRegisterRequest") + proto.RegisterType((*NameRegisterRequestSigned)(nil), "NameRegisterRequestSigned") + proto.RegisterType((*NameRegisterForSpaceRequest)(nil), "NameRegisterForSpaceRequest") proto.RegisterType((*GetOperationStatusRequest)(nil), "GetOperationStatusRequest") proto.RegisterType((*OperationResponse)(nil), "OperationResponse") } @@ -793,54 +947,59 @@ func init() { } var fileDescriptor_c9d3f9b8b141e804 = []byte{ - // 747 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x5d, 0x4f, 0x13, 0x4d, - 0x14, 0xee, 0xd2, 0xf2, 0xd1, 0x43, 0xdf, 0x52, 0xa6, 0xc0, 0xdb, 0xb7, 0xf0, 0xae, 0x65, 0x35, - 0xa6, 0xf1, 0x62, 0x31, 0x98, 0x28, 0x37, 0x26, 0xae, 0x05, 0x2a, 0xc1, 0x00, 0x59, 0x24, 0x26, - 0x10, 0x63, 0x86, 0xee, 0xa1, 0x36, 0xb6, 0x33, 0x75, 0x67, 0x2a, 0xf6, 0x5f, 0x98, 0xf8, 0x03, - 0xbc, 0xf0, 0xcf, 0x78, 0xc9, 0xa5, 0xf1, 0xca, 0xc0, 0x1f, 0x31, 0x3b, 0x6c, 0x97, 0xdd, 0xb2, - 0x6d, 0x51, 0x6e, 0x60, 0xcf, 0xb3, 0x67, 0xce, 0x79, 0x9e, 0xe7, 0xec, 0x9c, 0x14, 0xd6, 0x18, - 0x6d, 0xa1, 0x40, 0xf7, 0x63, 0xa3, 0x86, 0x2b, 0xa1, 0xe7, 0xb6, 0xcb, 0x25, 0x5f, 0x51, 0x7f, - 0x45, 0x18, 0x7f, 0x4b, 0xa9, 0xa9, 0x50, 0xe3, 0xdb, 0x18, 0x4c, 0x1f, 0x08, 0x74, 0xad, 0x5a, - 0x8d, 0x77, 0x98, 0x24, 0x65, 0x98, 0xe1, 0xa7, 0x0c, 0xdd, 0x0d, 0xf9, 0xce, 0x72, 0x1c, 0x17, - 0x85, 0x28, 0x68, 0x25, 0xad, 0x9c, 0xb6, 0xfb, 0x61, 0xb2, 0x09, 0xba, 0x82, 0xf6, 0x5b, 0xd4, - 0x95, 0x15, 0xce, 0xa4, 0x4b, 0x6b, 0xaf, 0x69, 0xb3, 0x89, 0xb2, 0x77, 0x70, 0x4c, 0x1d, 0x1c, - 0x91, 0x45, 0x5e, 0xc0, 0x9d, 0x01, 0x19, 0xeb, 0xd8, 0x6e, 0xf2, 0x2e, 0x3a, 0x85, 0x64, 0x49, - 0x2b, 0x4f, 0xd9, 0xa3, 0xd2, 0xc8, 0x7d, 0xc8, 0x2a, 0x8d, 0x15, 0x4f, 0xc9, 0x4b, 0x3c, 0x91, - 0x85, 0x54, 0x49, 0x2b, 0xa7, 0xec, 0x3e, 0x94, 0x3c, 0x84, 0x3c, 0x6f, 0xa3, 0x4b, 0x65, 0x83, - 0xb3, 0x50, 0xf2, 0xb8, 0x4a, 0x8e, 0x7b, 0x65, 0xd4, 0x61, 0xd1, 0x72, 0x5a, 0x0d, 0xb6, 0xd9, - 0x61, 0x4e, 0xc8, 0x2d, 0x1b, 0x3f, 0x74, 0x50, 0xfc, 0x89, 0x69, 0x3a, 0xc0, 0x15, 0x19, 0x65, - 0x50, 0xca, 0x0e, 0x21, 0xc6, 0x11, 0x2c, 0x0f, 0x69, 0xb4, 0xdf, 0xa8, 0x33, 0x74, 0x48, 0x01, - 0x26, 0xdb, 0xb4, 0xdb, 0xe4, 0xd4, 0x51, 0x6d, 0x32, 0x76, 0x2f, 0x24, 0x4b, 0x90, 0x16, 0x8d, - 0x3a, 0xa3, 0xb2, 0xe3, 0xa2, 0xaa, 0x9e, 0xb1, 0xaf, 0x00, 0xe3, 0x8b, 0x06, 0xff, 0x07, 0xd5, - 0xab, 0x54, 0xec, 0x06, 0x4a, 0xff, 0x4a, 0x88, 0x82, 0x2c, 0xd6, 0xdd, 0x5a, 0xf7, 0x27, 0x1d, - 0x42, 0x54, 0xa5, 0xa8, 0x91, 0x6a, 0x8a, 0x29, 0xbb, 0x1f, 0x36, 0xde, 0xc0, 0xdd, 0xa1, 0xa4, - 0x6e, 0x29, 0xda, 0x82, 0xf9, 0x2a, 0xca, 0xdb, 0x0c, 0xcd, 0xd8, 0x86, 0xc5, 0x2a, 0xca, 0x75, - 0x2a, 0xe9, 0x0e, 0x6d, 0xa1, 0x8d, 0xf5, 0x86, 0x90, 0xe8, 0xda, 0x28, 0xda, 0x9c, 0x09, 0x24, - 0x04, 0x52, 0x0e, 0x95, 0xd4, 0xa7, 0xa5, 0x9e, 0x3d, 0xb6, 0x35, 0xce, 0x24, 0x7e, 0x92, 0x3e, - 0xa3, 0x5e, 0x68, 0x9c, 0x69, 0x50, 0xac, 0xb8, 0x48, 0x25, 0x7a, 0x9c, 0x02, 0xb5, 0x3d, 0x56, - 0x71, 0xc5, 0x74, 0x00, 0xa1, 0x4c, 0xf0, 0x28, 0xf8, 0xf5, 0x42, 0x48, 0xb8, 0x59, 0x32, 0xd2, - 0x2c, 0x4e, 0x63, 0xea, 0x26, 0xf3, 0x1c, 0xbf, 0x36, 0xcf, 0x22, 0x4c, 0x9d, 0x74, 0x9a, 0x4d, - 0xcf, 0x80, 0xc2, 0x84, 0x7a, 0x1b, 0xc4, 0xc6, 0x21, 0x94, 0x06, 0x2b, 0xba, 0xe5, 0xf8, 0xbe, - 0x6a, 0x90, 0x8f, 0xba, 0x7e, 0xe9, 0x53, 0x98, 0x8f, 0x16, 0xe5, 0x13, 0xa8, 0xb6, 0x58, 0x37, - 0xba, 0x8a, 0xfa, 0xe1, 0x38, 0x7f, 0x92, 0xf1, 0xfe, 0x14, 0x60, 0x52, 0xb4, 0x69, 0x0d, 0xb7, - 0x1c, 0xdf, 0xc1, 0x5e, 0x68, 0x3c, 0x85, 0xff, 0xaa, 0x28, 0x03, 0xd9, 0xfb, 0x92, 0xca, 0x4e, - 0x70, 0xa1, 0x4a, 0x30, 0x1d, 0x7c, 0xef, 0x5b, 0x8e, 0xcf, 0x34, 0x0c, 0x19, 0x0c, 0x66, 0x43, - 0x96, 0xf9, 0x9f, 0xd4, 0xc8, 0x63, 0xe4, 0x09, 0x64, 0x79, 0xb8, 0xe5, 0xa5, 0x75, 0xd9, 0xd5, - 0x19, 0x33, 0xc2, 0x04, 0xed, 0xbe, 0xb4, 0x07, 0x47, 0x90, 0x8d, 0x66, 0x90, 0x69, 0x98, 0x3c, - 0x60, 0xef, 0x19, 0x3f, 0x65, 0xb9, 0x84, 0x17, 0xec, 0x21, 0x73, 0x1a, 0xac, 0x9e, 0xd3, 0xc8, - 0x3c, 0xcc, 0xfa, 0xc1, 0xae, 0xbb, 0xc3, 0xe5, 0x26, 0xef, 0x30, 0x27, 0x37, 0x46, 0xfe, 0x81, - 0x74, 0x85, 0xb7, 0xda, 0x4d, 0x94, 0xe8, 0xe4, 0x92, 0x24, 0x0d, 0xe3, 0x1b, 0xae, 0xcb, 0xdd, - 0x5c, 0x6a, 0xf5, 0x67, 0x12, 0xfe, 0xb5, 0x58, 0x97, 0x09, 0xff, 0xae, 0x59, 0xc7, 0xc2, 0xdb, - 0xd3, 0x5e, 0x2f, 0xf2, 0x0c, 0x32, 0x61, 0x9f, 0x48, 0xd1, 0x1c, 0x68, 0x5b, 0x91, 0x98, 0xd7, - 0x3c, 0x31, 0x12, 0x64, 0x0f, 0xe6, 0xe2, 0x96, 0x23, 0x31, 0xcc, 0x91, 0x3b, 0x73, 0x40, 0xc5, - 0x57, 0xb0, 0x10, 0xbf, 0x7b, 0xc8, 0x3d, 0xf3, 0x06, 0x4b, 0x69, 0x40, 0xd5, 0x35, 0xc8, 0x46, - 0x57, 0x0e, 0x59, 0x30, 0x63, 0x77, 0x50, 0x31, 0x63, 0x86, 0x40, 0x23, 0x41, 0xb6, 0x21, 0x1f, - 0xb3, 0x69, 0xc8, 0x9c, 0x19, 0x73, 0x05, 0x8a, 0x4b, 0xe6, 0x90, 0xad, 0x64, 0x24, 0xc8, 0x0e, - 0xe4, 0x63, 0xae, 0x25, 0x59, 0x36, 0x47, 0x5d, 0xd6, 0x78, 0x59, 0xcf, 0x1f, 0x7f, 0x3f, 0xd7, - 0xb5, 0xb3, 0x73, 0x5d, 0xfb, 0x75, 0xae, 0x6b, 0x9f, 0x2f, 0xf4, 0xc4, 0xd9, 0x85, 0x9e, 0xf8, - 0x71, 0xa1, 0x27, 0x0e, 0x97, 0x86, 0xfd, 0xfc, 0x38, 0x9e, 0x50, 0xff, 0x1e, 0xfd, 0x0e, 0x00, - 0x00, 0xff, 0xff, 0xb6, 0xa8, 0xb9, 0x6c, 0xa5, 0x08, 0x00, 0x00, + // 831 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x51, 0x6f, 0x1b, 0x45, + 0x10, 0xf6, 0xc5, 0x97, 0x26, 0x9e, 0xb8, 0xae, 0xbb, 0x4e, 0x8b, 0xeb, 0xb8, 0x87, 0x7b, 0x20, + 0x64, 0xf1, 0x70, 0x45, 0x41, 0x82, 0xbe, 0x20, 0x71, 0xd8, 0xb5, 0x89, 0x0a, 0x69, 0x74, 0x6e, + 0x85, 0xd4, 0x08, 0xa1, 0xad, 0x6f, 0xea, 0x9e, 0xb0, 0x77, 0xcd, 0xee, 0x9a, 0xe2, 0x7f, 0x81, + 0xc4, 0x4f, 0xe0, 0x47, 0xf0, 0x17, 0x78, 0xcc, 0x23, 0x12, 0x2f, 0x28, 0xf9, 0x21, 0x20, 0x6f, + 0xce, 0xd7, 0x3d, 0xf7, 0x6c, 0x97, 0xf8, 0xa1, 0x2f, 0xc9, 0xcd, 0x77, 0x73, 0x33, 0xdf, 0x7c, + 0xb3, 0x3b, 0x63, 0x78, 0xc0, 0xe8, 0x08, 0x25, 0x8a, 0x9f, 0xa3, 0x3e, 0xde, 0x37, 0x9e, 0xc7, + 0x82, 0x2b, 0x7e, 0x5f, 0xff, 0x95, 0x26, 0xfe, 0x03, 0xa5, 0x9e, 0x46, 0xdd, 0xdf, 0xb7, 0x60, + 0xef, 0xa9, 0x44, 0xe1, 0xf7, 0xfb, 0x7c, 0xc2, 0x14, 0x69, 0xc2, 0x0d, 0xfe, 0x8a, 0xa1, 0x78, + 0xa8, 0x5e, 0xfa, 0x61, 0x28, 0x50, 0xca, 0xaa, 0xd5, 0xb0, 0x9a, 0x85, 0x60, 0x11, 0x26, 0x1d, + 0x70, 0x34, 0xd4, 0x1b, 0x51, 0xa1, 0x5a, 0x9c, 0x29, 0x41, 0xfb, 0xdf, 0xd1, 0xe1, 0x10, 0xd5, + 0xfc, 0xc3, 0x2d, 0xfd, 0xe1, 0x1a, 0x2f, 0xf2, 0x35, 0xbc, 0xbf, 0xc4, 0xa3, 0x8d, 0xe3, 0x21, + 0x9f, 0x62, 0x58, 0xcd, 0x37, 0xac, 0xe6, 0x6e, 0xb0, 0xce, 0x8d, 0x7c, 0x04, 0x25, 0x5d, 0x63, + 0x6b, 0x56, 0xc9, 0x37, 0xf8, 0x42, 0x55, 0xed, 0x86, 0xd5, 0xb4, 0x83, 0x05, 0x94, 0x7c, 0x02, + 0x15, 0x3e, 0x46, 0x41, 0x55, 0xc4, 0x99, 0xe1, 0xbc, 0xad, 0x9d, 0xb3, 0x5e, 0xb9, 0x03, 0x38, + 0xf0, 0xc3, 0x51, 0xc4, 0x3a, 0x13, 0x16, 0x1a, 0x6a, 0x05, 0xf8, 0xd3, 0x04, 0xe5, 0xff, 0x11, + 0xcd, 0x01, 0x78, 0x4d, 0x46, 0x0b, 0x64, 0x07, 0x06, 0xe2, 0x9e, 0xc2, 0xbd, 0x15, 0x89, 0x7a, + 0xd1, 0x80, 0x61, 0x48, 0xaa, 0xb0, 0x33, 0xa6, 0xd3, 0x21, 0xa7, 0xa1, 0x4e, 0x53, 0x0c, 0xe6, + 0x26, 0xa9, 0x43, 0x41, 0x46, 0x03, 0x46, 0xd5, 0x44, 0xa0, 0x8e, 0x5e, 0x0c, 0x5e, 0x03, 0xee, + 0x6f, 0x16, 0xdc, 0x4d, 0xa2, 0x77, 0xa9, 0x7c, 0x9c, 0x54, 0x7a, 0xa5, 0x42, 0x34, 0xe4, 0xb3, + 0xe9, 0x51, 0x3b, 0xee, 0xb4, 0x81, 0xe8, 0x48, 0x69, 0x21, 0x75, 0x17, 0xed, 0x60, 0x11, 0x76, + 0xbf, 0x87, 0x0f, 0x56, 0x92, 0xda, 0xb0, 0x68, 0x1f, 0x6e, 0x75, 0x51, 0x6d, 0xd2, 0x34, 0xf7, + 0x11, 0x1c, 0x74, 0x51, 0xb5, 0xa9, 0xa2, 0xc7, 0x74, 0x84, 0x01, 0x0e, 0x22, 0xa9, 0x50, 0x04, + 0x28, 0xc7, 0x9c, 0x49, 0x24, 0x04, 0xec, 0x90, 0x2a, 0x1a, 0xd3, 0xd2, 0xcf, 0x33, 0xb6, 0x7d, + 0xce, 0x14, 0xfe, 0xa2, 0x62, 0x46, 0x73, 0xd3, 0x3d, 0xb3, 0xa0, 0xd6, 0x12, 0x48, 0x15, 0xce, + 0x38, 0x25, 0xd5, 0xce, 0x59, 0x65, 0x05, 0x73, 0x00, 0xa4, 0x16, 0x61, 0x46, 0x21, 0x8e, 0x67, + 0x20, 0x66, 0xb2, 0x7c, 0x2a, 0x59, 0x56, 0x8d, 0xf6, 0xdb, 0xf4, 0x73, 0xfb, 0x8d, 0x7e, 0xd6, + 0x60, 0xf7, 0xc5, 0x64, 0x38, 0x9c, 0x09, 0x50, 0xbd, 0xa6, 0xdf, 0x26, 0xb6, 0xfb, 0x0c, 0x1a, + 0xcb, 0x2b, 0xda, 0xb0, 0x7d, 0xff, 0x5a, 0x50, 0x49, 0xab, 0x7e, 0xa9, 0x93, 0xc9, 0xc7, 0x4a, + 0xf3, 0x49, 0xaa, 0xf6, 0xd9, 0x34, 0x3d, 0x8a, 0x16, 0xe1, 0x2c, 0x7d, 0xf2, 0xd9, 0xfa, 0xb4, + 0xe1, 0xae, 0x88, 0x29, 0x3c, 0xe1, 0xe6, 0x0c, 0x52, 0x97, 0x43, 0x48, 0xeb, 0xba, 0x1b, 0xac, + 0x76, 0x22, 0x87, 0xb0, 0x3f, 0x77, 0x38, 0x41, 0x11, 0xf1, 0xf0, 0x5b, 0xce, 0xd4, 0x4b, 0xa9, + 0xf5, 0xbe, 0x1e, 0x64, 0xbe, 0x73, 0x7b, 0x70, 0x27, 0x43, 0x80, 0x0d, 0x65, 0xfd, 0xdb, 0x82, + 0x03, 0x33, 0x6a, 0x87, 0x8b, 0xde, 0x98, 0xf6, 0xf1, 0x5d, 0xc9, 0x5b, 0x85, 0x1d, 0x39, 0xcb, + 0x7f, 0x14, 0xc6, 0x07, 0x74, 0x6e, 0x5e, 0x49, 0xb2, 0x2f, 0xe0, 0x4e, 0x17, 0x55, 0x72, 0x12, + 0x7b, 0x8a, 0xaa, 0x49, 0x32, 0xe3, 0x1a, 0xb0, 0x97, 0x8c, 0xa0, 0xa3, 0x30, 0xae, 0xce, 0x84, + 0x5c, 0x06, 0x37, 0x8d, 0x53, 0x1c, 0xdf, 0xf2, 0xb5, 0x9f, 0x91, 0xcf, 0xa1, 0xc4, 0xcd, 0x94, + 0x97, 0xb2, 0x97, 0x0e, 0x6f, 0x78, 0x29, 0x26, 0x18, 0x2c, 0xb8, 0x7d, 0x7c, 0x0a, 0xa5, 0xb4, + 0x07, 0xd9, 0x83, 0x9d, 0xa7, 0xec, 0x47, 0xc6, 0x5f, 0xb1, 0x72, 0x6e, 0x66, 0x9c, 0x20, 0x0b, + 0x23, 0x36, 0x28, 0x5b, 0xe4, 0x16, 0xdc, 0x8c, 0x8d, 0xc7, 0xe2, 0x98, 0xab, 0x0e, 0x9f, 0xb0, + 0xb0, 0xbc, 0x45, 0xae, 0x43, 0xa1, 0xc5, 0x47, 0xe3, 0x21, 0x2a, 0x0c, 0xcb, 0x79, 0x52, 0x80, + 0xed, 0x87, 0x42, 0x70, 0x51, 0xb6, 0x0f, 0xff, 0xb0, 0xe1, 0x3d, 0x9f, 0x4d, 0x99, 0x8c, 0xc7, + 0x9f, 0xff, 0x5c, 0xea, 0x13, 0x19, 0x71, 0x46, 0xbe, 0x84, 0xa2, 0xa9, 0x13, 0xa9, 0x79, 0x4b, + 0x65, 0xab, 0x11, 0xef, 0x0d, 0x4d, 0xdc, 0x1c, 0x39, 0x81, 0xfd, 0xac, 0x7d, 0x45, 0x5c, 0x6f, + 0xed, 0x1a, 0x5b, 0x12, 0xf1, 0x09, 0xdc, 0xce, 0x5e, 0x07, 0xe4, 0x43, 0xef, 0x2d, 0xf6, 0xc4, + 0x92, 0xa8, 0x0f, 0xa0, 0x94, 0xde, 0x02, 0xe4, 0xb6, 0x97, 0xb9, 0x16, 0x6a, 0x45, 0xcf, 0x00, + 0xdd, 0x1c, 0x79, 0x04, 0x95, 0x8c, 0xe1, 0x4f, 0xf6, 0xbd, 0x8c, 0x4b, 0x59, 0xab, 0x7b, 0x2b, + 0x16, 0x85, 0x9b, 0x23, 0xa7, 0x99, 0x9b, 0x64, 0x7e, 0xf9, 0x48, 0xdd, 0x5b, 0x71, 0x27, 0xd7, + 0x06, 0x3f, 0x86, 0x4a, 0xc6, 0x18, 0x26, 0xf7, 0xbc, 0x75, 0xc3, 0x39, 0x5b, 0xb3, 0xaf, 0x3e, + 0xfb, 0xf3, 0xdc, 0xb1, 0xce, 0xce, 0x1d, 0xeb, 0x9f, 0x73, 0xc7, 0xfa, 0xf5, 0xc2, 0xc9, 0x9d, + 0x5d, 0x38, 0xb9, 0xbf, 0x2e, 0x9c, 0xdc, 0xb3, 0xfa, 0xaa, 0x9f, 0x9b, 0xcf, 0xaf, 0xe9, 0x7f, + 0x9f, 0xfe, 0x17, 0x00, 0x00, 0xff, 0xff, 0xe2, 0x3c, 0xfb, 0x3d, 0x95, 0x0a, 0x00, 0x00, } func (m *UserAccount) Marshal() (dAtA []byte, err error) { @@ -1240,6 +1399,107 @@ func (m *NameRegisterRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.RegisterPeriodMonths != 0 { + i = encodeVarintNameserviceAa(dAtA, i, uint64(m.RegisterPeriodMonths)) + i-- + dAtA[i] = 0x28 + } + if m.RegisterToSmartContractWallet { + i-- + if m.RegisterToSmartContractWallet { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if len(m.OwnerEthAddress) > 0 { + i -= len(m.OwnerEthAddress) + copy(dAtA[i:], m.OwnerEthAddress) + i = encodeVarintNameserviceAa(dAtA, i, uint64(len(m.OwnerEthAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.OwnerAnyAddress) > 0 { + i -= len(m.OwnerAnyAddress) + copy(dAtA[i:], m.OwnerAnyAddress) + i = encodeVarintNameserviceAa(dAtA, i, uint64(len(m.OwnerAnyAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.FullName) > 0 { + i -= len(m.FullName) + copy(dAtA[i:], m.FullName) + i = encodeVarintNameserviceAa(dAtA, i, uint64(len(m.FullName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NameRegisterRequestSigned) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NameRegisterRequestSigned) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NameRegisterRequestSigned) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintNameserviceAa(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintNameserviceAa(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NameRegisterForSpaceRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NameRegisterForSpaceRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NameRegisterForSpaceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RegisterPeriodMonths != 0 { + i = encodeVarintNameserviceAa(dAtA, i, uint64(m.RegisterPeriodMonths)) + i-- + dAtA[i] = 0x28 + } if len(m.SpaceId) > 0 { i -= len(m.SpaceId) copy(dAtA[i:], m.SpaceId) @@ -1524,6 +1784,50 @@ func (m *CreateUserOperationRequestSigned) Size() (n int) { } func (m *NameRegisterRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FullName) + if l > 0 { + n += 1 + l + sovNameserviceAa(uint64(l)) + } + l = len(m.OwnerAnyAddress) + if l > 0 { + n += 1 + l + sovNameserviceAa(uint64(l)) + } + l = len(m.OwnerEthAddress) + if l > 0 { + n += 1 + l + sovNameserviceAa(uint64(l)) + } + if m.RegisterToSmartContractWallet { + n += 2 + } + if m.RegisterPeriodMonths != 0 { + n += 1 + sovNameserviceAa(uint64(m.RegisterPeriodMonths)) + } + return n +} + +func (m *NameRegisterRequestSigned) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovNameserviceAa(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovNameserviceAa(uint64(l)) + } + return n +} + +func (m *NameRegisterForSpaceRequest) Size() (n int) { if m == nil { return 0 } @@ -1545,6 +1849,9 @@ func (m *NameRegisterRequest) Size() (n int) { if l > 0 { n += 1 + l + sovNameserviceAa(uint64(l)) } + if m.RegisterPeriodMonths != 0 { + n += 1 + sovNameserviceAa(uint64(m.RegisterPeriodMonths)) + } return n } @@ -2820,6 +3127,309 @@ func (m *NameRegisterRequest) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: NameRegisterRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FullName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameserviceAa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNameserviceAa + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameserviceAa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FullName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAnyAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameserviceAa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNameserviceAa + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameserviceAa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAnyAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerEthAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameserviceAa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNameserviceAa + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameserviceAa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerEthAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RegisterToSmartContractWallet", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameserviceAa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RegisterToSmartContractWallet = bool(v != 0) + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RegisterPeriodMonths", wireType) + } + m.RegisterPeriodMonths = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameserviceAa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RegisterPeriodMonths |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipNameserviceAa(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNameserviceAa + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NameRegisterRequestSigned) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameserviceAa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NameRegisterRequestSigned: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NameRegisterRequestSigned: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameserviceAa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthNameserviceAa + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthNameserviceAa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) + if m.Payload == nil { + m.Payload = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameserviceAa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthNameserviceAa + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthNameserviceAa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNameserviceAa(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNameserviceAa + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NameRegisterForSpaceRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameserviceAa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NameRegisterForSpaceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NameRegisterForSpaceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field FullName", wireType) @@ -2948,6 +3558,25 @@ func (m *NameRegisterRequest) Unmarshal(dAtA []byte) error { } m.SpaceId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RegisterPeriodMonths", wireType) + } + m.RegisterPeriodMonths = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameserviceAa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RegisterPeriodMonths |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipNameserviceAa(dAtA[iNdEx:]) diff --git a/nameservice/nameserviceproto/nameservice_aa_drpc.pb.go b/nameservice/nameserviceproto/nameservice_aa_drpc.pb.go index 36fdb1da..cc3651e2 100644 --- a/nameservice/nameserviceproto/nameservice_aa_drpc.pb.go +++ b/nameservice/nameserviceproto/nameservice_aa_drpc.pb.go @@ -45,6 +45,7 @@ type DRPCAnynsAccountAbstractionClient interface { AdminFundGasOperations(ctx context.Context, in *AdminFundGasOperationsRequestSigned) (*OperationResponse, error) GetUserAccount(ctx context.Context, in *GetUserAccountRequest) (*UserAccount, error) GetDataNameRegister(ctx context.Context, in *NameRegisterRequest) (*GetDataNameRegisterResponse, error) + GetDataNameRegisterForSpace(ctx context.Context, in *NameRegisterForSpaceRequest) (*GetDataNameRegisterResponse, error) CreateUserOperation(ctx context.Context, in *CreateUserOperationRequestSigned) (*OperationResponse, error) } @@ -103,6 +104,15 @@ func (c *drpcAnynsAccountAbstractionClient) GetDataNameRegister(ctx context.Cont return out, nil } +func (c *drpcAnynsAccountAbstractionClient) GetDataNameRegisterForSpace(ctx context.Context, in *NameRegisterForSpaceRequest) (*GetDataNameRegisterResponse, error) { + out := new(GetDataNameRegisterResponse) + err := c.cc.Invoke(ctx, "/AnynsAccountAbstraction/GetDataNameRegisterForSpace", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + func (c *drpcAnynsAccountAbstractionClient) CreateUserOperation(ctx context.Context, in *CreateUserOperationRequestSigned) (*OperationResponse, error) { out := new(OperationResponse) err := c.cc.Invoke(ctx, "/AnynsAccountAbstraction/CreateUserOperation", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{}, in, out) @@ -118,6 +128,7 @@ type DRPCAnynsAccountAbstractionServer interface { AdminFundGasOperations(context.Context, *AdminFundGasOperationsRequestSigned) (*OperationResponse, error) GetUserAccount(context.Context, *GetUserAccountRequest) (*UserAccount, error) GetDataNameRegister(context.Context, *NameRegisterRequest) (*GetDataNameRegisterResponse, error) + GetDataNameRegisterForSpace(context.Context, *NameRegisterForSpaceRequest) (*GetDataNameRegisterResponse, error) CreateUserOperation(context.Context, *CreateUserOperationRequestSigned) (*OperationResponse, error) } @@ -143,13 +154,17 @@ func (s *DRPCAnynsAccountAbstractionUnimplementedServer) GetDataNameRegister(con return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } +func (s *DRPCAnynsAccountAbstractionUnimplementedServer) GetDataNameRegisterForSpace(context.Context, *NameRegisterForSpaceRequest) (*GetDataNameRegisterResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + func (s *DRPCAnynsAccountAbstractionUnimplementedServer) CreateUserOperation(context.Context, *CreateUserOperationRequestSigned) (*OperationResponse, error) { return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } type DRPCAnynsAccountAbstractionDescription struct{} -func (DRPCAnynsAccountAbstractionDescription) NumMethods() int { return 6 } +func (DRPCAnynsAccountAbstractionDescription) NumMethods() int { return 7 } func (DRPCAnynsAccountAbstractionDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { switch n { @@ -199,6 +214,15 @@ func (DRPCAnynsAccountAbstractionDescription) Method(n int) (string, drpc.Encodi ) }, DRPCAnynsAccountAbstractionServer.GetDataNameRegister, true case 5: + return "/AnynsAccountAbstraction/GetDataNameRegisterForSpace", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCAnynsAccountAbstractionServer). + GetDataNameRegisterForSpace( + ctx, + in1.(*NameRegisterForSpaceRequest), + ) + }, DRPCAnynsAccountAbstractionServer.GetDataNameRegisterForSpace, true + case 6: return "/AnynsAccountAbstraction/CreateUserOperation", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCAnynsAccountAbstractionServer). @@ -296,6 +320,22 @@ func (x *drpcAnynsAccountAbstraction_GetDataNameRegisterStream) SendAndClose(m * return x.CloseSend() } +type DRPCAnynsAccountAbstraction_GetDataNameRegisterForSpaceStream interface { + drpc.Stream + SendAndClose(*GetDataNameRegisterResponse) error +} + +type drpcAnynsAccountAbstraction_GetDataNameRegisterForSpaceStream struct { + drpc.Stream +} + +func (x *drpcAnynsAccountAbstraction_GetDataNameRegisterForSpaceStream) SendAndClose(m *GetDataNameRegisterResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_aa_proto{}); err != nil { + return err + } + return x.CloseSend() +} + type DRPCAnynsAccountAbstraction_CreateUserOperationStream interface { drpc.Stream SendAndClose(*OperationResponse) error diff --git a/nameservice/nameserviceproto/nameservice_drpc.pb.go b/nameservice/nameserviceproto/nameservice_drpc.pb.go index 4aa6a9f0..e662c7af 100644 --- a/nameservice/nameserviceproto/nameservice_drpc.pb.go +++ b/nameservice/nameserviceproto/nameservice_drpc.pb.go @@ -41,7 +41,12 @@ type DRPCAnynsClient interface { DRPCConn() drpc.Conn IsNameAvailable(ctx context.Context, in *NameAvailableRequest) (*NameAvailableResponse, error) + BatchIsNameAvailable(ctx context.Context, in *BatchNameAvailableRequest) (*BatchNameAvailableResponse, error) GetNameByAddress(ctx context.Context, in *NameByAddressRequest) (*NameByAddressResponse, error) + BatchGetNameByAddress(ctx context.Context, in *BatchNameByAddressRequest) (*BatchNameByAddressResponse, error) + GetNameByAnyId(ctx context.Context, in *NameByAnyIdRequest) (*NameByAddressResponse, error) + BatchGetNameByAnyId(ctx context.Context, in *BatchNameByAnyIdRequest) (*BatchNameByAddressResponse, error) + AdminNameRegisterSigned(ctx context.Context, in *NameRegisterRequestSigned) (*OperationResponse, error) } type drpcAnynsClient struct { @@ -63,6 +68,15 @@ func (c *drpcAnynsClient) IsNameAvailable(ctx context.Context, in *NameAvailable return out, nil } +func (c *drpcAnynsClient) BatchIsNameAvailable(ctx context.Context, in *BatchNameAvailableRequest) (*BatchNameAvailableResponse, error) { + out := new(BatchNameAvailableResponse) + err := c.cc.Invoke(ctx, "/Anyns/BatchIsNameAvailable", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + func (c *drpcAnynsClient) GetNameByAddress(ctx context.Context, in *NameByAddressRequest) (*NameByAddressResponse, error) { out := new(NameByAddressResponse) err := c.cc.Invoke(ctx, "/Anyns/GetNameByAddress", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}, in, out) @@ -72,9 +86,50 @@ func (c *drpcAnynsClient) GetNameByAddress(ctx context.Context, in *NameByAddres return out, nil } +func (c *drpcAnynsClient) BatchGetNameByAddress(ctx context.Context, in *BatchNameByAddressRequest) (*BatchNameByAddressResponse, error) { + out := new(BatchNameByAddressResponse) + err := c.cc.Invoke(ctx, "/Anyns/BatchGetNameByAddress", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *drpcAnynsClient) GetNameByAnyId(ctx context.Context, in *NameByAnyIdRequest) (*NameByAddressResponse, error) { + out := new(NameByAddressResponse) + err := c.cc.Invoke(ctx, "/Anyns/GetNameByAnyId", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *drpcAnynsClient) BatchGetNameByAnyId(ctx context.Context, in *BatchNameByAnyIdRequest) (*BatchNameByAddressResponse, error) { + out := new(BatchNameByAddressResponse) + err := c.cc.Invoke(ctx, "/Anyns/BatchGetNameByAnyId", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *drpcAnynsClient) AdminNameRegisterSigned(ctx context.Context, in *NameRegisterRequestSigned) (*OperationResponse, error) { + out := new(OperationResponse) + err := c.cc.Invoke(ctx, "/Anyns/AdminNameRegisterSigned", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + type DRPCAnynsServer interface { IsNameAvailable(context.Context, *NameAvailableRequest) (*NameAvailableResponse, error) + BatchIsNameAvailable(context.Context, *BatchNameAvailableRequest) (*BatchNameAvailableResponse, error) GetNameByAddress(context.Context, *NameByAddressRequest) (*NameByAddressResponse, error) + BatchGetNameByAddress(context.Context, *BatchNameByAddressRequest) (*BatchNameByAddressResponse, error) + GetNameByAnyId(context.Context, *NameByAnyIdRequest) (*NameByAddressResponse, error) + BatchGetNameByAnyId(context.Context, *BatchNameByAnyIdRequest) (*BatchNameByAddressResponse, error) + AdminNameRegisterSigned(context.Context, *NameRegisterRequestSigned) (*OperationResponse, error) } type DRPCAnynsUnimplementedServer struct{} @@ -83,13 +138,33 @@ func (s *DRPCAnynsUnimplementedServer) IsNameAvailable(context.Context, *NameAva return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } +func (s *DRPCAnynsUnimplementedServer) BatchIsNameAvailable(context.Context, *BatchNameAvailableRequest) (*BatchNameAvailableResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + func (s *DRPCAnynsUnimplementedServer) GetNameByAddress(context.Context, *NameByAddressRequest) (*NameByAddressResponse, error) { return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } +func (s *DRPCAnynsUnimplementedServer) BatchGetNameByAddress(context.Context, *BatchNameByAddressRequest) (*BatchNameByAddressResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + +func (s *DRPCAnynsUnimplementedServer) GetNameByAnyId(context.Context, *NameByAnyIdRequest) (*NameByAddressResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + +func (s *DRPCAnynsUnimplementedServer) BatchGetNameByAnyId(context.Context, *BatchNameByAnyIdRequest) (*BatchNameByAddressResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + +func (s *DRPCAnynsUnimplementedServer) AdminNameRegisterSigned(context.Context, *NameRegisterRequestSigned) (*OperationResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + type DRPCAnynsDescription struct{} -func (DRPCAnynsDescription) NumMethods() int { return 2 } +func (DRPCAnynsDescription) NumMethods() int { return 7 } func (DRPCAnynsDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { switch n { @@ -103,6 +178,15 @@ func (DRPCAnynsDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, ) }, DRPCAnynsServer.IsNameAvailable, true case 1: + return "/Anyns/BatchIsNameAvailable", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCAnynsServer). + BatchIsNameAvailable( + ctx, + in1.(*BatchNameAvailableRequest), + ) + }, DRPCAnynsServer.BatchIsNameAvailable, true + case 2: return "/Anyns/GetNameByAddress", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCAnynsServer). @@ -111,6 +195,42 @@ func (DRPCAnynsDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, in1.(*NameByAddressRequest), ) }, DRPCAnynsServer.GetNameByAddress, true + case 3: + return "/Anyns/BatchGetNameByAddress", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCAnynsServer). + BatchGetNameByAddress( + ctx, + in1.(*BatchNameByAddressRequest), + ) + }, DRPCAnynsServer.BatchGetNameByAddress, true + case 4: + return "/Anyns/GetNameByAnyId", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCAnynsServer). + GetNameByAnyId( + ctx, + in1.(*NameByAnyIdRequest), + ) + }, DRPCAnynsServer.GetNameByAnyId, true + case 5: + return "/Anyns/BatchGetNameByAnyId", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCAnynsServer). + BatchGetNameByAnyId( + ctx, + in1.(*BatchNameByAnyIdRequest), + ) + }, DRPCAnynsServer.BatchGetNameByAnyId, true + case 6: + return "/Anyns/AdminNameRegisterSigned", drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCAnynsServer). + AdminNameRegisterSigned( + ctx, + in1.(*NameRegisterRequestSigned), + ) + }, DRPCAnynsServer.AdminNameRegisterSigned, true default: return "", nil, nil, nil, false } @@ -136,6 +256,22 @@ func (x *drpcAnyns_IsNameAvailableStream) SendAndClose(m *NameAvailableResponse) return x.CloseSend() } +type DRPCAnyns_BatchIsNameAvailableStream interface { + drpc.Stream + SendAndClose(*BatchNameAvailableResponse) error +} + +type drpcAnyns_BatchIsNameAvailableStream struct { + drpc.Stream +} + +func (x *drpcAnyns_BatchIsNameAvailableStream) SendAndClose(m *BatchNameAvailableResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}); err != nil { + return err + } + return x.CloseSend() +} + type DRPCAnyns_GetNameByAddressStream interface { drpc.Stream SendAndClose(*NameByAddressResponse) error @@ -151,3 +287,67 @@ func (x *drpcAnyns_GetNameByAddressStream) SendAndClose(m *NameByAddressResponse } return x.CloseSend() } + +type DRPCAnyns_BatchGetNameByAddressStream interface { + drpc.Stream + SendAndClose(*BatchNameByAddressResponse) error +} + +type drpcAnyns_BatchGetNameByAddressStream struct { + drpc.Stream +} + +func (x *drpcAnyns_BatchGetNameByAddressStream) SendAndClose(m *BatchNameByAddressResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}); err != nil { + return err + } + return x.CloseSend() +} + +type DRPCAnyns_GetNameByAnyIdStream interface { + drpc.Stream + SendAndClose(*NameByAddressResponse) error +} + +type drpcAnyns_GetNameByAnyIdStream struct { + drpc.Stream +} + +func (x *drpcAnyns_GetNameByAnyIdStream) SendAndClose(m *NameByAddressResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}); err != nil { + return err + } + return x.CloseSend() +} + +type DRPCAnyns_BatchGetNameByAnyIdStream interface { + drpc.Stream + SendAndClose(*BatchNameByAddressResponse) error +} + +type drpcAnyns_BatchGetNameByAnyIdStream struct { + drpc.Stream +} + +func (x *drpcAnyns_BatchGetNameByAnyIdStream) SendAndClose(m *BatchNameByAddressResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}); err != nil { + return err + } + return x.CloseSend() +} + +type DRPCAnyns_AdminNameRegisterSignedStream interface { + drpc.Stream + SendAndClose(*OperationResponse) error +} + +type drpcAnyns_AdminNameRegisterSignedStream struct { + drpc.Stream +} + +func (x *drpcAnyns_AdminNameRegisterSignedStream) SendAndClose(m *OperationResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_nameservice_nameserviceproto_protos_nameservice_proto{}); err != nil { + return err + } + return x.CloseSend() +} diff --git a/nameservice/nameserviceproto/protos/nameservice.proto b/nameservice/nameserviceproto/protos/nameservice.proto index 778e46e4..084daa71 100644 --- a/nameservice/nameserviceproto/protos/nameservice.proto +++ b/nameservice/nameserviceproto/protos/nameservice.proto @@ -2,35 +2,63 @@ syntax = "proto3"; option go_package = "nameservice/nameserviceproto"; //import "google/protobuf/timestamp.proto"; +import "nameservice/nameserviceproto/protos/nameservice_aa.proto"; message NameAvailableRequest { // Name including .any suffix string fullName = 1; } +message BatchNameAvailableRequest { + // Names including .any suffix + repeated string fullNames = 1; +} + message NameByAddressRequest { - // An Ethereum address that owns that name - string ownerEthAddress = 1; + // EOA -> SCW -> name + // A SCW Ethereum address that owns that name + string ownerScwEthAddress = 1; +} + +message BatchNameByAddressRequest { + // EOA -> SCW -> name + // A SCW Ethereum address that owns that name + repeated string ownerScwEthAddresses = 1; +} + +message NameByAnyIdRequest { + string anyAddress = 1; +} + +message BatchNameByAnyIdRequest { + repeated string anyAddresses = 1; } message NameAvailableResponse { bool available = 1; - // An Ethereum address that owns that name + // EOA -> SCW -> name // This field is non-empty only if name is "already registered" - string ownerEthAddress = 2; + string ownerScwEthAddress = 2; + + // This field is non-empty only if name is "already registered" + string ownerEthAddress = 3; // A content hash attached to this name // This field is non-empty only if name is "already registered" - string ownerAnyAddress = 3; + string ownerAnyAddress = 4; // A SpaceID attached to this name // This field is non-empty only if name is "already registered" - string spaceId = 4; + string spaceId = 5; - // doestn't work with marashalling/unmarshalling + // doesn't work with marashalling/unmarshalling //google.protobuf.Timestamp nameExpires = 5 [(gogoproto.stdtime) = true]; - int64 nameExpires = 5; + int64 nameExpires = 6; +} + +message BatchNameAvailableResponse { + repeated NameAvailableResponse results = 1; } message NameByAddressResponse { @@ -39,8 +67,24 @@ message NameByAddressResponse { string name = 2; } -service Anyns { - // Check if name is free or get the attached information if not - rpc IsNameAvailable(NameAvailableRequest) returns (NameAvailableResponse) {} - rpc GetNameByAddress(NameByAddressRequest) returns (NameByAddressResponse) {} +message BatchNameByAddressResponse { + repeated NameByAddressResponse results = 1; +} + +service Anyns { + // Lookup: name -> address + rpc IsNameAvailable(NameAvailableRequest) returns (NameAvailableResponse) {} + rpc BatchIsNameAvailable(BatchNameAvailableRequest) returns (BatchNameAvailableResponse) {} + + // Reverse lookup: address -> name + rpc GetNameByAddress(NameByAddressRequest) returns (NameByAddressResponse) {} + rpc BatchGetNameByAddress(BatchNameByAddressRequest) returns (BatchNameByAddressResponse) {} + + // Reverse lookup: ANY ID -> name + rpc GetNameByAnyId(NameByAnyIdRequest) returns (NameByAddressResponse) {} + rpc BatchGetNameByAnyId(BatchNameByAnyIdRequest) returns (BatchNameByAddressResponse) {} + + // Register new name for the user (on behalf of the user) + // Anytype CAN only register names for users, but can not transfer or update them! + rpc AdminNameRegisterSigned(NameRegisterRequestSigned) returns (OperationResponse) {} } diff --git a/nameservice/nameserviceproto/protos/nameservice_aa.proto b/nameservice/nameserviceproto/protos/nameservice_aa.proto index 29ae7692..b9c7de6c 100644 --- a/nameservice/nameserviceproto/protos/nameservice_aa.proto +++ b/nameservice/nameserviceproto/protos/nameservice_aa.proto @@ -79,6 +79,8 @@ message CreateUserOperationRequest { string ownerEthAddress = 4; + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() string ownerAnyID = 5; // all operations currently are towards single name, please specify it @@ -98,6 +100,45 @@ message NameRegisterRequest { string fullName = 1; // A content hash attached to this name + // This should not be empty! + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() + string ownerAnyAddress = 2; + + // An Ethereum address that owns that name + string ownerEthAddress = 3; + + // if false -> name ownership will belong to ownerEthAddress + // if true -> name ownership will belong to SCW of ownerEthAddress (AccountAbstraction) + bool registerToSmartContractWallet = 4; + + // How many months to register the name for + uint32 registerPeriodMonths = 5; + + // Example: + // 1 - register alice.any -> ANYID123123 + // 2 - register xxxx.any -> ANYID123123 + // reverse resolve ANYID123123 will return xxxx.any + // + // TODO: currently by default "true" + // bool updateReverseResolver = 4; +} + +message NameRegisterRequestSigned { + // NameRegisterRequest struct + bytes payload = 1; + + // payload signed by payload.ownerEthAddress + bytes signature = 2; +} + +message NameRegisterForSpaceRequest { + string fullName = 1; + + // A content hash attached to this name + // This should not be empty! + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() string ownerAnyAddress = 2; // An Ethereum address that owns that name @@ -105,6 +146,9 @@ message NameRegisterRequest { // A SpaceID attached to this name string spaceId = 4; + + // How many months to register the name for + uint32 registerPeriodMonths = 5; } message GetOperationStatusRequest { @@ -153,7 +197,12 @@ service AnynsAccountAbstraction { // 2. sign it with your Ethereum private key // 3. send it using CreateUserOperation // 4. check operation status using GetOperation + // + // Register new name for my Any identity rpc GetDataNameRegister(NameRegisterRequest) returns (GetDataNameRegisterResponse) {} + + // Register new name and attach Space ID to it + rpc GetDataNameRegisterForSpace(NameRegisterForSpaceRequest) returns (GetDataNameRegisterResponse) {} // TODO //rpc GetDataNameUpdate(NameUpdateRequest) returns (GetDataNameRegisterResponse) {} diff --git a/net/peer/peer.go b/net/peer/peer.go index 72911214..e85691d3 100644 --- a/net/peer/peer.go +++ b/net/peer/peer.go @@ -244,6 +244,9 @@ var defaultProtoChecker = handshake.ProtoChecker{ } func (p *peer) serve(conn net.Conn) (err error) { + defer func() { + _ = conn.Close() + }() hsCtx, cancel := context.WithTimeout(p.Context(), time.Second*20) if _, err = handshake.IncomingProtoHandshake(hsCtx, conn, defaultProtoChecker); err != nil { cancel() diff --git a/net/rpc/limiter/config.go b/net/rpc/limiter/config.go new file mode 100644 index 00000000..8d018994 --- /dev/null +++ b/net/rpc/limiter/config.go @@ -0,0 +1,15 @@ +package limiter + +type ConfigGetter interface { + GetLimiterConf() Config +} + +type Tokens struct { + TokensPerSecond int `yaml:"rps"` + MaxTokens int `yaml:"burst"` +} + +type Config struct { + DefaultTokens Tokens `yaml:"default"` + ResponseTokens map[string]Tokens `yaml:"rpc"` +} diff --git a/net/rpc/limiter/limiter.go b/net/rpc/limiter/limiter.go new file mode 100644 index 00000000..85c1a051 --- /dev/null +++ b/net/rpc/limiter/limiter.go @@ -0,0 +1,130 @@ +//go:generate mockgen -destination mock_limiter/mock_limiter.go github.com/anyproto/any-sync/net/rpc/limiter RpcLimiter +package limiter + +import ( + "context" + "strings" + "sync" + "time" + + "golang.org/x/time/rate" + "storj.io/drpc" + + "github.com/anyproto/any-sync/app" + "github.com/anyproto/any-sync/app/logger" + "github.com/anyproto/any-sync/net/peer" + "github.com/anyproto/any-sync/net/rpc/limiter/limiterproto" + "github.com/anyproto/any-sync/util/periodicsync" +) + +const ( + peerCheckInterval = 10 * time.Second + checkTimeout = 2 * time.Second +) + +var log = logger.NewNamed(CName) + +const CName = "common.rpc.limiter" + +type RpcLimiter interface { + app.ComponentRunnable + // WrapDRPCHandler wraps the given drpc.Handler with additional functionality + WrapDRPCHandler(handler drpc.Handler) drpc.Handler +} + +func New() RpcLimiter { + return &limiter{ + limiters: make(map[string]*peerLimiter), + peerCheckInterval: peerCheckInterval, + checkTimeout: checkTimeout, + } +} + +type peerLimiter struct { + *rate.Limiter + lastUsage time.Time +} + +type limiter struct { + drpc.Handler + limiters map[string]*peerLimiter + periodicLoop periodicsync.PeriodicSync + peerCheckInterval time.Duration + checkTimeout time.Duration + cfg Config + mx sync.Mutex +} + +func (h *limiter) Run(ctx context.Context) (err error) { + h.periodicLoop.Run() + return nil +} + +func (h *limiter) Close(ctx context.Context) (err error) { + h.periodicLoop.Close() + return +} + +func (h *limiter) Init(a *app.App) (err error) { + h.periodicLoop = periodicsync.NewPeriodicSyncDuration(h.peerCheckInterval, h.checkTimeout, h.peerLoop, log) + h.cfg = a.MustComponent("config").(ConfigGetter).GetLimiterConf() + return nil +} + +func (h *limiter) Name() (name string) { + return CName +} + +func (h *limiter) peerLoop(ctx context.Context) error { + h.mx.Lock() + defer h.mx.Unlock() + for rpcPeer, lim := range h.limiters { + if time.Since(lim.lastUsage) > h.peerCheckInterval { + delete(h.limiters, rpcPeer) + } + } + return nil +} + +func (h *limiter) WrapDRPCHandler(handler drpc.Handler) drpc.Handler { + h.mx.Lock() + defer h.mx.Unlock() + h.Handler = handler + return h +} + +func (h *limiter) HandleRPC(stream drpc.Stream, rpc string) (err error) { + peerId, err := peer.CtxPeerId(stream.Context()) + if err != nil { + return err + } + lim := h.getPeerLimiter(peerId, rpc) + if !lim.Allow() { + return limiterproto.ErrLimitExceeded + } + return h.Handler.HandleRPC(stream, rpc) +} + +func (h *limiter) getLimits(rpc string) Tokens { + if tokens, exists := h.cfg.ResponseTokens[rpc]; exists { + return tokens + } + return h.cfg.DefaultTokens +} + +func (h *limiter) getPeerLimiter(peerId string, rpc string) *peerLimiter { + // rpc looks like this /anyNodeSync.NodeSync/PartitionSync + rpcPeer := strings.Join([]string{peerId, rpc}, "-") + h.mx.Lock() + defer h.mx.Unlock() + lim, ok := h.limiters[rpcPeer] + if !ok { + limits := h.getLimits(rpc) + lim = &peerLimiter{ + Limiter: rate.NewLimiter(rate.Limit(limits.TokensPerSecond), limits.MaxTokens), + } + h.limiters[rpcPeer] = lim + } + lim.lastUsage = time.Now() + return lim +} diff --git a/net/rpc/limiter/limiter_test.go b/net/rpc/limiter/limiter_test.go new file mode 100644 index 00000000..4ffa564b --- /dev/null +++ b/net/rpc/limiter/limiter_test.go @@ -0,0 +1,181 @@ +package limiter + +import ( + "context" + "sync/atomic" + "testing" + "time" + + "github.com/stretchr/testify/require" + "storj.io/drpc" + + "github.com/anyproto/any-sync/net/peer" + "github.com/anyproto/any-sync/net/rpc/limiter/limiterproto" +) + +var ctx = context.Background() + +type mockHandler struct { + calls atomic.Int32 +} + +type mockStream struct { + ctx context.Context +} + +func (m mockStream) Context() context.Context { + return m.ctx +} + +func (m mockStream) MsgSend(msg drpc.Message, enc drpc.Encoding) error { + return nil +} + +func (m mockStream) MsgRecv(msg drpc.Message, enc drpc.Encoding) error { + return nil +} + +func (m mockStream) CloseSend() error { + return nil +} + +func (m mockStream) Close() error { + return nil +} + +func (m *mockHandler) HandleRPC(stream drpc.Stream, rpc string) (err error) { + m.calls.Add(1) + return nil +} + +func TestLimiter_Synchronous(t *testing.T) { + lim := New().(*limiter) + handler := &mockHandler{} + lim.cfg = Config{ + DefaultTokens: Tokens{ + TokensPerSecond: 100, + MaxTokens: 100, + }, + ResponseTokens: map[string]Tokens{ + "rpc": { + TokensPerSecond: 10, + MaxTokens: 1, + }, + }, + } + lim.peerCheckInterval = 10 * time.Millisecond + wrapped := lim.WrapDRPCHandler(handler) + // rpc call allows only one token max, so it should let only first call + // for second one we should wait 100 ms + firstStream := mockStream{ctx: peer.CtxWithPeerId(ctx, "peer1")} + // check that we are using specific timeout + err := wrapped.HandleRPC(firstStream, "rpc") + require.NoError(t, err) + err = wrapped.HandleRPC(firstStream, "rpc") + require.Equal(t, limiterproto.ErrLimitExceeded, err) + // second stream should not affect the first one + secondStream := mockStream{ctx: peer.CtxWithPeerId(ctx, "peer2")} + err = wrapped.HandleRPC(secondStream, "rpc") + require.NoError(t, err) + // after 100 ms new token has been generated + time.Sleep(100 * time.Millisecond) + err = wrapped.HandleRPC(firstStream, "rpc") + require.NoError(t, err) + time.Sleep(10 * time.Millisecond) + // checking that peer loop cleaned the map + err = lim.peerLoop(ctx) + require.NoError(t, err) + // now we should be able to call again, because we cleared the map + err = wrapped.HandleRPC(firstStream, "rpc") + require.NoError(t, err) + // but limit of 1 sec is not enough to clean the map + time.Sleep(1 * time.Millisecond) + err = wrapped.HandleRPC(firstStream, "rpc") + require.Equal(t, limiterproto.ErrLimitExceeded, err) +} + +func TestLimiter_Concurrent_NoBursts(t *testing.T) { + lim := New().(*limiter) + handler := &mockHandler{} + var ( + targetRps = 10 + // peerRps should be greater than targetRps + peerRps = 100 + reqDelay = time.Duration(1000/peerRps) * time.Millisecond + ) + lim.cfg = Config{ + DefaultTokens: Tokens{ + TokensPerSecond: targetRps, + MaxTokens: 1, + }, + } + wrapped := lim.WrapDRPCHandler(handler) + firstStream := mockStream{ctx: peer.CtxWithPeerId(ctx, "peer1")} + secondStream := mockStream{ctx: peer.CtxWithPeerId(ctx, "peer2")} + waitFirst := make(chan struct{}) + waitSecond := make(chan struct{}) + go func() { + for i := 0; i < peerRps; i++ { + time.Sleep(reqDelay) + _ = wrapped.HandleRPC(firstStream, "rpc") + } + close(waitFirst) + }() + go func() { + for i := 0; i < peerRps; i++ { + time.Sleep(reqDelay) + _ = wrapped.HandleRPC(secondStream, "rpc") + } + close(waitSecond) + }() + <-waitFirst + <-waitSecond + // 2 for number of peers and 2 for error margin (delays etc) + maxCalls := 2 * 2 * targetRps + require.Greater(t, maxCalls, int(handler.calls.Load())) +} + +func TestLimiter_Concurrent_Bursts(t *testing.T) { + lim := New().(*limiter) + handler := &mockHandler{} + var ( + targetRps = 10 + // bursts are not affected by rps limit + burst = 10 + // peerRps should be greater than targetRps + burst + peerRps = 100 + reqDelay = time.Duration(1000/peerRps) * time.Millisecond + ) + lim.cfg = Config{ + DefaultTokens: Tokens{ + TokensPerSecond: targetRps, + MaxTokens: burst, + }, + } + wrapped := lim.WrapDRPCHandler(handler) + firstStream := mockStream{ctx: peer.CtxWithPeerId(ctx, "peer1")} + secondStream := mockStream{ctx: peer.CtxWithPeerId(ctx, "peer2")} + waitFirst := make(chan struct{}) + waitSecond := make(chan struct{}) + go func() { + for i := 0; i < peerRps; i++ { + time.Sleep(reqDelay) + _ = wrapped.HandleRPC(firstStream, "rpc") + } + close(waitFirst) + }() + go func() { + for i := 0; i < peerRps; i++ { + time.Sleep(reqDelay) + _ = wrapped.HandleRPC(secondStream, "rpc") + } + close(waitSecond) + }() + <-waitFirst + <-waitSecond + // 2 for number of peers and 2 for error margin (delays etc) + maxCalls := 2 * 2 * (targetRps + burst) + minCalls := 2 * (targetRps + burst) + require.Greater(t, maxCalls, int(handler.calls.Load())) + require.LessOrEqual(t, minCalls, int(handler.calls.Load())) +} diff --git a/net/rpc/limiter/limiterproto/errors.go b/net/rpc/limiter/limiterproto/errors.go new file mode 100644 index 00000000..f15ade2d --- /dev/null +++ b/net/rpc/limiter/limiterproto/errors.go @@ -0,0 +1,13 @@ +package limiterproto + +import ( + "errors" + + "github.com/anyproto/any-sync/net/rpc/rpcerr" +) + +var ( + errGroup = rpcerr.ErrGroup(ErrCodes_ErrorOffset) + + ErrLimitExceeded = errGroup.Register(errors.New("rate limit exceeded"), uint64(ErrCodes_RateLimitExceeded)) +) diff --git a/net/rpc/limiter/limiterproto/limiter.pb.go b/net/rpc/limiter/limiterproto/limiter.pb.go new file mode 100644 index 00000000..5e7ae2c8 --- /dev/null +++ b/net/rpc/limiter/limiterproto/limiter.pb.go @@ -0,0 +1,68 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: net/rpc/limiter/limiterproto/protos/limiter.proto + +package limiterproto + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type ErrCodes int32 + +const ( + ErrCodes_RateLimitExceeded ErrCodes = 0 + ErrCodes_ErrorOffset ErrCodes = 700 +) + +var ErrCodes_name = map[int32]string{ + 0: "RateLimitExceeded", + 700: "ErrorOffset", +} + +var ErrCodes_value = map[string]int32{ + "RateLimitExceeded": 0, + "ErrorOffset": 700, +} + +func (x ErrCodes) String() string { + return proto.EnumName(ErrCodes_name, int32(x)) +} + +func (ErrCodes) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_43f29163996a95d8, []int{0} +} + +func init() { + proto.RegisterEnum("limiter.ErrCodes", ErrCodes_name, ErrCodes_value) +} + +func init() { + proto.RegisterFile("net/rpc/limiter/limiterproto/protos/limiter.proto", fileDescriptor_43f29163996a95d8) +} + +var fileDescriptor_43f29163996a95d8 = []byte{ + // 147 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0xcc, 0x4b, 0x2d, 0xd1, + 0x2f, 0x2a, 0x48, 0xd6, 0xcf, 0xc9, 0xcc, 0xcd, 0x2c, 0x49, 0x2d, 0x82, 0xd1, 0x05, 0x45, 0xf9, + 0x25, 0xf9, 0xfa, 0x60, 0xb2, 0x18, 0x26, 0xa6, 0x07, 0xe6, 0x0a, 0xb1, 0x43, 0xb9, 0x5a, 0xc6, + 0x5c, 0x1c, 0xae, 0x45, 0x45, 0xce, 0xf9, 0x29, 0xa9, 0xc5, 0x42, 0xa2, 0x5c, 0x82, 0x41, 0x89, + 0x25, 0xa9, 0x3e, 0x20, 0x29, 0xd7, 0x8a, 0xe4, 0xd4, 0xd4, 0x94, 0xd4, 0x14, 0x01, 0x06, 0x21, + 0x01, 0x2e, 0x6e, 0xd7, 0xa2, 0xa2, 0xfc, 0x22, 0xff, 0xb4, 0xb4, 0xe2, 0xd4, 0x12, 0x81, 0x3d, + 0xac, 0x4e, 0x66, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, + 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x25, 0x83, 0xcf, + 0x29, 0x49, 0x6c, 0x60, 0xca, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x1e, 0x6b, 0xb3, 0x13, 0xb1, + 0x00, 0x00, 0x00, +} diff --git a/net/rpc/limiter/limiterproto/protos/limiter.proto b/net/rpc/limiter/limiterproto/protos/limiter.proto new file mode 100644 index 00000000..1c28b74e --- /dev/null +++ b/net/rpc/limiter/limiterproto/protos/limiter.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; +package limiter; +option go_package = "net/rpc/limiter/limiterproto"; + +enum ErrCodes { + RateLimitExceeded = 0; + ErrorOffset = 700; +} diff --git a/net/rpc/limiter/mock_limiter/mock_limiter.go b/net/rpc/limiter/mock_limiter/mock_limiter.go new file mode 100644 index 00000000..99e2ff8c --- /dev/null +++ b/net/rpc/limiter/mock_limiter/mock_limiter.go @@ -0,0 +1,112 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/anyproto/any-sync/net/rpc/limiter (interfaces: RpcLimiter) +// +// Generated by this command: +// +// mockgen -destination mock_limiter/mock_limiter.go github.com/anyproto/any-sync/net/rpc/limiter RpcLimiter +// + +// Package mock_limiter is a generated GoMock package. +package mock_limiter + +import ( + context "context" + reflect "reflect" + + app "github.com/anyproto/any-sync/app" + gomock "go.uber.org/mock/gomock" + drpc "storj.io/drpc" +) + +// MockRpcLimiter is a mock of RpcLimiter interface. +type MockRpcLimiter struct { + ctrl *gomock.Controller + recorder *MockRpcLimiterMockRecorder +} + +// MockRpcLimiterMockRecorder is the mock recorder for MockRpcLimiter. +type MockRpcLimiterMockRecorder struct { + mock *MockRpcLimiter +} + +// NewMockRpcLimiter creates a new mock instance. +func NewMockRpcLimiter(ctrl *gomock.Controller) *MockRpcLimiter { + mock := &MockRpcLimiter{ctrl: ctrl} + mock.recorder = &MockRpcLimiterMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockRpcLimiter) EXPECT() *MockRpcLimiterMockRecorder { + return m.recorder +} + +// Close mocks base method. +func (m *MockRpcLimiter) Close(arg0 context.Context) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Close", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Close indicates an expected call of Close. +func (mr *MockRpcLimiterMockRecorder) Close(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockRpcLimiter)(nil).Close), arg0) +} + +// Init mocks base method. +func (m *MockRpcLimiter) Init(arg0 *app.App) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Init", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Init indicates an expected call of Init. +func (mr *MockRpcLimiterMockRecorder) Init(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Init", reflect.TypeOf((*MockRpcLimiter)(nil).Init), arg0) +} + +// Name mocks base method. +func (m *MockRpcLimiter) Name() string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Name") + ret0, _ := ret[0].(string) + return ret0 +} + +// Name indicates an expected call of Name. +func (mr *MockRpcLimiterMockRecorder) Name() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockRpcLimiter)(nil).Name)) +} + +// Run mocks base method. +func (m *MockRpcLimiter) Run(arg0 context.Context) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Run", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Run indicates an expected call of Run. +func (mr *MockRpcLimiterMockRecorder) Run(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Run", reflect.TypeOf((*MockRpcLimiter)(nil).Run), arg0) +} + +// WrapDRPCHandler mocks base method. +func (m *MockRpcLimiter) WrapDRPCHandler(arg0 drpc.Handler) drpc.Handler { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WrapDRPCHandler", arg0) + ret0, _ := ret[0].(drpc.Handler) + return ret0 +} + +// WrapDRPCHandler indicates an expected call of WrapDRPCHandler. +func (mr *MockRpcLimiterMockRecorder) WrapDRPCHandler(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WrapDRPCHandler", reflect.TypeOf((*MockRpcLimiter)(nil).WrapDRPCHandler), arg0) +} diff --git a/net/rpc/rpcerr/registry.go b/net/rpc/rpcerr/registry.go index e8a749e6..0860ee2a 100644 --- a/net/rpc/rpcerr/registry.go +++ b/net/rpc/rpcerr/registry.go @@ -43,7 +43,7 @@ func Unwrap(e error) error { } err, ok := errsMap[code] if !ok { - return drpcerr.WithCode(fmt.Errorf("unexpected error: %v; code: %d", err, code), code) + return drpcerr.WithCode(fmt.Errorf("unexpected error: %w; code: %d", e, code), code) } return err } diff --git a/net/rpc/server/drpcserver.go b/net/rpc/server/drpcserver.go index 8fc112ca..85ec0890 100644 --- a/net/rpc/server/drpcserver.go +++ b/net/rpc/server/drpcserver.go @@ -2,12 +2,15 @@ package server import ( "context" + "net" + "github.com/anyproto/any-sync/app" "github.com/anyproto/any-sync/app/logger" "github.com/anyproto/any-sync/metric" "github.com/anyproto/any-sync/net/rpc" + "github.com/anyproto/any-sync/net/rpc/limiter" + "go.uber.org/zap" - "net" "storj.io/drpc" "storj.io/drpc/drpcmanager" "storj.io/drpc/drpcmux" @@ -34,8 +37,9 @@ type DRPCServer interface { type drpcServer struct { drpcServer *drpcserver.Server *drpcmux.Mux - config rpc.Config - metric metric.Metric + config rpc.Config + metric metric.Metric + limiter limiter.RpcLimiter } type DRPCHandlerWrapper func(handler drpc.Handler) drpc.Handler @@ -47,12 +51,16 @@ func (s *drpcServer) Name() (name string) { func (s *drpcServer) Init(a *app.App) (err error) { s.config = a.MustComponent("config").(rpc.ConfigGetter).GetDrpc() s.metric, _ = a.Component(metric.CName).(metric.Metric) + s.limiter, _ = a.Component(limiter.CName).(limiter.RpcLimiter) s.Mux = drpcmux.New() var handler drpc.Handler handler = s + if s.limiter != nil { + handler = s.limiter.WrapDRPCHandler(handler) + } if s.metric != nil { - handler = s.metric.WrapDRPCHandler(s) + handler = s.metric.WrapDRPCHandler(handler) } bufSize := s.config.Stream.MaxMsgSizeMb * (1 << 20) s.drpcServer = drpcserver.NewWithOptions(handler, drpcserver.Options{Manager: drpcmanager.Options{ diff --git a/net/secureservice/secureservice.go b/net/secureservice/secureservice.go index cbc8c466..e8fb18c1 100644 --- a/net/secureservice/secureservice.go +++ b/net/secureservice/secureservice.go @@ -28,11 +28,11 @@ var ( // ProtoVersion 1 - version with yamux over tcp and quic // ProtoVersion 2 - acl compatible version // ProtoVersion 3 - acl with breaking changes / multiplayer - ProtoVersion = uint32(2) + ProtoVersion = uint32(3) ) var ( - compatibleVersions = []uint32{ProtoVersion, 3} + compatibleVersions = []uint32{2, ProtoVersion} ) func New() SecureService { diff --git a/net/transport/quic/quic.go b/net/transport/quic/quic.go index 24f90fe3..dbd712ca 100644 --- a/net/transport/quic/quic.go +++ b/net/transport/quic/quic.go @@ -4,18 +4,20 @@ import ( "context" "crypto/tls" "fmt" - "github.com/anyproto/any-sync/app" - "github.com/anyproto/any-sync/app/logger" - "github.com/anyproto/any-sync/net/secureservice" - "github.com/anyproto/any-sync/net/transport" + "net" + "sync" + "time" + libp2crypto "github.com/libp2p/go-libp2p/core/crypto" "github.com/libp2p/go-libp2p/core/peer" libp2ptls "github.com/libp2p/go-libp2p/p2p/security/tls" "github.com/quic-go/quic-go" "go.uber.org/zap" - "net" - "sync" - "time" + + "github.com/anyproto/any-sync/app" + "github.com/anyproto/any-sync/app/logger" + "github.com/anyproto/any-sync/net/secureservice" + "github.com/anyproto/any-sync/net/transport" ) const CName = "net.transport.quic" @@ -139,6 +141,9 @@ func (q *quicTransport) Dial(ctx context.Context, addr string) (mc transport.Mul cctx, err := q.secure.HandshakeOutbound(ctx, stream, remotePeerId.String()) if err != nil { + defer func() { + _ = qConn.CloseWithError(3, "outbound handshake failed") + }() return nil, err } @@ -189,6 +194,9 @@ func (q *quicTransport) accept(conn quic.Connection) (err error) { }() cctx, err := q.secure.HandshakeInbound(ctx, stream, remotePeerId.String()) if err != nil { + defer func() { + _ = conn.CloseWithError(3, "inbound handshake failed") + }() return } mc := newConn(cctx, conn) diff --git a/node/nodeclient/mock_nodeclient/mock_nodeclient.go b/node/nodeclient/mock_nodeclient/mock_nodeclient.go new file mode 100644 index 00000000..dc8dea45 --- /dev/null +++ b/node/nodeclient/mock_nodeclient/mock_nodeclient.go @@ -0,0 +1,100 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/anyproto/any-sync/node/nodeclient (interfaces: NodeClient) +// +// Generated by this command: +// +// mockgen -destination mock_nodeclient/mock_nodeclient.go github.com/anyproto/any-sync/node/nodeclient NodeClient +// + +// Package mock_nodeclient is a generated GoMock package. +package mock_nodeclient + +import ( + context "context" + reflect "reflect" + + app "github.com/anyproto/any-sync/app" + consensusproto "github.com/anyproto/any-sync/consensus/consensusproto" + gomock "go.uber.org/mock/gomock" +) + +// MockNodeClient is a mock of NodeClient interface. +type MockNodeClient struct { + ctrl *gomock.Controller + recorder *MockNodeClientMockRecorder +} + +// MockNodeClientMockRecorder is the mock recorder for MockNodeClient. +type MockNodeClientMockRecorder struct { + mock *MockNodeClient +} + +// NewMockNodeClient creates a new mock instance. +func NewMockNodeClient(ctrl *gomock.Controller) *MockNodeClient { + mock := &MockNodeClient{ctrl: ctrl} + mock.recorder = &MockNodeClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockNodeClient) EXPECT() *MockNodeClientMockRecorder { + return m.recorder +} + +// AclAddRecord mocks base method. +func (m *MockNodeClient) AclAddRecord(arg0 context.Context, arg1 string, arg2 *consensusproto.RawRecord) (*consensusproto.RawRecordWithId, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AclAddRecord", arg0, arg1, arg2) + ret0, _ := ret[0].(*consensusproto.RawRecordWithId) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AclAddRecord indicates an expected call of AclAddRecord. +func (mr *MockNodeClientMockRecorder) AclAddRecord(arg0, arg1, arg2 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AclAddRecord", reflect.TypeOf((*MockNodeClient)(nil).AclAddRecord), arg0, arg1, arg2) +} + +// AclGetRecords mocks base method. +func (m *MockNodeClient) AclGetRecords(arg0 context.Context, arg1, arg2 string) ([]*consensusproto.RawRecordWithId, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AclGetRecords", arg0, arg1, arg2) + ret0, _ := ret[0].([]*consensusproto.RawRecordWithId) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AclGetRecords indicates an expected call of AclGetRecords. +func (mr *MockNodeClientMockRecorder) AclGetRecords(arg0, arg1, arg2 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AclGetRecords", reflect.TypeOf((*MockNodeClient)(nil).AclGetRecords), arg0, arg1, arg2) +} + +// Init mocks base method. +func (m *MockNodeClient) Init(arg0 *app.App) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Init", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Init indicates an expected call of Init. +func (mr *MockNodeClientMockRecorder) Init(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Init", reflect.TypeOf((*MockNodeClient)(nil).Init), arg0) +} + +// Name mocks base method. +func (m *MockNodeClient) Name() string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Name") + ret0, _ := ret[0].(string) + return ret0 +} + +// Name indicates an expected call of Name. +func (mr *MockNodeClientMockRecorder) Name() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockNodeClient)(nil).Name)) +} diff --git a/node/nodeclient/nodeclient.go b/node/nodeclient/nodeclient.go new file mode 100644 index 00000000..72bdca87 --- /dev/null +++ b/node/nodeclient/nodeclient.go @@ -0,0 +1,98 @@ +//go:generate mockgen -destination mock_nodeclient/mock_nodeclient.go github.com/anyproto/any-sync/node/nodeclient NodeClient +package nodeclient + +import ( + "context" + + "storj.io/drpc" + + "github.com/anyproto/any-sync/app" + "github.com/anyproto/any-sync/commonspace/spacesyncproto" + "github.com/anyproto/any-sync/consensus/consensusproto" + "github.com/anyproto/any-sync/net/pool" + "github.com/anyproto/any-sync/net/rpc/rpcerr" + "github.com/anyproto/any-sync/nodeconf" +) + +const CName = "common.node.nodeclient" + +func New() NodeClient { + return &nodeClient{} +} + +type NodeClient interface { + app.Component + AclGetRecords(ctx context.Context, spaceId, aclHead string) (recs []*consensusproto.RawRecordWithId, err error) + AclAddRecord(ctx context.Context, spaceId string, rec *consensusproto.RawRecord) (recWithId *consensusproto.RawRecordWithId, err error) +} + +type nodeClient struct { + pool pool.Service + nodeConf nodeconf.Service +} + +func (c *nodeClient) Init(a *app.App) (err error) { + c.pool = a.MustComponent(pool.CName).(pool.Service) + c.nodeConf = a.MustComponent(nodeconf.CName).(nodeconf.Service) + return +} + +func (c *nodeClient) Name() (name string) { + return CName +} + +func (c *nodeClient) AclGetRecords(ctx context.Context, spaceId, aclHead string) (recs []*consensusproto.RawRecordWithId, err error) { + err = clientDo(c, ctx, spaceId, func(cl spacesyncproto.DRPCSpaceSyncClient) error { + resp, err := cl.AclGetRecords(ctx, &spacesyncproto.AclGetRecordsRequest{ + SpaceId: spaceId, + AclHead: aclHead, + }) + if err != nil { + return err + } + recs = make([]*consensusproto.RawRecordWithId, len(resp.Records)) + for i, rec := range resp.Records { + recs[i] = &consensusproto.RawRecordWithId{} + if err = recs[i].Unmarshal(rec); err != nil { + return err + } + } + return nil + }) + return +} + +func (c *nodeClient) AclAddRecord(ctx context.Context, spaceId string, rec *consensusproto.RawRecord) (recWithId *consensusproto.RawRecordWithId, err error) { + data, err := rec.Marshal() + if err != nil { + return + } + err = clientDo(c, ctx, spaceId, func(cl spacesyncproto.DRPCSpaceSyncClient) error { + res, err := cl.AclAddRecord(ctx, &spacesyncproto.AclAddRecordRequest{ + SpaceId: spaceId, + Payload: data, + }) + if err != nil { + return err + } + recWithId = &consensusproto.RawRecordWithId{ + Payload: res.Payload, + Id: res.RecordId, + } + return nil + }) + return +} + +var clientDo = (*nodeClient).doClient + +func (c *nodeClient) doClient(ctx context.Context, spaceId string, f func(cl spacesyncproto.DRPCSpaceSyncClient) error) error { + p, err := c.pool.GetOneOf(ctx, c.nodeConf.NodeIds(spaceId)) + if err != nil { + return err + } + return p.DoDrpc(ctx, func(conn drpc.Conn) error { + err := f(spacesyncproto.NewDRPCSpaceSyncClient(conn)) + return rpcerr.Unwrap(err) + }) +} diff --git a/node/nodeclient/nodeclient_test.go b/node/nodeclient/nodeclient_test.go new file mode 100644 index 00000000..408dc4e5 --- /dev/null +++ b/node/nodeclient/nodeclient_test.go @@ -0,0 +1,92 @@ +package nodeclient + +import ( + "context" + "fmt" + "testing" + + "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" + + "github.com/anyproto/any-sync/commonspace/spacesyncproto" + "github.com/anyproto/any-sync/commonspace/spacesyncproto/mock_spacesyncproto" + "github.com/anyproto/any-sync/consensus/consensusproto" +) + +var ctx = context.Background() + +type fixture struct { + *nodeClient + ctrl *gomock.Controller +} + +func (f *fixture) finish() { + f.ctrl.Finish() +} + +func newFixture(t *testing.T) *fixture { + ctrl := gomock.NewController(t) + return &fixture{ + nodeClient: New().(*nodeClient), + ctrl: ctrl, + } +} + +func TestNodeClient_AclGetRecords(t *testing.T) { + f := newFixture(t) + defer f.finish() + + spaceId := "spaceId" + aclHead := "aclHead" + cl := mock_spacesyncproto.NewMockDRPCSpaceSyncClient(f.ctrl) + clientDo = func(client *nodeClient, ctx context.Context, s string, f func(cl spacesyncproto.DRPCSpaceSyncClient) error) error { + return f(cl) + } + var ( + expectedRecs []*consensusproto.RawRecordWithId + expectedByteRecs [][]byte + total = 5 + ) + for i := 0; i < total; i++ { + expectedRecs = append(expectedRecs, &consensusproto.RawRecordWithId{ + Id: fmt.Sprint(i), + }) + marshalled, err := expectedRecs[i].Marshal() + require.NoError(t, err) + expectedByteRecs = append(expectedByteRecs, marshalled) + } + cl.EXPECT().AclGetRecords(ctx, &spacesyncproto.AclGetRecordsRequest{ + SpaceId: spaceId, + AclHead: aclHead, + }).Return(&spacesyncproto.AclGetRecordsResponse{Records: expectedByteRecs}, nil) + recs, err := f.AclGetRecords(ctx, spaceId, aclHead) + require.NoError(t, err) + require.Equal(t, expectedRecs, recs) +} + +func TestNodeClient_AclAddRecords(t *testing.T) { + f := newFixture(t) + defer f.finish() + + spaceId := "spaceId" + cl := mock_spacesyncproto.NewMockDRPCSpaceSyncClient(f.ctrl) + clientDo = func(client *nodeClient, ctx context.Context, s string, f func(cl spacesyncproto.DRPCSpaceSyncClient) error) error { + return f(cl) + } + sendRec := &consensusproto.RawRecord{ + AcceptorTimestamp: 10, + } + data, err := sendRec.Marshal() + require.NoError(t, err) + expectedRec := &consensusproto.RawRecordWithId{ + Id: "recId", + Payload: data, + } + cl.EXPECT().AclAddRecord(ctx, &spacesyncproto.AclAddRecordRequest{ + SpaceId: spaceId, + Payload: data, + }).Return(&spacesyncproto.AclAddRecordResponse{RecordId: expectedRec.Id, Payload: expectedRec.Payload}, nil) + rec, err := f.AclAddRecord(ctx, spaceId, sendRec) + require.NoError(t, err) + require.Equal(t, expectedRec, rec) +} diff --git a/paymentservice/paymentserviceclient/mock/mock_paymentserviceclient.go b/paymentservice/paymentserviceclient/mock/mock_paymentserviceclient.go index 97dbf63a..7a13c97c 100644 --- a/paymentservice/paymentserviceclient/mock/mock_paymentserviceclient.go +++ b/paymentservice/paymentserviceclient/mock/mock_paymentserviceclient.go @@ -5,6 +5,7 @@ // // mockgen -source paymentservice/paymentserviceclient/paymentserviceclient.go // + // Package mock_paymentserviceclient is a generated GoMock package. package mock_paymentserviceclient @@ -55,18 +56,49 @@ func (mr *MockAnyPpClientServiceMockRecorder) BuySubscription(ctx, in any) *gomo return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BuySubscription", reflect.TypeOf((*MockAnyPpClientService)(nil).BuySubscription), ctx, in) } -// Close mocks base method. -func (m *MockAnyPpClientService) Close(ctx context.Context) error { +// FinalizeSubscription mocks base method. +func (m *MockAnyPpClientService) FinalizeSubscription(ctx context.Context, in *paymentserviceproto.FinalizeSubscriptionRequestSigned) (*paymentserviceproto.FinalizeSubscriptionResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Close", ctx) - ret0, _ := ret[0].(error) - return ret0 + ret := m.ctrl.Call(m, "FinalizeSubscription", ctx, in) + ret0, _ := ret[0].(*paymentserviceproto.FinalizeSubscriptionResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Close indicates an expected call of Close. -func (mr *MockAnyPpClientServiceMockRecorder) Close(ctx any) *gomock.Call { +// FinalizeSubscription indicates an expected call of FinalizeSubscription. +func (mr *MockAnyPpClientServiceMockRecorder) FinalizeSubscription(ctx, in any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockAnyPpClientService)(nil).Close), ctx) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FinalizeSubscription", reflect.TypeOf((*MockAnyPpClientService)(nil).FinalizeSubscription), ctx, in) +} + +// GetAllTiers mocks base method. +func (m *MockAnyPpClientService) GetAllTiers(ctx context.Context, in *paymentserviceproto.GetTiersRequestSigned) (*paymentserviceproto.GetTiersResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAllTiers", ctx, in) + ret0, _ := ret[0].(*paymentserviceproto.GetTiersResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAllTiers indicates an expected call of GetAllTiers. +func (mr *MockAnyPpClientServiceMockRecorder) GetAllTiers(ctx, in any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllTiers", reflect.TypeOf((*MockAnyPpClientService)(nil).GetAllTiers), ctx, in) +} + +// GetSubscriptionPortalLink mocks base method. +func (m *MockAnyPpClientService) GetSubscriptionPortalLink(ctx context.Context, in *paymentserviceproto.GetSubscriptionPortalLinkRequestSigned) (*paymentserviceproto.GetSubscriptionPortalLinkResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSubscriptionPortalLink", ctx, in) + ret0, _ := ret[0].(*paymentserviceproto.GetSubscriptionPortalLinkResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetSubscriptionPortalLink indicates an expected call of GetSubscriptionPortalLink. +func (mr *MockAnyPpClientServiceMockRecorder) GetSubscriptionPortalLink(ctx, in any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSubscriptionPortalLink", reflect.TypeOf((*MockAnyPpClientService)(nil).GetSubscriptionPortalLink), ctx, in) } // GetSubscriptionStatus mocks base method. @@ -84,6 +116,21 @@ func (mr *MockAnyPpClientServiceMockRecorder) GetSubscriptionStatus(ctx, in any) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSubscriptionStatus", reflect.TypeOf((*MockAnyPpClientService)(nil).GetSubscriptionStatus), ctx, in) } +// GetVerificationEmail mocks base method. +func (m *MockAnyPpClientService) GetVerificationEmail(ctx context.Context, in *paymentserviceproto.GetVerificationEmailRequestSigned) (*paymentserviceproto.GetVerificationEmailResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetVerificationEmail", ctx, in) + ret0, _ := ret[0].(*paymentserviceproto.GetVerificationEmailResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetVerificationEmail indicates an expected call of GetVerificationEmail. +func (mr *MockAnyPpClientServiceMockRecorder) GetVerificationEmail(ctx, in any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetVerificationEmail", reflect.TypeOf((*MockAnyPpClientService)(nil).GetVerificationEmail), ctx, in) +} + // Init mocks base method. func (m *MockAnyPpClientService) Init(a *app.App) error { m.ctrl.T.Helper() @@ -98,6 +145,21 @@ func (mr *MockAnyPpClientServiceMockRecorder) Init(a any) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Init", reflect.TypeOf((*MockAnyPpClientService)(nil).Init), a) } +// IsNameValid mocks base method. +func (m *MockAnyPpClientService) IsNameValid(ctx context.Context, in *paymentserviceproto.IsNameValidRequest) (*paymentserviceproto.IsNameValidResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "IsNameValid", ctx, in) + ret0, _ := ret[0].(*paymentserviceproto.IsNameValidResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// IsNameValid indicates an expected call of IsNameValid. +func (mr *MockAnyPpClientServiceMockRecorder) IsNameValid(ctx, in any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsNameValid", reflect.TypeOf((*MockAnyPpClientService)(nil).IsNameValid), ctx, in) +} + // Name mocks base method. func (m *MockAnyPpClientService) Name() string { m.ctrl.T.Helper() @@ -112,16 +174,32 @@ func (mr *MockAnyPpClientServiceMockRecorder) Name() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockAnyPpClientService)(nil).Name)) } -// Run mocks base method. -func (m *MockAnyPpClientService) Run(ctx context.Context) error { +// VerifyAppStoreReceipt mocks base method. +func (m *MockAnyPpClientService) VerifyAppStoreReceipt(ctx context.Context, in *paymentserviceproto.VerifyAppStoreReceiptRequestSigned) (*paymentserviceproto.VerifyAppStoreReceiptResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Run", ctx) - ret0, _ := ret[0].(error) - return ret0 + ret := m.ctrl.Call(m, "VerifyAppStoreReceipt", ctx, in) + ret0, _ := ret[0].(*paymentserviceproto.VerifyAppStoreReceiptResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Run indicates an expected call of Run. -func (mr *MockAnyPpClientServiceMockRecorder) Run(ctx any) *gomock.Call { +// VerifyAppStoreReceipt indicates an expected call of VerifyAppStoreReceipt. +func (mr *MockAnyPpClientServiceMockRecorder) VerifyAppStoreReceipt(ctx, in any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Run", reflect.TypeOf((*MockAnyPpClientService)(nil).Run), ctx) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifyAppStoreReceipt", reflect.TypeOf((*MockAnyPpClientService)(nil).VerifyAppStoreReceipt), ctx, in) +} + +// VerifyEmail mocks base method. +func (m *MockAnyPpClientService) VerifyEmail(ctx context.Context, in *paymentserviceproto.VerifyEmailRequestSigned) (*paymentserviceproto.VerifyEmailResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "VerifyEmail", ctx, in) + ret0, _ := ret[0].(*paymentserviceproto.VerifyEmailResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// VerifyEmail indicates an expected call of VerifyEmail. +func (mr *MockAnyPpClientServiceMockRecorder) VerifyEmail(ctx, in any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifyEmail", reflect.TypeOf((*MockAnyPpClientService)(nil).VerifyEmail), ctx, in) } diff --git a/paymentservice/paymentserviceclient/paymentserviceclient.go b/paymentservice/paymentserviceclient/paymentserviceclient.go index 49140e0c..e1e63d47 100644 --- a/paymentservice/paymentserviceclient/paymentserviceclient.go +++ b/paymentservice/paymentserviceclient/paymentserviceclient.go @@ -2,8 +2,10 @@ package paymentserviceclient import ( "context" + "errors" "github.com/anyproto/any-sync/app" + "github.com/anyproto/any-sync/app/logger" "github.com/anyproto/any-sync/net/pool" "github.com/anyproto/any-sync/net/rpc/rpcerr" "github.com/anyproto/any-sync/nodeconf" @@ -13,13 +15,22 @@ import ( const CName = "any-pp.drpcclient" +var log = logger.NewNamed(CName) + /* * This client component can be used to access the Any Payment Processing node * from other components. */ type AnyPpClientService interface { GetSubscriptionStatus(ctx context.Context, in *pp.GetSubscriptionRequestSigned) (out *pp.GetSubscriptionResponse, err error) + IsNameValid(ctx context.Context, in *pp.IsNameValidRequest) (out *pp.IsNameValidResponse, err error) BuySubscription(ctx context.Context, in *pp.BuySubscriptionRequestSigned) (out *pp.BuySubscriptionResponse, err error) + GetSubscriptionPortalLink(ctx context.Context, in *pp.GetSubscriptionPortalLinkRequestSigned) (out *pp.GetSubscriptionPortalLinkResponse, err error) + GetVerificationEmail(ctx context.Context, in *pp.GetVerificationEmailRequestSigned) (out *pp.GetVerificationEmailResponse, err error) + VerifyEmail(ctx context.Context, in *pp.VerifyEmailRequestSigned) (out *pp.VerifyEmailResponse, err error) + FinalizeSubscription(ctx context.Context, in *pp.FinalizeSubscriptionRequestSigned) (out *pp.FinalizeSubscriptionResponse, err error) + GetAllTiers(ctx context.Context, in *pp.GetTiersRequestSigned) (out *pp.GetTiersResponse, err error) + VerifyAppStoreReceipt(ctx context.Context, in *pp.VerifyAppStoreReceiptRequestSigned) (out *pp.VerifyAppStoreReceiptResponse, err error) app.Component } @@ -44,10 +55,15 @@ func New() AnyPpClientService { } func (s *service) doClient(ctx context.Context, fn func(cl pp.DRPCAnyPaymentProcessingClient) error) error { + if len(s.nodeconf.PaymentProcessingNodePeers()) == 0 { + log.Error("no payment processing peers configured") + + return errors.New("no paymentProcessingNode peers configured") + } + // it will try to connect to the Payment Node // please use "paymentProcessingNode" type of node in the config (in the network.nodes array) - peer, err := s.pool.Get(ctx, s.nodeconf.PaymentProcessingNodePeers()[0]) - + peer, err := s.pool.GetOneOf(ctx, s.nodeconf.PaymentProcessingNodePeers()) if err != nil { return err } @@ -80,3 +96,73 @@ func (s *service) BuySubscription(ctx context.Context, in *pp.BuySubscriptionReq }) return } + +func (s *service) GetSubscriptionPortalLink(ctx context.Context, in *pp.GetSubscriptionPortalLinkRequestSigned) (out *pp.GetSubscriptionPortalLinkResponse, err error) { + err = s.doClient(ctx, func(cl pp.DRPCAnyPaymentProcessingClient) error { + if out, err = cl.GetSubscriptionPortalLink(ctx, in); err != nil { + return rpcerr.Unwrap(err) + } + return nil + }) + return +} + +func (s *service) GetVerificationEmail(ctx context.Context, in *pp.GetVerificationEmailRequestSigned) (out *pp.GetVerificationEmailResponse, err error) { + err = s.doClient(ctx, func(cl pp.DRPCAnyPaymentProcessingClient) error { + if out, err = cl.GetVerificationEmail(ctx, in); err != nil { + return rpcerr.Unwrap(err) + } + return nil + }) + return +} + +func (s *service) VerifyEmail(ctx context.Context, in *pp.VerifyEmailRequestSigned) (out *pp.VerifyEmailResponse, err error) { + err = s.doClient(ctx, func(cl pp.DRPCAnyPaymentProcessingClient) error { + if out, err = cl.VerifyEmail(ctx, in); err != nil { + return rpcerr.Unwrap(err) + } + return nil + }) + return +} + +func (s *service) FinalizeSubscription(ctx context.Context, in *pp.FinalizeSubscriptionRequestSigned) (out *pp.FinalizeSubscriptionResponse, err error) { + err = s.doClient(ctx, func(cl pp.DRPCAnyPaymentProcessingClient) error { + if out, err = cl.FinalizeSubscription(ctx, in); err != nil { + return rpcerr.Unwrap(err) + } + return nil + }) + return +} + +func (s *service) GetAllTiers(ctx context.Context, in *pp.GetTiersRequestSigned) (out *pp.GetTiersResponse, err error) { + err = s.doClient(ctx, func(cl pp.DRPCAnyPaymentProcessingClient) error { + if out, err = cl.GetAllTiers(ctx, in); err != nil { + return rpcerr.Unwrap(err) + } + return nil + }) + return +} + +func (s *service) IsNameValid(ctx context.Context, in *pp.IsNameValidRequest) (out *pp.IsNameValidResponse, err error) { + err = s.doClient(ctx, func(cl pp.DRPCAnyPaymentProcessingClient) error { + if out, err = cl.IsNameValid(ctx, in); err != nil { + return rpcerr.Unwrap(err) + } + return nil + }) + return +} + +func (s *service) VerifyAppStoreReceipt(ctx context.Context, in *pp.VerifyAppStoreReceiptRequestSigned) (out *pp.VerifyAppStoreReceiptResponse, err error) { + err = s.doClient(ctx, func(cl pp.DRPCAnyPaymentProcessingClient) error { + if out, err = cl.VerifyAppStoreReceipt(ctx, in); err != nil { + return rpcerr.Unwrap(err) + } + return nil + }) + return +} diff --git a/paymentservice/paymentserviceproto/errors.go b/paymentservice/paymentserviceproto/errors.go new file mode 100644 index 00000000..00cb6d5d --- /dev/null +++ b/paymentservice/paymentserviceproto/errors.go @@ -0,0 +1,32 @@ +package paymentserviceproto + +import ( + "errors" + + "github.com/anyproto/any-sync/net/rpc/rpcerr" +) + +var ( + errGroup = rpcerr.ErrGroup(ErrorCodes_ErrorOffset) + + ErrEthAddressEmpty = errGroup.Register(errors.New("owner eth address is empty"), uint64(ErrorCodes_EthAddressEmpty)) + ErrInvalidSignature = errGroup.Register(errors.New("invalid signature"), uint64(ErrorCodes_InvalidSignature)) + ErrTierWrong = errGroup.Register(errors.New("wrong tier specified"), uint64(ErrorCodes_TierWrong)) + ErrTierNotFound = errGroup.Register(errors.New("requested tier not found"), uint64(ErrorCodes_TierNotFound)) + ErrTierInactive = errGroup.Register(errors.New("requested tier is not active"), uint64(ErrorCodes_TierInactive)) + ErrPaymentMethodWrong = errGroup.Register(errors.New("wrong payment method specified"), uint64(ErrorCodes_PaymentMethodWrong)) + ErrBadAnyName = errGroup.Register(errors.New("bad any name specified"), uint64(ErrorCodes_BadAnyName)) + ErrUnknown = errGroup.Register(errors.New("unknown error"), uint64(ErrorCodes_Unknown)) + ErrSubsAlreadyActive = errGroup.Register(errors.New("user already has an active subscription"), uint64(ErrorCodes_SubsAlreadyActive)) + ErrSubsNotFound = errGroup.Register(errors.New("no subscription for user"), uint64(ErrorCodes_SubsNotFound)) + ErrSubsWrongState = errGroup.Register(errors.New("subscription is not in PendingRequiresFinalization state"), uint64(ErrorCodes_SubsWrongState)) + ErrEmailWrongFormat = errGroup.Register(errors.New("wrong email format"), uint64(ErrorCodes_EmailWrongFormat)) + ErrEmailAlreadyVerified = errGroup.Register(errors.New("email already verified"), uint64(ErrorCodes_EmailAlreadyVerified)) + ErrEmailAlreadySent = errGroup.Register(errors.New("email verification request already sent. wait for the email or try again later"), uint64(ErrorCodes_EmailAlreadySent)) + ErrEmailFailedToSend = errGroup.Register(errors.New("failed to send email"), uint64(ErrorCodes_EmailFailedToSend)) + ErrEmailExpired = errGroup.Register(errors.New("email verification request expired. try getting new code"), uint64(ErrorCodes_EmailExpired)) + ErrEmailWrongCode = errGroup.Register(errors.New("wrong verification code"), uint64(ErrorCodes_EmailWrongCode)) + ErrAppleInvalidReceipt = errGroup.Register(errors.New("invalid AppStore receipt"), uint64(ErrorCodes_AppleInvalidReceipt)) + ErrApplePurchaseRegistration = errGroup.Register(errors.New("error on purchase registration"), uint64(ErrorCodes_ApplePurchaseRegistration)) + ErrAppleSubscriptionRenew = errGroup.Register(errors.New("error on subscription renew"), uint64(ErrorCodes_AppleSubscriptionRenew)) +) diff --git a/paymentservice/paymentserviceproto/paymentservice.pb.go b/paymentservice/paymentserviceproto/paymentservice.pb.go index d9ecf61c..dec2b86b 100644 --- a/paymentservice/paymentserviceproto/paymentservice.pb.go +++ b/paymentservice/paymentserviceproto/paymentservice.pb.go @@ -22,27 +22,46 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// TODO: +// later we will have an interface to enumerate all available tiers +// it's a bad idea to list them here, because interface will be changed often type SubscriptionTier int32 const ( - SubscriptionTier_Tier_Unknown SubscriptionTier = 0 - SubscriptionTier_Tier_Friend SubscriptionTier = 1 - SubscriptionTier_Tier_Supporter1Year SubscriptionTier = 2 - SubscriptionTier_Tier_Patron1Year SubscriptionTier = 3 + SubscriptionTier_TierUnknown SubscriptionTier = 0 + // "free" tier + SubscriptionTier_TierExplorer SubscriptionTier = 1 + // these can be used just for testing in debug mode + // it will still create an active subscription, but with NO features + SubscriptionTier_TierBuilder1WeekTEST SubscriptionTier = 2 + SubscriptionTier_TierCoCreator1WeekTEST SubscriptionTier = 3 + // these are the real tiers: + SubscriptionTier_TierBuilder1Year SubscriptionTier = 4 + SubscriptionTier_TierCoCreator1Year SubscriptionTier = 5 + SubscriptionTier_TierBuilderPlus SubscriptionTier = 6 + SubscriptionTier_TierAnytypeTeam SubscriptionTier = 7 ) var SubscriptionTier_name = map[int32]string{ - 0: "Tier_Unknown", - 1: "Tier_Friend", - 2: "Tier_Supporter1Year", - 3: "Tier_Patron1Year", + 0: "TierUnknown", + 1: "TierExplorer", + 2: "TierBuilder1WeekTEST", + 3: "TierCoCreator1WeekTEST", + 4: "TierBuilder1Year", + 5: "TierCoCreator1Year", + 6: "TierBuilderPlus", + 7: "TierAnytypeTeam", } var SubscriptionTier_value = map[string]int32{ - "Tier_Unknown": 0, - "Tier_Friend": 1, - "Tier_Supporter1Year": 2, - "Tier_Patron1Year": 3, + "TierUnknown": 0, + "TierExplorer": 1, + "TierBuilder1WeekTEST": 2, + "TierCoCreator1WeekTEST": 3, + "TierBuilder1Year": 4, + "TierCoCreator1Year": 5, + "TierBuilderPlus": 6, + "TierAnytypeTeam": 7, } func (x SubscriptionTier) String() string { @@ -56,27 +75,30 @@ func (SubscriptionTier) EnumDescriptor() ([]byte, []int) { type SubscriptionStatus int32 const ( - SubscriptionStatus_Status_Unknown SubscriptionStatus = 0 - SubscriptionStatus_Status_Pending SubscriptionStatus = 1 - SubscriptionStatus_Status_Active SubscriptionStatus = 2 - SubscriptionStatus_Status_Expired SubscriptionStatus = 3 - SubscriptionStatus_Status_Canceled SubscriptionStatus = 4 + SubscriptionStatus_StatusUnknown SubscriptionStatus = 0 + // payment is still pending + // this will be the status until the payment is confirmed or N is elapsed and no payment is received + // in the last case the subscription will switch to Status_Unknown or Status_Active + SubscriptionStatus_StatusPending SubscriptionStatus = 1 + SubscriptionStatus_StatusActive SubscriptionStatus = 2 + // when buying from other side - some data is missing in the Subscription + // we need to provide additional data after the payment + // please call FinalizeSubscription to fill-in needed fields + SubscriptionStatus_StatusPendingRequiresFinalization SubscriptionStatus = 3 ) var SubscriptionStatus_name = map[int32]string{ - 0: "Status_Unknown", - 1: "Status_Pending", - 2: "Status_Active", - 3: "Status_Expired", - 4: "Status_Canceled", + 0: "StatusUnknown", + 1: "StatusPending", + 2: "StatusActive", + 3: "StatusPendingRequiresFinalization", } var SubscriptionStatus_value = map[string]int32{ - "Status_Unknown": 0, - "Status_Pending": 1, - "Status_Active": 2, - "Status_Expired": 3, - "Status_Canceled": 4, + "StatusUnknown": 0, + "StatusPending": 1, + "StatusActive": 2, + "StatusPendingRequiresFinalization": 3, } func (x SubscriptionStatus) String() string { @@ -90,24 +112,33 @@ func (SubscriptionStatus) EnumDescriptor() ([]byte, []int) { type PaymentMethod int32 const ( - PaymentMethod_Method_Card PaymentMethod = 0 - PaymentMethod_Method_Crypto PaymentMethod = 1 - PaymentMethod_Method_ApplePay PaymentMethod = 2 - PaymentMethod_Method_GooglePay PaymentMethod = 3 + PaymentMethod_MethodCard PaymentMethod = 0 + PaymentMethod_MethodCrypto PaymentMethod = 1 + PaymentMethod_MethodApplePay PaymentMethod = 2 + PaymentMethod_MethodGooglePay PaymentMethod = 3 + PaymentMethod_MethodAppleInapp PaymentMethod = 4 + PaymentMethod_MethodGoogleInapp PaymentMethod = 5 + PaymentMethod_MethodNone PaymentMethod = 6 ) var PaymentMethod_name = map[int32]string{ - 0: "Method_Card", - 1: "Method_Crypto", - 2: "Method_ApplePay", - 3: "Method_GooglePay", + 0: "MethodCard", + 1: "MethodCrypto", + 2: "MethodApplePay", + 3: "MethodGooglePay", + 4: "MethodAppleInapp", + 5: "MethodGoogleInapp", + 6: "MethodNone", } var PaymentMethod_value = map[string]int32{ - "Method_Card": 0, - "Method_Crypto": 1, - "Method_ApplePay": 2, - "Method_GooglePay": 3, + "MethodCard": 0, + "MethodCrypto": 1, + "MethodApplePay": 2, + "MethodGooglePay": 3, + "MethodAppleInapp": 4, + "MethodGoogleInapp": 5, + "MethodNone": 6, } func (x PaymentMethod) String() string { @@ -118,9 +149,134 @@ func (PaymentMethod) EnumDescriptor() ([]byte, []int) { return fileDescriptor_4feb29dcc5ba50f6, []int{2} } -// 1 +type ErrorCodes int32 + +const ( + ErrorCodes_Unexpected ErrorCodes = 0 + ErrorCodes_EthAddressEmpty ErrorCodes = 1 + ErrorCodes_InvalidSignature ErrorCodes = 2 + ErrorCodes_TierWrong ErrorCodes = 3 + ErrorCodes_TierNotFound ErrorCodes = 4 + ErrorCodes_TierInactive ErrorCodes = 5 + ErrorCodes_PaymentMethodWrong ErrorCodes = 6 + ErrorCodes_BadAnyName ErrorCodes = 7 + ErrorCodes_Unknown ErrorCodes = 8 + ErrorCodes_SubsAlreadyActive ErrorCodes = 9 + ErrorCodes_SubsNotFound ErrorCodes = 10 + ErrorCodes_SubsWrongState ErrorCodes = 11 + ErrorCodes_EmailWrongFormat ErrorCodes = 12 + ErrorCodes_EmailAlreadyVerified ErrorCodes = 13 + ErrorCodes_EmailAlreadySent ErrorCodes = 14 + ErrorCodes_EmailFailedToSend ErrorCodes = 15 + ErrorCodes_EmailExpired ErrorCodes = 16 + ErrorCodes_EmailWrongCode ErrorCodes = 17 + ErrorCodes_AppleInvalidReceipt ErrorCodes = 18 + ErrorCodes_ApplePurchaseRegistration ErrorCodes = 19 + ErrorCodes_AppleSubscriptionRenew ErrorCodes = 20 + ErrorCodes_ErrorOffset ErrorCodes = 600 +) + +var ErrorCodes_name = map[int32]string{ + 0: "Unexpected", + 1: "EthAddressEmpty", + 2: "InvalidSignature", + 3: "TierWrong", + 4: "TierNotFound", + 5: "TierInactive", + 6: "PaymentMethodWrong", + 7: "BadAnyName", + 8: "Unknown", + 9: "SubsAlreadyActive", + 10: "SubsNotFound", + 11: "SubsWrongState", + 12: "EmailWrongFormat", + 13: "EmailAlreadyVerified", + 14: "EmailAlreadySent", + 15: "EmailFailedToSend", + 16: "EmailExpired", + 17: "EmailWrongCode", + 18: "AppleInvalidReceipt", + 19: "ApplePurchaseRegistration", + 20: "AppleSubscriptionRenew", + 600: "ErrorOffset", +} + +var ErrorCodes_value = map[string]int32{ + "Unexpected": 0, + "EthAddressEmpty": 1, + "InvalidSignature": 2, + "TierWrong": 3, + "TierNotFound": 4, + "TierInactive": 5, + "PaymentMethodWrong": 6, + "BadAnyName": 7, + "Unknown": 8, + "SubsAlreadyActive": 9, + "SubsNotFound": 10, + "SubsWrongState": 11, + "EmailWrongFormat": 12, + "EmailAlreadyVerified": 13, + "EmailAlreadySent": 14, + "EmailFailedToSend": 15, + "EmailExpired": 16, + "EmailWrongCode": 17, + "AppleInvalidReceipt": 18, + "ApplePurchaseRegistration": 19, + "AppleSubscriptionRenew": 20, + "ErrorOffset": 600, +} + +func (x ErrorCodes) String() string { + return proto.EnumName(ErrorCodes_name, int32(x)) +} + +func (ErrorCodes) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_4feb29dcc5ba50f6, []int{3} +} + +type IsNameValidResponse_Code int32 + +const ( + IsNameValidResponse_Valid IsNameValidResponse_Code = 0 + IsNameValidResponse_NoDotAny IsNameValidResponse_Code = 1 + IsNameValidResponse_TooShort IsNameValidResponse_Code = 2 + IsNameValidResponse_TooLong IsNameValidResponse_Code = 3 + IsNameValidResponse_HasInvalidChars IsNameValidResponse_Code = 4 + IsNameValidResponse_TierFeatureNoName IsNameValidResponse_Code = 5 + IsNameValidResponse_CanNotReserve IsNameValidResponse_Code = 6 +) + +var IsNameValidResponse_Code_name = map[int32]string{ + 0: "Valid", + 1: "NoDotAny", + 2: "TooShort", + 3: "TooLong", + 4: "HasInvalidChars", + 5: "TierFeatureNoName", + 6: "CanNotReserve", +} + +var IsNameValidResponse_Code_value = map[string]int32{ + "Valid": 0, + "NoDotAny": 1, + "TooShort": 2, + "TooLong": 3, + "HasInvalidChars": 4, + "TierFeatureNoName": 5, + "CanNotReserve": 6, +} + +func (x IsNameValidResponse_Code) String() string { + return proto.EnumName(IsNameValidResponse_Code_name, int32(x)) +} + +func (IsNameValidResponse_Code) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_4feb29dcc5ba50f6, []int{19, 0} +} + type GetSubscriptionRequest struct { - // in the following format: "12D3KooWA8EXV3KjBxEU5EnsPfneLx84vMWAtTBQBeyooN82KSuS" + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() OwnerAnyID string `protobuf:"bytes,1,opt,name=ownerAnyID,proto3" json:"ownerAnyID,omitempty"` } @@ -219,19 +375,17 @@ func (m *GetSubscriptionRequestSigned) GetSignature() []byte { } type GetSubscriptionResponse struct { - Tier SubscriptionTier `protobuf:"varint,1,opt,name=tier,proto3,enum=SubscriptionTier" json:"tier,omitempty"` - Status SubscriptionStatus `protobuf:"varint,2,opt,name=status,proto3,enum=SubscriptionStatus" json:"status,omitempty"` - // TODO: use google.protobuf.Timestamp and marshall it - DateStarted uint64 `protobuf:"varint,3,opt,name=dateStarted,proto3" json:"dateStarted,omitempty"` - DateEnds uint64 `protobuf:"varint,4,opt,name=dateEnds,proto3" json:"dateEnds,omitempty"` - IsAutoRenew bool `protobuf:"varint,5,opt,name=isAutoRenew,proto3" json:"isAutoRenew,omitempty"` - // if client has "downgraded" - he is still able to use the service until the end of the period - // (dateEnds) but then he will be on nextTier until nextTierEnds - // - // if Tier0_Unknown -> then no next tier - NextTier SubscriptionTier `protobuf:"varint,6,opt,name=nextTier,proto3,enum=SubscriptionTier" json:"nextTier,omitempty"` - NextTierEnds uint64 `protobuf:"varint,7,opt,name=nextTierEnds,proto3" json:"nextTierEnds,omitempty"` - PaymentMethod PaymentMethod `protobuf:"varint,8,opt,name=paymentMethod,proto3,enum=PaymentMethod" json:"paymentMethod,omitempty"` + // was SubscriptionTier before, changed to uint32 to allow us to use dynamic tiers + Tier uint32 `protobuf:"varint,1,opt,name=tier,proto3" json:"tier,omitempty"` + Status SubscriptionStatus `protobuf:"varint,2,opt,name=status,proto3,enum=SubscriptionStatus" json:"status,omitempty"` + DateStarted uint64 `protobuf:"varint,3,opt,name=dateStarted,proto3" json:"dateStarted,omitempty"` + DateEnds uint64 `protobuf:"varint,4,opt,name=dateEnds,proto3" json:"dateEnds,omitempty"` + IsAutoRenew bool `protobuf:"varint,5,opt,name=isAutoRenew,proto3" json:"isAutoRenew,omitempty"` + PaymentMethod PaymentMethod `protobuf:"varint,6,opt,name=paymentMethod,proto3,enum=PaymentMethod" json:"paymentMethod,omitempty"` + RequestedAnyName string `protobuf:"bytes,7,opt,name=requestedAnyName,proto3" json:"requestedAnyName,omitempty"` + // if user verified her email OR provided it while buying a subscription, it will be here + UserEmail string `protobuf:"bytes,8,opt,name=userEmail,proto3" json:"userEmail,omitempty"` + SubscribeToNewsletter bool `protobuf:"varint,9,opt,name=subscribeToNewsletter,proto3" json:"subscribeToNewsletter,omitempty"` } func (m *GetSubscriptionResponse) Reset() { *m = GetSubscriptionResponse{} } @@ -267,18 +421,18 @@ func (m *GetSubscriptionResponse) XXX_DiscardUnknown() { var xxx_messageInfo_GetSubscriptionResponse proto.InternalMessageInfo -func (m *GetSubscriptionResponse) GetTier() SubscriptionTier { +func (m *GetSubscriptionResponse) GetTier() uint32 { if m != nil { return m.Tier } - return SubscriptionTier_Tier_Unknown + return 0 } func (m *GetSubscriptionResponse) GetStatus() SubscriptionStatus { if m != nil { return m.Status } - return SubscriptionStatus_Status_Unknown + return SubscriptionStatus_StatusUnknown } func (m *GetSubscriptionResponse) GetDateStarted() uint64 { @@ -302,40 +456,51 @@ func (m *GetSubscriptionResponse) GetIsAutoRenew() bool { return false } -func (m *GetSubscriptionResponse) GetNextTier() SubscriptionTier { - if m != nil { - return m.NextTier - } - return SubscriptionTier_Tier_Unknown -} - -func (m *GetSubscriptionResponse) GetNextTierEnds() uint64 { - if m != nil { - return m.NextTierEnds - } - return 0 -} - func (m *GetSubscriptionResponse) GetPaymentMethod() PaymentMethod { if m != nil { return m.PaymentMethod } - return PaymentMethod_Method_Card + return PaymentMethod_MethodCard +} + +func (m *GetSubscriptionResponse) GetRequestedAnyName() string { + if m != nil { + return m.RequestedAnyName + } + return "" +} + +func (m *GetSubscriptionResponse) GetUserEmail() string { + if m != nil { + return m.UserEmail + } + return "" +} + +func (m *GetSubscriptionResponse) GetSubscribeToNewsletter() bool { + if m != nil { + return m.SubscribeToNewsletter + } + return false } -// 2 type BuySubscriptionRequest struct { - // in the following format: "12D3KooWA8EXV3KjBxEU5EnsPfneLx84vMWAtTBQBeyooN82KSuS" - OwnerAnyID string `protobuf:"bytes,1,opt,name=ownerAnyID,proto3" json:"ownerAnyID,omitempty"` - // this is the owner's ETH main EOA (External Owned Account) address - // - // not AccountAbstraction's SCW (Smart Contract Wallet) address! - // + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() + OwnerAnyId string `protobuf:"bytes,1,opt,name=ownerAnyId,proto3" json:"ownerAnyId,omitempty"` + // this is the owner's main EOA (Externally Owned Account) address + // not AccountAbstraction's SCW (Smart Contract Wallet) address! + // this is required to reserve a name for the owner (later that is done by user) // in the following format: "0x7a250d5630b4cf539739df2c5dacb4c659f2488d" - // this is required to reserve a name for the owner - OwnerEthAddress string `protobuf:"bytes,2,opt,name=ownerEthAddress,proto3" json:"ownerEthAddress,omitempty"` - RequestedTier SubscriptionTier `protobuf:"varint,3,opt,name=requestedTier,proto3,enum=SubscriptionTier" json:"requestedTier,omitempty"` - PaymentMethod PaymentMethod `protobuf:"varint,4,opt,name=paymentMethod,proto3,enum=PaymentMethod" json:"paymentMethod,omitempty"` + OwnerEthAddress string `protobuf:"bytes,2,opt,name=ownerEthAddress,proto3" json:"ownerEthAddress,omitempty"` + // was SubscriptionTier before, changed to uint32 to allow us to use dynamic tiers + RequestedTier uint32 `protobuf:"varint,3,opt,name=requestedTier,proto3" json:"requestedTier,omitempty"` + PaymentMethod PaymentMethod `protobuf:"varint,4,opt,name=paymentMethod,proto3,enum=PaymentMethod" json:"paymentMethod,omitempty"` + // if empty - then no name requested + // if non-empty - PP node will register that name on behalf of the user + RequestedAnyName string `protobuf:"bytes,5,opt,name=requestedAnyName,proto3" json:"requestedAnyName,omitempty"` + // for some payment methods we need to know the user's email + UserEmail string `protobuf:"bytes,6,opt,name=userEmail,proto3" json:"userEmail,omitempty"` } func (m *BuySubscriptionRequest) Reset() { *m = BuySubscriptionRequest{} } @@ -371,9 +536,9 @@ func (m *BuySubscriptionRequest) XXX_DiscardUnknown() { var xxx_messageInfo_BuySubscriptionRequest proto.InternalMessageInfo -func (m *BuySubscriptionRequest) GetOwnerAnyID() string { +func (m *BuySubscriptionRequest) GetOwnerAnyId() string { if m != nil { - return m.OwnerAnyID + return m.OwnerAnyId } return "" } @@ -385,18 +550,32 @@ func (m *BuySubscriptionRequest) GetOwnerEthAddress() string { return "" } -func (m *BuySubscriptionRequest) GetRequestedTier() SubscriptionTier { +func (m *BuySubscriptionRequest) GetRequestedTier() uint32 { if m != nil { return m.RequestedTier } - return SubscriptionTier_Tier_Unknown + return 0 } func (m *BuySubscriptionRequest) GetPaymentMethod() PaymentMethod { if m != nil { return m.PaymentMethod } - return PaymentMethod_Method_Card + return PaymentMethod_MethodCard +} + +func (m *BuySubscriptionRequest) GetRequestedAnyName() string { + if m != nil { + return m.RequestedAnyName + } + return "" +} + +func (m *BuySubscriptionRequest) GetUserEmail() string { + if m != nil { + return m.UserEmail + } + return "" } type BuySubscriptionRequestSigned struct { @@ -457,6 +636,8 @@ type BuySubscriptionResponse struct { // will feature current billing ID // stripe.com/?client_reference_id=1234 PaymentUrl string `protobuf:"bytes,1,opt,name=paymentUrl,proto3" json:"paymentUrl,omitempty"` + // billingID is passed via mobile client to payment platform + BillingID string `protobuf:"bytes,2,opt,name=billingID,proto3" json:"billingID,omitempty"` } func (m *BuySubscriptionResponse) Reset() { *m = BuySubscriptionResponse{} } @@ -499,16 +680,911 @@ func (m *BuySubscriptionResponse) GetPaymentUrl() string { return "" } +func (m *BuySubscriptionResponse) GetBillingID() string { + if m != nil { + return m.BillingID + } + return "" +} + +type FinalizeSubscriptionRequest struct { + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() + OwnerAnyId string `protobuf:"bytes,1,opt,name=ownerAnyId,proto3" json:"ownerAnyId,omitempty"` + // this is the owner's main EOA (Externally Owned Account) address + // not AccountAbstraction's SCW (Smart Contract Wallet) address! + // this is required to reserve a name for the owner (later that is done by user) + // in the following format: "0x7a250d5630b4cf539739df2c5dacb4c659f2488d" + OwnerEthAddress string `protobuf:"bytes,2,opt,name=ownerEthAddress,proto3" json:"ownerEthAddress,omitempty"` + // if empty - then no name requested + RequestedAnyName string `protobuf:"bytes,3,opt,name=requestedAnyName,proto3" json:"requestedAnyName,omitempty"` +} + +func (m *FinalizeSubscriptionRequest) Reset() { *m = FinalizeSubscriptionRequest{} } +func (m *FinalizeSubscriptionRequest) String() string { return proto.CompactTextString(m) } +func (*FinalizeSubscriptionRequest) ProtoMessage() {} +func (*FinalizeSubscriptionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_4feb29dcc5ba50f6, []int{6} +} +func (m *FinalizeSubscriptionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FinalizeSubscriptionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FinalizeSubscriptionRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *FinalizeSubscriptionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_FinalizeSubscriptionRequest.Merge(m, src) +} +func (m *FinalizeSubscriptionRequest) XXX_Size() int { + return m.Size() +} +func (m *FinalizeSubscriptionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_FinalizeSubscriptionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_FinalizeSubscriptionRequest proto.InternalMessageInfo + +func (m *FinalizeSubscriptionRequest) GetOwnerAnyId() string { + if m != nil { + return m.OwnerAnyId + } + return "" +} + +func (m *FinalizeSubscriptionRequest) GetOwnerEthAddress() string { + if m != nil { + return m.OwnerEthAddress + } + return "" +} + +func (m *FinalizeSubscriptionRequest) GetRequestedAnyName() string { + if m != nil { + return m.RequestedAnyName + } + return "" +} + +type FinalizeSubscriptionResponse struct { +} + +func (m *FinalizeSubscriptionResponse) Reset() { *m = FinalizeSubscriptionResponse{} } +func (m *FinalizeSubscriptionResponse) String() string { return proto.CompactTextString(m) } +func (*FinalizeSubscriptionResponse) ProtoMessage() {} +func (*FinalizeSubscriptionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4feb29dcc5ba50f6, []int{7} +} +func (m *FinalizeSubscriptionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FinalizeSubscriptionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FinalizeSubscriptionResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *FinalizeSubscriptionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_FinalizeSubscriptionResponse.Merge(m, src) +} +func (m *FinalizeSubscriptionResponse) XXX_Size() int { + return m.Size() +} +func (m *FinalizeSubscriptionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_FinalizeSubscriptionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_FinalizeSubscriptionResponse proto.InternalMessageInfo + +type FinalizeSubscriptionRequestSigned struct { + // VerifyEmailRequest + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + // this is payload signed with payload.ownerAnyID + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (m *FinalizeSubscriptionRequestSigned) Reset() { *m = FinalizeSubscriptionRequestSigned{} } +func (m *FinalizeSubscriptionRequestSigned) String() string { return proto.CompactTextString(m) } +func (*FinalizeSubscriptionRequestSigned) ProtoMessage() {} +func (*FinalizeSubscriptionRequestSigned) Descriptor() ([]byte, []int) { + return fileDescriptor_4feb29dcc5ba50f6, []int{8} +} +func (m *FinalizeSubscriptionRequestSigned) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FinalizeSubscriptionRequestSigned) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FinalizeSubscriptionRequestSigned.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *FinalizeSubscriptionRequestSigned) XXX_Merge(src proto.Message) { + xxx_messageInfo_FinalizeSubscriptionRequestSigned.Merge(m, src) +} +func (m *FinalizeSubscriptionRequestSigned) XXX_Size() int { + return m.Size() +} +func (m *FinalizeSubscriptionRequestSigned) XXX_DiscardUnknown() { + xxx_messageInfo_FinalizeSubscriptionRequestSigned.DiscardUnknown(m) +} + +var xxx_messageInfo_FinalizeSubscriptionRequestSigned proto.InternalMessageInfo + +func (m *FinalizeSubscriptionRequestSigned) GetPayload() []byte { + if m != nil { + return m.Payload + } + return nil +} + +func (m *FinalizeSubscriptionRequestSigned) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +type GetSubscriptionPortalLinkRequest struct { + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() + OwnerAnyId string `protobuf:"bytes,1,opt,name=ownerAnyId,proto3" json:"ownerAnyId,omitempty"` +} + +func (m *GetSubscriptionPortalLinkRequest) Reset() { *m = GetSubscriptionPortalLinkRequest{} } +func (m *GetSubscriptionPortalLinkRequest) String() string { return proto.CompactTextString(m) } +func (*GetSubscriptionPortalLinkRequest) ProtoMessage() {} +func (*GetSubscriptionPortalLinkRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_4feb29dcc5ba50f6, []int{9} +} +func (m *GetSubscriptionPortalLinkRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetSubscriptionPortalLinkRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetSubscriptionPortalLinkRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetSubscriptionPortalLinkRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSubscriptionPortalLinkRequest.Merge(m, src) +} +func (m *GetSubscriptionPortalLinkRequest) XXX_Size() int { + return m.Size() +} +func (m *GetSubscriptionPortalLinkRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetSubscriptionPortalLinkRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetSubscriptionPortalLinkRequest proto.InternalMessageInfo + +func (m *GetSubscriptionPortalLinkRequest) GetOwnerAnyId() string { + if m != nil { + return m.OwnerAnyId + } + return "" +} + +type GetSubscriptionPortalLinkRequestSigned struct { + // GetSubscriptionPortalLinkRequest + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + // this is payload signed with payload.ownerAnyID + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (m *GetSubscriptionPortalLinkRequestSigned) Reset() { + *m = GetSubscriptionPortalLinkRequestSigned{} +} +func (m *GetSubscriptionPortalLinkRequestSigned) String() string { return proto.CompactTextString(m) } +func (*GetSubscriptionPortalLinkRequestSigned) ProtoMessage() {} +func (*GetSubscriptionPortalLinkRequestSigned) Descriptor() ([]byte, []int) { + return fileDescriptor_4feb29dcc5ba50f6, []int{10} +} +func (m *GetSubscriptionPortalLinkRequestSigned) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetSubscriptionPortalLinkRequestSigned) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetSubscriptionPortalLinkRequestSigned.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetSubscriptionPortalLinkRequestSigned) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSubscriptionPortalLinkRequestSigned.Merge(m, src) +} +func (m *GetSubscriptionPortalLinkRequestSigned) XXX_Size() int { + return m.Size() +} +func (m *GetSubscriptionPortalLinkRequestSigned) XXX_DiscardUnknown() { + xxx_messageInfo_GetSubscriptionPortalLinkRequestSigned.DiscardUnknown(m) +} + +var xxx_messageInfo_GetSubscriptionPortalLinkRequestSigned proto.InternalMessageInfo + +func (m *GetSubscriptionPortalLinkRequestSigned) GetPayload() []byte { + if m != nil { + return m.Payload + } + return nil +} + +func (m *GetSubscriptionPortalLinkRequestSigned) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +type GetSubscriptionPortalLinkResponse struct { + PortalUrl string `protobuf:"bytes,1,opt,name=portalUrl,proto3" json:"portalUrl,omitempty"` +} + +func (m *GetSubscriptionPortalLinkResponse) Reset() { *m = GetSubscriptionPortalLinkResponse{} } +func (m *GetSubscriptionPortalLinkResponse) String() string { return proto.CompactTextString(m) } +func (*GetSubscriptionPortalLinkResponse) ProtoMessage() {} +func (*GetSubscriptionPortalLinkResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4feb29dcc5ba50f6, []int{11} +} +func (m *GetSubscriptionPortalLinkResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetSubscriptionPortalLinkResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetSubscriptionPortalLinkResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetSubscriptionPortalLinkResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSubscriptionPortalLinkResponse.Merge(m, src) +} +func (m *GetSubscriptionPortalLinkResponse) XXX_Size() int { + return m.Size() +} +func (m *GetSubscriptionPortalLinkResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetSubscriptionPortalLinkResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetSubscriptionPortalLinkResponse proto.InternalMessageInfo + +func (m *GetSubscriptionPortalLinkResponse) GetPortalUrl() string { + if m != nil { + return m.PortalUrl + } + return "" +} + +type GetVerificationEmailRequest struct { + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() + OwnerAnyId string `protobuf:"bytes,1,opt,name=ownerAnyId,proto3" json:"ownerAnyId,omitempty"` + Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` + SubscribeToNewsletter bool `protobuf:"varint,3,opt,name=subscribeToNewsletter,proto3" json:"subscribeToNewsletter,omitempty"` +} + +func (m *GetVerificationEmailRequest) Reset() { *m = GetVerificationEmailRequest{} } +func (m *GetVerificationEmailRequest) String() string { return proto.CompactTextString(m) } +func (*GetVerificationEmailRequest) ProtoMessage() {} +func (*GetVerificationEmailRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_4feb29dcc5ba50f6, []int{12} +} +func (m *GetVerificationEmailRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetVerificationEmailRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetVerificationEmailRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetVerificationEmailRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetVerificationEmailRequest.Merge(m, src) +} +func (m *GetVerificationEmailRequest) XXX_Size() int { + return m.Size() +} +func (m *GetVerificationEmailRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetVerificationEmailRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetVerificationEmailRequest proto.InternalMessageInfo + +func (m *GetVerificationEmailRequest) GetOwnerAnyId() string { + if m != nil { + return m.OwnerAnyId + } + return "" +} + +func (m *GetVerificationEmailRequest) GetEmail() string { + if m != nil { + return m.Email + } + return "" +} + +func (m *GetVerificationEmailRequest) GetSubscribeToNewsletter() bool { + if m != nil { + return m.SubscribeToNewsletter + } + return false +} + +type GetVerificationEmailResponse struct { +} + +func (m *GetVerificationEmailResponse) Reset() { *m = GetVerificationEmailResponse{} } +func (m *GetVerificationEmailResponse) String() string { return proto.CompactTextString(m) } +func (*GetVerificationEmailResponse) ProtoMessage() {} +func (*GetVerificationEmailResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4feb29dcc5ba50f6, []int{13} +} +func (m *GetVerificationEmailResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetVerificationEmailResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetVerificationEmailResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetVerificationEmailResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetVerificationEmailResponse.Merge(m, src) +} +func (m *GetVerificationEmailResponse) XXX_Size() int { + return m.Size() +} +func (m *GetVerificationEmailResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetVerificationEmailResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetVerificationEmailResponse proto.InternalMessageInfo + +type GetVerificationEmailRequestSigned struct { + // GetVerificationEmailRequest + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + // this is payload signed with payload.ownerAnyID + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (m *GetVerificationEmailRequestSigned) Reset() { *m = GetVerificationEmailRequestSigned{} } +func (m *GetVerificationEmailRequestSigned) String() string { return proto.CompactTextString(m) } +func (*GetVerificationEmailRequestSigned) ProtoMessage() {} +func (*GetVerificationEmailRequestSigned) Descriptor() ([]byte, []int) { + return fileDescriptor_4feb29dcc5ba50f6, []int{14} +} +func (m *GetVerificationEmailRequestSigned) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetVerificationEmailRequestSigned) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetVerificationEmailRequestSigned.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetVerificationEmailRequestSigned) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetVerificationEmailRequestSigned.Merge(m, src) +} +func (m *GetVerificationEmailRequestSigned) XXX_Size() int { + return m.Size() +} +func (m *GetVerificationEmailRequestSigned) XXX_DiscardUnknown() { + xxx_messageInfo_GetVerificationEmailRequestSigned.DiscardUnknown(m) +} + +var xxx_messageInfo_GetVerificationEmailRequestSigned proto.InternalMessageInfo + +func (m *GetVerificationEmailRequestSigned) GetPayload() []byte { + if m != nil { + return m.Payload + } + return nil +} + +func (m *GetVerificationEmailRequestSigned) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +type VerifyEmailRequest struct { + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() + OwnerAnyId string `protobuf:"bytes,1,opt,name=ownerAnyId,proto3" json:"ownerAnyId,omitempty"` + // this is the owner's main EOA (Externally Owned Account) address + // not AccountAbstraction's SCW (Smart Contract Wallet) address! + // this is required to reserve a name for the owner (later that is done by user) + // in the following format: "0x7a250d5630b4cf539739df2c5dacb4c659f2488d" + OwnerEthAddress string `protobuf:"bytes,2,opt,name=ownerEthAddress,proto3" json:"ownerEthAddress,omitempty"` + // code received in the email + Code string `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"` +} + +func (m *VerifyEmailRequest) Reset() { *m = VerifyEmailRequest{} } +func (m *VerifyEmailRequest) String() string { return proto.CompactTextString(m) } +func (*VerifyEmailRequest) ProtoMessage() {} +func (*VerifyEmailRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_4feb29dcc5ba50f6, []int{15} +} +func (m *VerifyEmailRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VerifyEmailRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VerifyEmailRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *VerifyEmailRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_VerifyEmailRequest.Merge(m, src) +} +func (m *VerifyEmailRequest) XXX_Size() int { + return m.Size() +} +func (m *VerifyEmailRequest) XXX_DiscardUnknown() { + xxx_messageInfo_VerifyEmailRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_VerifyEmailRequest proto.InternalMessageInfo + +func (m *VerifyEmailRequest) GetOwnerAnyId() string { + if m != nil { + return m.OwnerAnyId + } + return "" +} + +func (m *VerifyEmailRequest) GetOwnerEthAddress() string { + if m != nil { + return m.OwnerEthAddress + } + return "" +} + +func (m *VerifyEmailRequest) GetCode() string { + if m != nil { + return m.Code + } + return "" +} + +type VerifyEmailResponse struct { + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` +} + +func (m *VerifyEmailResponse) Reset() { *m = VerifyEmailResponse{} } +func (m *VerifyEmailResponse) String() string { return proto.CompactTextString(m) } +func (*VerifyEmailResponse) ProtoMessage() {} +func (*VerifyEmailResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4feb29dcc5ba50f6, []int{16} +} +func (m *VerifyEmailResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VerifyEmailResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VerifyEmailResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *VerifyEmailResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_VerifyEmailResponse.Merge(m, src) +} +func (m *VerifyEmailResponse) XXX_Size() int { + return m.Size() +} +func (m *VerifyEmailResponse) XXX_DiscardUnknown() { + xxx_messageInfo_VerifyEmailResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_VerifyEmailResponse proto.InternalMessageInfo + +func (m *VerifyEmailResponse) GetSuccess() bool { + if m != nil { + return m.Success + } + return false +} + +type VerifyEmailRequestSigned struct { + // VerifyEmailRequest + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + // this is payload signed with payload.ownerAnyID + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (m *VerifyEmailRequestSigned) Reset() { *m = VerifyEmailRequestSigned{} } +func (m *VerifyEmailRequestSigned) String() string { return proto.CompactTextString(m) } +func (*VerifyEmailRequestSigned) ProtoMessage() {} +func (*VerifyEmailRequestSigned) Descriptor() ([]byte, []int) { + return fileDescriptor_4feb29dcc5ba50f6, []int{17} +} +func (m *VerifyEmailRequestSigned) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VerifyEmailRequestSigned) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VerifyEmailRequestSigned.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *VerifyEmailRequestSigned) XXX_Merge(src proto.Message) { + xxx_messageInfo_VerifyEmailRequestSigned.Merge(m, src) +} +func (m *VerifyEmailRequestSigned) XXX_Size() int { + return m.Size() +} +func (m *VerifyEmailRequestSigned) XXX_DiscardUnknown() { + xxx_messageInfo_VerifyEmailRequestSigned.DiscardUnknown(m) +} + +var xxx_messageInfo_VerifyEmailRequestSigned proto.InternalMessageInfo + +func (m *VerifyEmailRequestSigned) GetPayload() []byte { + if m != nil { + return m.Payload + } + return nil +} + +func (m *VerifyEmailRequestSigned) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +type IsNameValidRequest struct { + RequestedTier uint32 `protobuf:"varint,1,opt,name=requestedTier,proto3" json:"requestedTier,omitempty"` + RequestedAnyName string `protobuf:"bytes,2,opt,name=requestedAnyName,proto3" json:"requestedAnyName,omitempty"` +} + +func (m *IsNameValidRequest) Reset() { *m = IsNameValidRequest{} } +func (m *IsNameValidRequest) String() string { return proto.CompactTextString(m) } +func (*IsNameValidRequest) ProtoMessage() {} +func (*IsNameValidRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_4feb29dcc5ba50f6, []int{18} +} +func (m *IsNameValidRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IsNameValidRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_IsNameValidRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *IsNameValidRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_IsNameValidRequest.Merge(m, src) +} +func (m *IsNameValidRequest) XXX_Size() int { + return m.Size() +} +func (m *IsNameValidRequest) XXX_DiscardUnknown() { + xxx_messageInfo_IsNameValidRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_IsNameValidRequest proto.InternalMessageInfo + +func (m *IsNameValidRequest) GetRequestedTier() uint32 { + if m != nil { + return m.RequestedTier + } + return 0 +} + +func (m *IsNameValidRequest) GetRequestedAnyName() string { + if m != nil { + return m.RequestedAnyName + } + return "" +} + +type IsNameValidResponse struct { + Code IsNameValidResponse_Code `protobuf:"varint,1,opt,name=code,proto3,enum=IsNameValidResponse_Code" json:"code,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` +} + +func (m *IsNameValidResponse) Reset() { *m = IsNameValidResponse{} } +func (m *IsNameValidResponse) String() string { return proto.CompactTextString(m) } +func (*IsNameValidResponse) ProtoMessage() {} +func (*IsNameValidResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4feb29dcc5ba50f6, []int{19} +} +func (m *IsNameValidResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IsNameValidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_IsNameValidResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *IsNameValidResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_IsNameValidResponse.Merge(m, src) +} +func (m *IsNameValidResponse) XXX_Size() int { + return m.Size() +} +func (m *IsNameValidResponse) XXX_DiscardUnknown() { + xxx_messageInfo_IsNameValidResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_IsNameValidResponse proto.InternalMessageInfo + +func (m *IsNameValidResponse) GetCode() IsNameValidResponse_Code { + if m != nil { + return m.Code + } + return IsNameValidResponse_Valid +} + +func (m *IsNameValidResponse) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +type VerifyAppStoreReceiptRequest struct { + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() + OwnerAnyId string `protobuf:"bytes,1,opt,name=ownerAnyId,proto3" json:"ownerAnyId,omitempty"` + // receipt is a JWT-encoded information about subscription purchase + Receipt string `protobuf:"bytes,2,opt,name=receipt,proto3" json:"receipt,omitempty"` +} + +func (m *VerifyAppStoreReceiptRequest) Reset() { *m = VerifyAppStoreReceiptRequest{} } +func (m *VerifyAppStoreReceiptRequest) String() string { return proto.CompactTextString(m) } +func (*VerifyAppStoreReceiptRequest) ProtoMessage() {} +func (*VerifyAppStoreReceiptRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_4feb29dcc5ba50f6, []int{20} +} +func (m *VerifyAppStoreReceiptRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VerifyAppStoreReceiptRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VerifyAppStoreReceiptRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *VerifyAppStoreReceiptRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_VerifyAppStoreReceiptRequest.Merge(m, src) +} +func (m *VerifyAppStoreReceiptRequest) XXX_Size() int { + return m.Size() +} +func (m *VerifyAppStoreReceiptRequest) XXX_DiscardUnknown() { + xxx_messageInfo_VerifyAppStoreReceiptRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_VerifyAppStoreReceiptRequest proto.InternalMessageInfo + +func (m *VerifyAppStoreReceiptRequest) GetOwnerAnyId() string { + if m != nil { + return m.OwnerAnyId + } + return "" +} + +func (m *VerifyAppStoreReceiptRequest) GetReceipt() string { + if m != nil { + return m.Receipt + } + return "" +} + +type VerifyAppStoreReceiptRequestSigned struct { + // VerifyAppStoreReceiptRequest + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + // this is payload signed with payload.ownerAnyID + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (m *VerifyAppStoreReceiptRequestSigned) Reset() { *m = VerifyAppStoreReceiptRequestSigned{} } +func (m *VerifyAppStoreReceiptRequestSigned) String() string { return proto.CompactTextString(m) } +func (*VerifyAppStoreReceiptRequestSigned) ProtoMessage() {} +func (*VerifyAppStoreReceiptRequestSigned) Descriptor() ([]byte, []int) { + return fileDescriptor_4feb29dcc5ba50f6, []int{21} +} +func (m *VerifyAppStoreReceiptRequestSigned) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VerifyAppStoreReceiptRequestSigned) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VerifyAppStoreReceiptRequestSigned.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *VerifyAppStoreReceiptRequestSigned) XXX_Merge(src proto.Message) { + xxx_messageInfo_VerifyAppStoreReceiptRequestSigned.Merge(m, src) +} +func (m *VerifyAppStoreReceiptRequestSigned) XXX_Size() int { + return m.Size() +} +func (m *VerifyAppStoreReceiptRequestSigned) XXX_DiscardUnknown() { + xxx_messageInfo_VerifyAppStoreReceiptRequestSigned.DiscardUnknown(m) +} + +var xxx_messageInfo_VerifyAppStoreReceiptRequestSigned proto.InternalMessageInfo + +func (m *VerifyAppStoreReceiptRequestSigned) GetPayload() []byte { + if m != nil { + return m.Payload + } + return nil +} + +func (m *VerifyAppStoreReceiptRequestSigned) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +type VerifyAppStoreReceiptResponse struct { +} + +func (m *VerifyAppStoreReceiptResponse) Reset() { *m = VerifyAppStoreReceiptResponse{} } +func (m *VerifyAppStoreReceiptResponse) String() string { return proto.CompactTextString(m) } +func (*VerifyAppStoreReceiptResponse) ProtoMessage() {} +func (*VerifyAppStoreReceiptResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4feb29dcc5ba50f6, []int{22} +} +func (m *VerifyAppStoreReceiptResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VerifyAppStoreReceiptResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VerifyAppStoreReceiptResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *VerifyAppStoreReceiptResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_VerifyAppStoreReceiptResponse.Merge(m, src) +} +func (m *VerifyAppStoreReceiptResponse) XXX_Size() int { + return m.Size() +} +func (m *VerifyAppStoreReceiptResponse) XXX_DiscardUnknown() { + xxx_messageInfo_VerifyAppStoreReceiptResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_VerifyAppStoreReceiptResponse proto.InternalMessageInfo + func init() { proto.RegisterEnum("SubscriptionTier", SubscriptionTier_name, SubscriptionTier_value) proto.RegisterEnum("SubscriptionStatus", SubscriptionStatus_name, SubscriptionStatus_value) proto.RegisterEnum("PaymentMethod", PaymentMethod_name, PaymentMethod_value) + proto.RegisterEnum("ErrorCodes", ErrorCodes_name, ErrorCodes_value) + proto.RegisterEnum("IsNameValidResponse_Code", IsNameValidResponse_Code_name, IsNameValidResponse_Code_value) proto.RegisterType((*GetSubscriptionRequest)(nil), "GetSubscriptionRequest") proto.RegisterType((*GetSubscriptionRequestSigned)(nil), "GetSubscriptionRequestSigned") proto.RegisterType((*GetSubscriptionResponse)(nil), "GetSubscriptionResponse") proto.RegisterType((*BuySubscriptionRequest)(nil), "BuySubscriptionRequest") proto.RegisterType((*BuySubscriptionRequestSigned)(nil), "BuySubscriptionRequestSigned") proto.RegisterType((*BuySubscriptionResponse)(nil), "BuySubscriptionResponse") + proto.RegisterType((*FinalizeSubscriptionRequest)(nil), "FinalizeSubscriptionRequest") + proto.RegisterType((*FinalizeSubscriptionResponse)(nil), "FinalizeSubscriptionResponse") + proto.RegisterType((*FinalizeSubscriptionRequestSigned)(nil), "FinalizeSubscriptionRequestSigned") + proto.RegisterType((*GetSubscriptionPortalLinkRequest)(nil), "GetSubscriptionPortalLinkRequest") + proto.RegisterType((*GetSubscriptionPortalLinkRequestSigned)(nil), "GetSubscriptionPortalLinkRequestSigned") + proto.RegisterType((*GetSubscriptionPortalLinkResponse)(nil), "GetSubscriptionPortalLinkResponse") + proto.RegisterType((*GetVerificationEmailRequest)(nil), "GetVerificationEmailRequest") + proto.RegisterType((*GetVerificationEmailResponse)(nil), "GetVerificationEmailResponse") + proto.RegisterType((*GetVerificationEmailRequestSigned)(nil), "GetVerificationEmailRequestSigned") + proto.RegisterType((*VerifyEmailRequest)(nil), "VerifyEmailRequest") + proto.RegisterType((*VerifyEmailResponse)(nil), "VerifyEmailResponse") + proto.RegisterType((*VerifyEmailRequestSigned)(nil), "VerifyEmailRequestSigned") + proto.RegisterType((*IsNameValidRequest)(nil), "IsNameValidRequest") + proto.RegisterType((*IsNameValidResponse)(nil), "IsNameValidResponse") + proto.RegisterType((*VerifyAppStoreReceiptRequest)(nil), "VerifyAppStoreReceiptRequest") + proto.RegisterType((*VerifyAppStoreReceiptRequestSigned)(nil), "VerifyAppStoreReceiptRequestSigned") + proto.RegisterType((*VerifyAppStoreReceiptResponse)(nil), "VerifyAppStoreReceiptResponse") } func init() { @@ -516,48 +1592,101 @@ func init() { } var fileDescriptor_4feb29dcc5ba50f6 = []byte{ - // 647 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0x51, 0x4b, 0x1b, 0x4b, - 0x14, 0xc7, 0x77, 0x93, 0x5c, 0x8d, 0x47, 0x93, 0xac, 0xa3, 0x57, 0x17, 0xd1, 0x25, 0x2c, 0x5c, - 0x08, 0x5e, 0xee, 0xca, 0xb5, 0x85, 0xb6, 0x50, 0x0a, 0xd1, 0x5a, 0x29, 0xb4, 0x10, 0x36, 0x55, - 0x68, 0x1f, 0x2a, 0x6b, 0xe6, 0x10, 0x97, 0xa6, 0x33, 0xdb, 0x99, 0x59, 0x75, 0xbf, 0x45, 0x3f, - 0x4e, 0x3f, 0x42, 0x1f, 0xed, 0x4b, 0xe9, 0x63, 0xd1, 0x2f, 0x52, 0x76, 0x76, 0xa3, 0x9b, 0xc4, - 0xd8, 0xd2, 0xbe, 0xec, 0xce, 0xf9, 0x9d, 0x33, 0xff, 0x99, 0xff, 0xcc, 0x61, 0xe0, 0x49, 0x14, - 0x24, 0xef, 0x91, 0x29, 0x89, 0xe2, 0x34, 0xec, 0xe1, 0xd6, 0x68, 0x18, 0x09, 0xae, 0xf8, 0x96, - 0xfe, 0xca, 0xb1, 0x94, 0xa7, 0xa9, 0xfb, 0x10, 0x56, 0xf6, 0x51, 0x75, 0xe3, 0x63, 0xd9, 0x13, - 0x61, 0xa4, 0x42, 0xce, 0x7c, 0xfc, 0x10, 0xa3, 0x54, 0xc4, 0x01, 0xe0, 0x67, 0x0c, 0x45, 0x9b, - 0x25, 0xcf, 0x9f, 0xda, 0x66, 0xd3, 0x6c, 0xcd, 0xf9, 0x05, 0xe2, 0x1e, 0xc2, 0xfa, 0xed, 0x33, - 0xbb, 0x61, 0x9f, 0x21, 0x25, 0x36, 0xcc, 0x46, 0x41, 0x32, 0xe0, 0x01, 0xd5, 0x93, 0x17, 0xfc, - 0x61, 0x48, 0xd6, 0x61, 0x4e, 0x86, 0x7d, 0x16, 0xa8, 0x58, 0xa0, 0x5d, 0xd2, 0xb9, 0x1b, 0xe0, - 0x7e, 0x2d, 0xc1, 0xea, 0x84, 0xb0, 0x8c, 0x38, 0x93, 0x48, 0xfe, 0x81, 0x8a, 0x0a, 0x51, 0x68, - 0xc1, 0xfa, 0xf6, 0xa2, 0x57, 0x2c, 0x7a, 0x15, 0xa2, 0xf0, 0x75, 0x9a, 0xfc, 0x0b, 0x33, 0x52, - 0x05, 0x2a, 0x96, 0x5a, 0xbd, 0xbe, 0xbd, 0x34, 0x52, 0xd8, 0xd5, 0x29, 0x3f, 0x2f, 0x21, 0x4d, - 0x98, 0xa7, 0x81, 0xc2, 0xae, 0x0a, 0x84, 0x42, 0x6a, 0x97, 0x9b, 0x66, 0xab, 0xe2, 0x17, 0x11, - 0x59, 0x83, 0x6a, 0x1a, 0xee, 0x31, 0x2a, 0xed, 0x8a, 0x4e, 0x5f, 0xc7, 0xe9, 0xec, 0x50, 0xb6, - 0x63, 0xc5, 0x7d, 0x64, 0x78, 0x66, 0xff, 0xd5, 0x34, 0x5b, 0x55, 0xbf, 0x88, 0xc8, 0x7f, 0x50, - 0x65, 0x78, 0xae, 0xd2, 0xed, 0xd9, 0x33, 0xd3, 0xf6, 0x7d, 0x5d, 0x42, 0x5c, 0x58, 0x18, 0x8e, - 0xf5, 0x82, 0xb3, 0x7a, 0xc1, 0x11, 0x46, 0xee, 0x43, 0x2d, 0xbf, 0xcc, 0x97, 0xa8, 0x4e, 0x38, - 0xb5, 0xab, 0x5a, 0xb7, 0xee, 0x75, 0x8a, 0xd4, 0x1f, 0x2d, 0x72, 0xbf, 0x98, 0xb0, 0xb2, 0x13, - 0x27, 0xbf, 0x71, 0xd7, 0xa4, 0x05, 0x0d, 0x1d, 0xed, 0xa9, 0x93, 0x36, 0xa5, 0x02, 0x65, 0x76, - 0xb2, 0x73, 0xfe, 0x38, 0x26, 0x0f, 0xa0, 0x26, 0x32, 0x51, 0xa4, 0xda, 0x72, 0x79, 0x9a, 0xe5, - 0xd1, 0xba, 0x49, 0x4f, 0x95, 0x5f, 0xf1, 0x74, 0x08, 0xeb, 0xb7, 0x5b, 0xfa, 0xc3, 0x26, 0x7c, - 0x04, 0xab, 0x13, 0xba, 0x79, 0x0f, 0x3a, 0x00, 0xf9, 0x1e, 0x0e, 0xc4, 0x60, 0x78, 0x56, 0x37, - 0x64, 0x93, 0x82, 0x35, 0xee, 0x95, 0x58, 0xb0, 0x90, 0xfe, 0x8f, 0x0e, 0xd8, 0x3b, 0xc6, 0xcf, - 0x98, 0x65, 0x90, 0x06, 0xcc, 0x6b, 0xf2, 0x4c, 0x84, 0xc8, 0xa8, 0x65, 0x92, 0x55, 0x58, 0xd2, - 0xa0, 0x1b, 0x47, 0x11, 0x17, 0x0a, 0xc5, 0xff, 0xaf, 0x31, 0x10, 0x56, 0x89, 0x2c, 0x83, 0xa5, - 0x13, 0x9d, 0x40, 0x09, 0xce, 0x32, 0x5a, 0xde, 0x3c, 0x07, 0x32, 0xd9, 0xd3, 0x84, 0x40, 0x3d, - 0x1b, 0x15, 0x56, 0xba, 0x61, 0x1d, 0x64, 0x34, 0x64, 0x7d, 0xcb, 0x24, 0x8b, 0x50, 0xcb, 0x59, - 0xbb, 0xa7, 0xc2, 0x53, 0xb4, 0x4a, 0x85, 0xb2, 0xbd, 0xf3, 0x28, 0x14, 0x48, 0xad, 0x32, 0x59, - 0x82, 0x46, 0xce, 0x76, 0x03, 0xd6, 0xc3, 0x01, 0x52, 0xab, 0xb2, 0xf9, 0x16, 0x6a, 0x23, 0x57, - 0x92, 0x5a, 0xc9, 0x46, 0x47, 0xbb, 0x81, 0xa0, 0x96, 0x91, 0xaa, 0x0f, 0x81, 0x48, 0x22, 0xc5, - 0x2d, 0x33, 0x55, 0xca, 0x51, 0x3b, 0x8a, 0x06, 0xd8, 0x09, 0x92, 0xcc, 0x59, 0x0e, 0xf7, 0x39, - 0xef, 0x67, 0xb4, 0xbc, 0xfd, 0xc9, 0x84, 0xe5, 0x36, 0x4b, 0xf2, 0x35, 0x3a, 0x82, 0xf7, 0x50, - 0xca, 0x90, 0xf5, 0x89, 0x0f, 0x7f, 0x8f, 0xbd, 0x0b, 0xb9, 0xeb, 0x0d, 0xef, 0xae, 0x87, 0x68, - 0xcd, 0xf6, 0xa6, 0x3c, 0x27, 0xae, 0x41, 0x5e, 0x40, 0x63, 0xec, 0x9e, 0xc9, 0x86, 0x77, 0x57, - 0x47, 0xad, 0xd9, 0xde, 0x94, 0xc6, 0x70, 0x8d, 0x9d, 0xc7, 0x9f, 0x2f, 0x1d, 0xf3, 0xe2, 0xd2, - 0x31, 0xbf, 0x5f, 0x3a, 0xe6, 0xc7, 0x2b, 0xc7, 0xb8, 0xb8, 0x72, 0x8c, 0x6f, 0x57, 0x8e, 0xf1, - 0xc6, 0xfd, 0xf9, 0x33, 0x7d, 0x3c, 0xa3, 0x7f, 0xf7, 0x7e, 0x04, 0x00, 0x00, 0xff, 0xff, 0xda, - 0x2c, 0x8d, 0x51, 0xd3, 0x05, 0x00, 0x00, + // 1495 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x4b, 0x6f, 0x1b, 0x47, + 0x12, 0xe6, 0xf0, 0x25, 0xb1, 0xf4, 0x6a, 0x35, 0x29, 0x79, 0x44, 0x4b, 0x5c, 0x79, 0xf6, 0x25, + 0x68, 0xb1, 0x63, 0xac, 0xd7, 0x87, 0xc5, 0x62, 0xb1, 0x08, 0x25, 0x51, 0x8a, 0x00, 0x47, 0x11, + 0x48, 0xda, 0x4e, 0xe2, 0x20, 0xc9, 0x88, 0x53, 0xa2, 0x26, 0x1e, 0x75, 0x4f, 0x7a, 0x9a, 0x92, + 0x99, 0x5f, 0x90, 0xdc, 0x02, 0xe4, 0x90, 0x1f, 0x94, 0x4b, 0x8e, 0xbe, 0x04, 0xf0, 0x31, 0xb1, + 0xff, 0x40, 0x8e, 0x39, 0x06, 0xdd, 0x33, 0x14, 0x87, 0xe2, 0x88, 0x52, 0x2c, 0xe4, 0x62, 0x4d, + 0x7f, 0xdd, 0x55, 0x5d, 0xf5, 0xd5, 0xa3, 0x8b, 0x86, 0xff, 0x07, 0x4e, 0xff, 0x14, 0x99, 0x0c, + 0x51, 0x9c, 0x79, 0x1d, 0xbc, 0x3f, 0xba, 0x0c, 0x04, 0x97, 0xfc, 0xbe, 0xfe, 0x37, 0xbc, 0xb4, + 0x65, 0x6b, 0xb4, 0xba, 0xf3, 0xb6, 0xf2, 0x9f, 0x4a, 0x0f, 0x45, 0x18, 0x69, 0xb1, 0xfe, 0x03, + 0xcb, 0x7b, 0x28, 0x5b, 0xbd, 0xa3, 0xb0, 0x23, 0xbc, 0x40, 0x7a, 0x9c, 0x35, 0xf1, 0x8b, 0x1e, + 0x86, 0x92, 0xd6, 0x00, 0xf8, 0x39, 0x43, 0x51, 0x67, 0xfd, 0xfd, 0x1d, 0xd3, 0x58, 0x37, 0x36, + 0x4a, 0xcd, 0x04, 0x62, 0x3d, 0x81, 0xd5, 0x74, 0xc9, 0x96, 0xd7, 0x65, 0xe8, 0x52, 0x13, 0xa6, + 0x02, 0xa7, 0xef, 0x73, 0xc7, 0xd5, 0xc2, 0xb3, 0xcd, 0xc1, 0x92, 0xae, 0x42, 0x29, 0xf4, 0xba, + 0xcc, 0x91, 0x3d, 0x81, 0x66, 0x56, 0xef, 0x0d, 0x01, 0xeb, 0x97, 0x2c, 0xdc, 0x19, 0x53, 0x1c, + 0x06, 0x9c, 0x85, 0x48, 0x29, 0xe4, 0x95, 0xf1, 0x5a, 0xe1, 0x5c, 0x53, 0x7f, 0xd3, 0x7f, 0x40, + 0x31, 0x94, 0x8e, 0xec, 0x85, 0x5a, 0xd5, 0xfc, 0x83, 0xb2, 0x9d, 0x14, 0x6d, 0xe9, 0xad, 0x66, + 0x7c, 0x84, 0xae, 0xc3, 0x8c, 0xeb, 0x48, 0x6c, 0x49, 0x47, 0x48, 0x74, 0xcd, 0xdc, 0xba, 0xb1, + 0x91, 0x6f, 0x26, 0x21, 0x5a, 0x85, 0x69, 0xb5, 0x6c, 0x30, 0x37, 0x34, 0xf3, 0x7a, 0xfb, 0x62, + 0xad, 0xa4, 0xbd, 0xb0, 0xde, 0x93, 0xbc, 0x89, 0x0c, 0xcf, 0xcd, 0xc2, 0xba, 0xb1, 0x31, 0xdd, + 0x4c, 0x42, 0xf4, 0x21, 0xcc, 0xc5, 0x64, 0xbf, 0x87, 0xf2, 0x84, 0xbb, 0x66, 0x51, 0xdb, 0x34, + 0x6f, 0x1f, 0x26, 0xd1, 0xe6, 0xe8, 0x21, 0xba, 0x09, 0x44, 0x44, 0xdc, 0xa1, 0x5b, 0x67, 0xfd, + 0x03, 0xe7, 0x14, 0xcd, 0x29, 0x4d, 0xf8, 0x18, 0xae, 0xc8, 0xeb, 0x85, 0x28, 0x1a, 0xa7, 0x8e, + 0xe7, 0x9b, 0xd3, 0xfa, 0xd0, 0x10, 0xa0, 0x0f, 0x61, 0x29, 0x8c, 0xbc, 0x3f, 0xc2, 0x36, 0x3f, + 0xc0, 0xf3, 0xd0, 0x47, 0x29, 0x51, 0x98, 0x25, 0x6d, 0x6b, 0xfa, 0xa6, 0xf5, 0x55, 0x16, 0x96, + 0xb7, 0x7a, 0xfd, 0xeb, 0xb2, 0xc0, 0x1d, 0xcb, 0x02, 0x97, 0x6e, 0xc0, 0x82, 0x5e, 0x35, 0xe4, + 0x49, 0xdd, 0x75, 0x05, 0x86, 0x51, 0x18, 0x4a, 0xcd, 0xcb, 0x30, 0xfd, 0x0b, 0xcc, 0x5d, 0x38, + 0xd3, 0x56, 0x41, 0xcc, 0xe9, 0x20, 0x8e, 0x82, 0xe3, 0x04, 0xe6, 0xdf, 0x96, 0xc0, 0xc2, 0x4d, + 0x08, 0x2c, 0x5e, 0x22, 0x50, 0x65, 0x75, 0x3a, 0x13, 0xb7, 0xcc, 0xea, 0xa7, 0x70, 0x67, 0x4c, + 0x6f, 0x9c, 0xd4, 0x35, 0x80, 0xd8, 0x9b, 0xc7, 0xc2, 0x1f, 0x50, 0x3c, 0x44, 0x94, 0xe2, 0x23, + 0xcf, 0xf7, 0x3d, 0xd6, 0xdd, 0xdf, 0x89, 0xc9, 0x1d, 0x02, 0xd6, 0xb7, 0x06, 0xdc, 0xdd, 0xf5, + 0x98, 0xe3, 0x7b, 0x5f, 0xe2, 0x1f, 0x1b, 0xc0, 0x34, 0x92, 0x73, 0xe9, 0x24, 0x5b, 0x35, 0x58, + 0x4d, 0x37, 0x2a, 0xf2, 0xd9, 0x7a, 0x06, 0xf7, 0x26, 0x18, 0x7d, 0x4b, 0xae, 0xb7, 0x60, 0xfd, + 0x52, 0x03, 0x39, 0xe4, 0x42, 0x3a, 0xfe, 0x23, 0x8f, 0x3d, 0xbf, 0x21, 0x2d, 0xd6, 0x67, 0xf0, + 0xb7, 0xeb, 0x74, 0xdc, 0xd2, 0xca, 0x3a, 0xdc, 0x9b, 0x70, 0x43, 0x9c, 0x1b, 0xab, 0x50, 0x0a, + 0x34, 0x3a, 0x4c, 0x8d, 0x21, 0x60, 0x7d, 0x6d, 0xc0, 0xdd, 0x3d, 0x94, 0x4f, 0x50, 0x78, 0xc7, + 0x5e, 0xc7, 0x51, 0x3a, 0x74, 0x16, 0xdf, 0x34, 0xf6, 0x15, 0x28, 0xa0, 0x2e, 0x83, 0x28, 0xe2, + 0xd1, 0xe2, 0xea, 0x1e, 0x92, 0x9b, 0xd4, 0x43, 0x6a, 0xfa, 0x39, 0x48, 0x31, 0x65, 0x18, 0xf1, + 0x09, 0xa6, 0xde, 0x92, 0x4b, 0x01, 0x54, 0x6b, 0xee, 0xff, 0x2e, 0xf7, 0x6f, 0x9e, 0xfa, 0x14, + 0xf2, 0x1d, 0xee, 0x0e, 0xd2, 0x5d, 0x7f, 0x5b, 0xf7, 0xa1, 0x3c, 0x72, 0x67, 0x1c, 0x31, 0x13, + 0xa6, 0xc2, 0x5e, 0xa7, 0xa3, 0x94, 0x19, 0x9a, 0xaf, 0xc1, 0xd2, 0x6a, 0x82, 0x39, 0x6e, 0xe4, + 0x2d, 0x1d, 0x3f, 0x06, 0xba, 0x1f, 0xaa, 0x8a, 0x7b, 0xe2, 0xf8, 0x9e, 0x3b, 0x70, 0x7c, 0xac, + 0xd5, 0x1a, 0x69, 0xad, 0x36, 0xad, 0x9e, 0xb3, 0x57, 0xd4, 0xf3, 0xcf, 0x06, 0x94, 0x47, 0x2e, + 0x8a, 0xbd, 0xfd, 0x67, 0x4c, 0x8c, 0xa1, 0xbb, 0xf4, 0x8a, 0x9d, 0x72, 0xc6, 0xde, 0xe6, 0x2e, + 0x46, 0x9c, 0xe9, 0xe7, 0x17, 0x2f, 0xf2, 0x3d, 0xbe, 0x2d, 0x09, 0x59, 0x7d, 0xc8, 0xab, 0xf3, + 0xb4, 0x04, 0x05, 0xad, 0x85, 0x64, 0xe8, 0x2c, 0x4c, 0x1f, 0xf0, 0x1d, 0x2e, 0xeb, 0xac, 0x4f, + 0x0c, 0xb5, 0x6a, 0x73, 0xde, 0x3a, 0xe1, 0x42, 0x92, 0x2c, 0x9d, 0x81, 0xa9, 0x36, 0xe7, 0x8f, + 0x38, 0xeb, 0x92, 0x1c, 0x2d, 0xc3, 0xc2, 0xbb, 0x4e, 0xb8, 0xcf, 0xce, 0x94, 0xe0, 0xf6, 0x89, + 0x23, 0x42, 0x92, 0xa7, 0x4b, 0xb0, 0xa8, 0xbc, 0xdd, 0x45, 0x4d, 0xd8, 0x01, 0x57, 0xf6, 0x91, + 0x02, 0x5d, 0x84, 0xb9, 0x6d, 0x87, 0x1d, 0x70, 0xd9, 0x44, 0x35, 0x16, 0x21, 0x29, 0x5a, 0x1f, + 0xc0, 0x6a, 0x14, 0x9f, 0x7a, 0x10, 0xb4, 0x24, 0x17, 0xd8, 0xc4, 0x0e, 0x7a, 0x81, 0xbc, 0x69, + 0x3a, 0x99, 0x30, 0x25, 0x22, 0x89, 0xd8, 0xb1, 0xc1, 0xd2, 0xfa, 0x18, 0xac, 0x49, 0x9a, 0x6f, + 0x99, 0x03, 0x7f, 0x82, 0xb5, 0x2b, 0xb4, 0x47, 0x01, 0xd8, 0xfc, 0xde, 0x00, 0x92, 0xec, 0x33, + 0x3a, 0xfa, 0x0b, 0x30, 0xa3, 0xfe, 0x3e, 0x66, 0xcf, 0x19, 0x3f, 0x67, 0x24, 0x43, 0x09, 0xcc, + 0x2a, 0xa0, 0xf1, 0x22, 0xf0, 0xb9, 0x40, 0x41, 0x0c, 0x6a, 0x42, 0x45, 0x21, 0x5b, 0x3d, 0xcf, + 0x77, 0x51, 0xfc, 0xeb, 0x29, 0xe2, 0xf3, 0x76, 0xa3, 0xd5, 0x26, 0x59, 0x5a, 0x85, 0x65, 0xb5, + 0xb3, 0xcd, 0xb7, 0x05, 0x3a, 0x92, 0x27, 0xf6, 0x72, 0xb4, 0x02, 0x24, 0x29, 0xf5, 0x21, 0x3a, + 0x82, 0xe4, 0xe9, 0x32, 0xd0, 0x51, 0x09, 0x8d, 0x17, 0x54, 0xcc, 0x12, 0xa7, 0x0f, 0xfd, 0x5e, + 0x48, 0x8a, 0x03, 0xb0, 0xce, 0xfa, 0xb2, 0x1f, 0x60, 0x1b, 0x9d, 0x53, 0x32, 0xb5, 0x19, 0x02, + 0x1d, 0x1f, 0xec, 0x54, 0x1c, 0xa3, 0xaf, 0xa1, 0x23, 0x17, 0xd0, 0x21, 0x32, 0xd7, 0x63, 0x5d, + 0x62, 0x28, 0xdf, 0x22, 0xa8, 0xde, 0x91, 0xde, 0x19, 0x92, 0x2c, 0xfd, 0x2b, 0xdc, 0x1b, 0x39, + 0xa4, 0x42, 0xe1, 0x09, 0x0c, 0xe3, 0x57, 0x49, 0x37, 0x28, 0x92, 0xdb, 0xfc, 0xce, 0x80, 0xb9, + 0x91, 0xc9, 0x83, 0xce, 0x03, 0x44, 0x5f, 0xdb, 0x8e, 0x70, 0x23, 0xda, 0xe2, 0xb5, 0xe8, 0x07, + 0x92, 0x13, 0x83, 0x52, 0x98, 0x8f, 0x90, 0x7a, 0x10, 0xf8, 0x78, 0xe8, 0xf4, 0x49, 0x56, 0x79, + 0x14, 0x61, 0x7b, 0x9c, 0x77, 0x23, 0x50, 0x33, 0x95, 0x38, 0xb8, 0xcf, 0x9c, 0x20, 0x88, 0x12, + 0x36, 0x79, 0x34, 0x82, 0x0b, 0xc3, 0x7b, 0x0f, 0x38, 0x43, 0x52, 0xdc, 0xfc, 0x31, 0x07, 0xd0, + 0x10, 0x82, 0x0b, 0x55, 0x2e, 0xa1, 0xda, 0x7e, 0xcc, 0xf0, 0x45, 0x80, 0x1d, 0x89, 0xca, 0xac, + 0x32, 0x2c, 0x0c, 0xfb, 0x57, 0xe3, 0x34, 0x90, 0xaa, 0x76, 0x2a, 0x40, 0xe2, 0xea, 0x68, 0x0d, + 0xb2, 0x87, 0x64, 0xe9, 0x1c, 0x94, 0x14, 0xdb, 0x4f, 0x45, 0x54, 0x45, 0x71, 0x1e, 0x1c, 0x70, + 0xb9, 0xcb, 0x7b, 0xcc, 0x25, 0xf9, 0x01, 0xb2, 0xcf, 0x9c, 0x88, 0xbd, 0x82, 0x8a, 0xe6, 0x08, + 0x2b, 0x91, 0x6c, 0x51, 0x59, 0xb1, 0xe5, 0x0c, 0x9a, 0x06, 0x99, 0x52, 0xe5, 0x39, 0x88, 0xcb, + 0xb4, 0x72, 0x4c, 0x05, 0xb0, 0xee, 0x0b, 0x74, 0xdc, 0x7e, 0x1c, 0x89, 0x92, 0x8e, 0x4d, 0xef, + 0x28, 0xbc, 0xb8, 0x0f, 0x14, 0x81, 0x0a, 0xd1, 0x4a, 0x55, 0x90, 0x90, 0xcc, 0x28, 0xd3, 0x75, + 0xdb, 0xd4, 0xe0, 0x2e, 0x17, 0xa7, 0x8e, 0x24, 0xb3, 0x2a, 0x43, 0x35, 0x1a, 0xeb, 0x8c, 0x5e, + 0x17, 0x74, 0xc9, 0xdc, 0xc5, 0xf9, 0x78, 0xa7, 0x85, 0x4c, 0x92, 0x79, 0x65, 0x82, 0x46, 0x77, + 0x1d, 0xcf, 0x47, 0xb7, 0xcd, 0x5b, 0xc8, 0x5c, 0xb2, 0xa0, 0x4c, 0xd0, 0x70, 0xe3, 0x45, 0xe0, + 0x09, 0x74, 0x09, 0x51, 0x26, 0x0c, 0xaf, 0x53, 0x0c, 0x93, 0x45, 0x7a, 0x07, 0xca, 0x71, 0xa0, + 0xce, 0xa2, 0xfe, 0xa6, 0xab, 0x8c, 0x50, 0xba, 0x06, 0x2b, 0x51, 0xa8, 0x7b, 0xa2, 0x73, 0xe2, + 0x84, 0xd8, 0xc4, 0xae, 0x17, 0x4a, 0x11, 0xe5, 0x50, 0x59, 0x15, 0x8b, 0xde, 0x1e, 0x1d, 0x74, + 0x18, 0x9e, 0x93, 0x0a, 0x25, 0x30, 0xa3, 0x83, 0xf8, 0xfe, 0xf1, 0x71, 0x88, 0x92, 0xbc, 0xca, + 0x3f, 0xf8, 0xb5, 0x00, 0x95, 0x3a, 0xeb, 0xc7, 0xf4, 0x1e, 0x0a, 0xae, 0xde, 0x0e, 0x8f, 0x75, + 0x69, 0x13, 0x96, 0x2e, 0xcd, 0x0b, 0x71, 0x09, 0xac, 0xd9, 0x93, 0x7e, 0x87, 0x55, 0x4d, 0xfb, + 0x8a, 0x5f, 0x53, 0x56, 0x86, 0xfe, 0x17, 0x66, 0x12, 0x1d, 0x9b, 0x96, 0xed, 0xf1, 0xc7, 0xa4, + 0x5a, 0x49, 0x6b, 0xea, 0x56, 0x86, 0x3e, 0x82, 0x85, 0x4b, 0x13, 0x2d, 0x5d, 0xb3, 0x27, 0xcd, + 0xce, 0x55, 0xd3, 0xbe, 0x62, 0x04, 0xb6, 0x32, 0xf4, 0x19, 0x54, 0xd2, 0x06, 0x42, 0x6a, 0xd9, + 0xd7, 0xce, 0x89, 0xd5, 0x35, 0x7b, 0xe2, 0xac, 0x99, 0xa1, 0x9f, 0xc3, 0xca, 0x95, 0xa3, 0x16, + 0xfd, 0xbb, 0x7d, 0xb3, 0x41, 0xaf, 0x6a, 0xd9, 0xd7, 0xce, 0x6b, 0x91, 0x23, 0x69, 0x73, 0x0e, + 0xd5, 0xd2, 0x93, 0xc7, 0x9f, 0xea, 0x9a, 0x3d, 0x71, 0x84, 0xca, 0xd0, 0x77, 0x60, 0x26, 0x31, + 0x42, 0xd0, 0x15, 0xfb, 0xaa, 0x81, 0xa2, 0x5a, 0xb1, 0x53, 0x86, 0x93, 0x28, 0xe2, 0x7b, 0x28, + 0xeb, 0xbe, 0xaf, 0x2a, 0x3a, 0xa4, 0xcb, 0xea, 0x46, 0xfd, 0x39, 0x2a, 0xbe, 0x98, 0xc0, 0x2f, + 0x64, 0x3f, 0x81, 0xa5, 0xd4, 0x87, 0x86, 0xfe, 0xd9, 0xbe, 0xfe, 0x79, 0xab, 0xd6, 0xec, 0x89, + 0xaf, 0x94, 0x95, 0xd9, 0xfa, 0xdf, 0x0f, 0xaf, 0x6b, 0xc6, 0xcb, 0xd7, 0x35, 0xe3, 0xa7, 0xd7, + 0x35, 0xe3, 0x9b, 0x37, 0xb5, 0xcc, 0xcb, 0x37, 0xb5, 0xcc, 0xab, 0x37, 0xb5, 0xcc, 0x47, 0xd6, + 0xf5, 0xff, 0xd7, 0x71, 0x54, 0xd4, 0x7f, 0xfe, 0xfd, 0x5b, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf3, + 0xa2, 0x9f, 0x51, 0x58, 0x11, 0x00, 0x00, } func (m *GetSubscriptionRequest) Marshal() (dAtA []byte, err error) { @@ -647,19 +1776,33 @@ func (m *GetSubscriptionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l + if m.SubscribeToNewsletter { + i-- + if m.SubscribeToNewsletter { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x48 + } + if len(m.UserEmail) > 0 { + i -= len(m.UserEmail) + copy(dAtA[i:], m.UserEmail) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.UserEmail))) + i-- + dAtA[i] = 0x42 + } + if len(m.RequestedAnyName) > 0 { + i -= len(m.RequestedAnyName) + copy(dAtA[i:], m.RequestedAnyName) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.RequestedAnyName))) + i-- + dAtA[i] = 0x3a + } if m.PaymentMethod != 0 { i = encodeVarintPaymentservice(dAtA, i, uint64(m.PaymentMethod)) i-- - dAtA[i] = 0x40 - } - if m.NextTierEnds != 0 { - i = encodeVarintPaymentservice(dAtA, i, uint64(m.NextTierEnds)) - i-- - dAtA[i] = 0x38 - } - if m.NextTier != 0 { - i = encodeVarintPaymentservice(dAtA, i, uint64(m.NextTier)) - i-- dAtA[i] = 0x30 } if m.IsAutoRenew { @@ -715,6 +1858,20 @@ func (m *BuySubscriptionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l + if len(m.UserEmail) > 0 { + i -= len(m.UserEmail) + copy(dAtA[i:], m.UserEmail) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.UserEmail))) + i-- + dAtA[i] = 0x32 + } + if len(m.RequestedAnyName) > 0 { + i -= len(m.RequestedAnyName) + copy(dAtA[i:], m.RequestedAnyName) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.RequestedAnyName))) + i-- + dAtA[i] = 0x2a + } if m.PaymentMethod != 0 { i = encodeVarintPaymentservice(dAtA, i, uint64(m.PaymentMethod)) i-- @@ -732,10 +1889,10 @@ func (m *BuySubscriptionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) i-- dAtA[i] = 0x12 } - if len(m.OwnerAnyID) > 0 { - i -= len(m.OwnerAnyID) - copy(dAtA[i:], m.OwnerAnyID) - i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.OwnerAnyID))) + if len(m.OwnerAnyId) > 0 { + i -= len(m.OwnerAnyId) + copy(dAtA[i:], m.OwnerAnyId) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.OwnerAnyId))) i-- dAtA[i] = 0xa } @@ -799,6 +1956,13 @@ func (m *BuySubscriptionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l + if len(m.BillingID) > 0 { + i -= len(m.BillingID) + copy(dAtA[i:], m.BillingID) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.BillingID))) + i-- + dAtA[i] = 0x12 + } if len(m.PaymentUrl) > 0 { i -= len(m.PaymentUrl) copy(dAtA[i:], m.PaymentUrl) @@ -809,6 +1973,595 @@ func (m *BuySubscriptionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *FinalizeSubscriptionRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FinalizeSubscriptionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FinalizeSubscriptionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RequestedAnyName) > 0 { + i -= len(m.RequestedAnyName) + copy(dAtA[i:], m.RequestedAnyName) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.RequestedAnyName))) + i-- + dAtA[i] = 0x1a + } + if len(m.OwnerEthAddress) > 0 { + i -= len(m.OwnerEthAddress) + copy(dAtA[i:], m.OwnerEthAddress) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.OwnerEthAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.OwnerAnyId) > 0 { + i -= len(m.OwnerAnyId) + copy(dAtA[i:], m.OwnerAnyId) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.OwnerAnyId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *FinalizeSubscriptionResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FinalizeSubscriptionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FinalizeSubscriptionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *FinalizeSubscriptionRequestSigned) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FinalizeSubscriptionRequestSigned) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FinalizeSubscriptionRequestSigned) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetSubscriptionPortalLinkRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetSubscriptionPortalLinkRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetSubscriptionPortalLinkRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OwnerAnyId) > 0 { + i -= len(m.OwnerAnyId) + copy(dAtA[i:], m.OwnerAnyId) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.OwnerAnyId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetSubscriptionPortalLinkRequestSigned) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetSubscriptionPortalLinkRequestSigned) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetSubscriptionPortalLinkRequestSigned) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetSubscriptionPortalLinkResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetSubscriptionPortalLinkResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetSubscriptionPortalLinkResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PortalUrl) > 0 { + i -= len(m.PortalUrl) + copy(dAtA[i:], m.PortalUrl) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.PortalUrl))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetVerificationEmailRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetVerificationEmailRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetVerificationEmailRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SubscribeToNewsletter { + i-- + if m.SubscribeToNewsletter { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if len(m.Email) > 0 { + i -= len(m.Email) + copy(dAtA[i:], m.Email) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.Email))) + i-- + dAtA[i] = 0x12 + } + if len(m.OwnerAnyId) > 0 { + i -= len(m.OwnerAnyId) + copy(dAtA[i:], m.OwnerAnyId) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.OwnerAnyId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetVerificationEmailResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetVerificationEmailResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetVerificationEmailResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *GetVerificationEmailRequestSigned) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetVerificationEmailRequestSigned) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetVerificationEmailRequestSigned) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *VerifyEmailRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VerifyEmailRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VerifyEmailRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Code) > 0 { + i -= len(m.Code) + copy(dAtA[i:], m.Code) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.Code))) + i-- + dAtA[i] = 0x1a + } + if len(m.OwnerEthAddress) > 0 { + i -= len(m.OwnerEthAddress) + copy(dAtA[i:], m.OwnerEthAddress) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.OwnerEthAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.OwnerAnyId) > 0 { + i -= len(m.OwnerAnyId) + copy(dAtA[i:], m.OwnerAnyId) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.OwnerAnyId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *VerifyEmailResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VerifyEmailResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VerifyEmailResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Success { + i-- + if m.Success { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *VerifyEmailRequestSigned) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VerifyEmailRequestSigned) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VerifyEmailRequestSigned) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *IsNameValidRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *IsNameValidRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IsNameValidRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RequestedAnyName) > 0 { + i -= len(m.RequestedAnyName) + copy(dAtA[i:], m.RequestedAnyName) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.RequestedAnyName))) + i-- + dAtA[i] = 0x12 + } + if m.RequestedTier != 0 { + i = encodeVarintPaymentservice(dAtA, i, uint64(m.RequestedTier)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *IsNameValidResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *IsNameValidResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IsNameValidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if m.Code != 0 { + i = encodeVarintPaymentservice(dAtA, i, uint64(m.Code)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *VerifyAppStoreReceiptRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VerifyAppStoreReceiptRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VerifyAppStoreReceiptRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Receipt) > 0 { + i -= len(m.Receipt) + copy(dAtA[i:], m.Receipt) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.Receipt))) + i-- + dAtA[i] = 0x12 + } + if len(m.OwnerAnyId) > 0 { + i -= len(m.OwnerAnyId) + copy(dAtA[i:], m.OwnerAnyId) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.OwnerAnyId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *VerifyAppStoreReceiptRequestSigned) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VerifyAppStoreReceiptRequestSigned) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VerifyAppStoreReceiptRequestSigned) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintPaymentservice(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *VerifyAppStoreReceiptResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VerifyAppStoreReceiptResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VerifyAppStoreReceiptResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintPaymentservice(dAtA []byte, offset int, v uint64) int { offset -= sovPaymentservice(v) base := offset @@ -871,15 +2624,20 @@ func (m *GetSubscriptionResponse) Size() (n int) { if m.IsAutoRenew { n += 2 } - if m.NextTier != 0 { - n += 1 + sovPaymentservice(uint64(m.NextTier)) - } - if m.NextTierEnds != 0 { - n += 1 + sovPaymentservice(uint64(m.NextTierEnds)) - } if m.PaymentMethod != 0 { n += 1 + sovPaymentservice(uint64(m.PaymentMethod)) } + l = len(m.RequestedAnyName) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + l = len(m.UserEmail) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + if m.SubscribeToNewsletter { + n += 2 + } return n } @@ -889,7 +2647,7 @@ func (m *BuySubscriptionRequest) Size() (n int) { } var l int _ = l - l = len(m.OwnerAnyID) + l = len(m.OwnerAnyId) if l > 0 { n += 1 + l + sovPaymentservice(uint64(l)) } @@ -903,6 +2661,14 @@ func (m *BuySubscriptionRequest) Size() (n int) { if m.PaymentMethod != 0 { n += 1 + sovPaymentservice(uint64(m.PaymentMethod)) } + l = len(m.RequestedAnyName) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + l = len(m.UserEmail) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } return n } @@ -933,6 +2699,271 @@ func (m *BuySubscriptionResponse) Size() (n int) { if l > 0 { n += 1 + l + sovPaymentservice(uint64(l)) } + l = len(m.BillingID) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + return n +} + +func (m *FinalizeSubscriptionRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OwnerAnyId) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + l = len(m.OwnerEthAddress) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + l = len(m.RequestedAnyName) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + return n +} + +func (m *FinalizeSubscriptionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *FinalizeSubscriptionRequestSigned) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + return n +} + +func (m *GetSubscriptionPortalLinkRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OwnerAnyId) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + return n +} + +func (m *GetSubscriptionPortalLinkRequestSigned) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + return n +} + +func (m *GetSubscriptionPortalLinkResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PortalUrl) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + return n +} + +func (m *GetVerificationEmailRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OwnerAnyId) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + l = len(m.Email) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + if m.SubscribeToNewsletter { + n += 2 + } + return n +} + +func (m *GetVerificationEmailResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *GetVerificationEmailRequestSigned) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + return n +} + +func (m *VerifyEmailRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OwnerAnyId) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + l = len(m.OwnerEthAddress) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + l = len(m.Code) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + return n +} + +func (m *VerifyEmailResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Success { + n += 2 + } + return n +} + +func (m *VerifyEmailRequestSigned) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + return n +} + +func (m *IsNameValidRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RequestedTier != 0 { + n += 1 + sovPaymentservice(uint64(m.RequestedTier)) + } + l = len(m.RequestedAnyName) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + return n +} + +func (m *IsNameValidResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Code != 0 { + n += 1 + sovPaymentservice(uint64(m.Code)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + return n +} + +func (m *VerifyAppStoreReceiptRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OwnerAnyId) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + l = len(m.Receipt) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + return n +} + +func (m *VerifyAppStoreReceiptRequestSigned) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovPaymentservice(uint64(l)) + } + return n +} + +func (m *VerifyAppStoreReceiptResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l return n } @@ -1185,7 +3216,7 @@ func (m *GetSubscriptionResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Tier |= SubscriptionTier(b&0x7F) << shift + m.Tier |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -1268,44 +3299,6 @@ func (m *GetSubscriptionResponse) Unmarshal(dAtA []byte) error { } m.IsAutoRenew = bool(v != 0) case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NextTier", wireType) - } - m.NextTier = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPaymentservice - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NextTier |= SubscriptionTier(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NextTierEnds", wireType) - } - m.NextTierEnds = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPaymentservice - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NextTierEnds |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field PaymentMethod", wireType) } @@ -1324,6 +3317,90 @@ func (m *GetSubscriptionResponse) Unmarshal(dAtA []byte) error { break } } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestedAnyName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestedAnyName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UserEmail", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UserEmail = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SubscribeToNewsletter", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SubscribeToNewsletter = bool(v != 0) default: iNdEx = preIndex skippy, err := skipPaymentservice(dAtA[iNdEx:]) @@ -1376,7 +3453,7 @@ func (m *BuySubscriptionRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerAnyID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAnyId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1404,7 +3481,7 @@ func (m *BuySubscriptionRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OwnerAnyID = string(dAtA[iNdEx:postIndex]) + m.OwnerAnyId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -1452,7 +3529,7 @@ func (m *BuySubscriptionRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.RequestedTier |= SubscriptionTier(b&0x7F) << shift + m.RequestedTier |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -1476,6 +3553,70 @@ func (m *BuySubscriptionRequest) Unmarshal(dAtA []byte) error { break } } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestedAnyName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestedAnyName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UserEmail", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UserEmail = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPaymentservice(dAtA[iNdEx:]) @@ -1676,6 +3817,1754 @@ func (m *BuySubscriptionResponse) Unmarshal(dAtA []byte) error { } m.PaymentUrl = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BillingID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BillingID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPaymentservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FinalizeSubscriptionRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FinalizeSubscriptionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FinalizeSubscriptionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAnyId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAnyId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerEthAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerEthAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestedAnyName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestedAnyName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPaymentservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FinalizeSubscriptionResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FinalizeSubscriptionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FinalizeSubscriptionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipPaymentservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FinalizeSubscriptionRequestSigned) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FinalizeSubscriptionRequestSigned: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FinalizeSubscriptionRequestSigned: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) + if m.Payload == nil { + m.Payload = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPaymentservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetSubscriptionPortalLinkRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetSubscriptionPortalLinkRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetSubscriptionPortalLinkRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAnyId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAnyId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPaymentservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetSubscriptionPortalLinkRequestSigned) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetSubscriptionPortalLinkRequestSigned: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetSubscriptionPortalLinkRequestSigned: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) + if m.Payload == nil { + m.Payload = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPaymentservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetSubscriptionPortalLinkResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetSubscriptionPortalLinkResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetSubscriptionPortalLinkResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PortalUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PortalUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPaymentservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetVerificationEmailRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetVerificationEmailRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetVerificationEmailRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAnyId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAnyId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Email", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Email = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SubscribeToNewsletter", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SubscribeToNewsletter = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipPaymentservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetVerificationEmailResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetVerificationEmailResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetVerificationEmailResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipPaymentservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetVerificationEmailRequestSigned) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetVerificationEmailRequestSigned: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetVerificationEmailRequestSigned: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) + if m.Payload == nil { + m.Payload = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPaymentservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VerifyEmailRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VerifyEmailRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VerifyEmailRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAnyId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAnyId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerEthAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerEthAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Code = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPaymentservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VerifyEmailResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VerifyEmailResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VerifyEmailResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Success = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipPaymentservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VerifyEmailRequestSigned) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VerifyEmailRequestSigned: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VerifyEmailRequestSigned: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) + if m.Payload == nil { + m.Payload = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPaymentservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IsNameValidRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: IsNameValidRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IsNameValidRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestedTier", wireType) + } + m.RequestedTier = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestedTier |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestedAnyName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestedAnyName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPaymentservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IsNameValidResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: IsNameValidResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IsNameValidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) + } + m.Code = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Code |= IsNameValidResponse_Code(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPaymentservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VerifyAppStoreReceiptRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VerifyAppStoreReceiptRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VerifyAppStoreReceiptRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAnyId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAnyId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receipt", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Receipt = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPaymentservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VerifyAppStoreReceiptRequestSigned) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VerifyAppStoreReceiptRequestSigned: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VerifyAppStoreReceiptRequestSigned: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) + if m.Payload == nil { + m.Payload = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPaymentservice + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPaymentservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPaymentservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VerifyAppStoreReceiptResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VerifyAppStoreReceiptResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VerifyAppStoreReceiptResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { default: iNdEx = preIndex skippy, err := skipPaymentservice(dAtA[iNdEx:]) diff --git a/paymentservice/paymentserviceproto/paymentservice_drpc.pb.go b/paymentservice/paymentserviceproto/paymentservice_drpc.pb.go index f1c31c07..253b1026 100644 --- a/paymentservice/paymentserviceproto/paymentservice_drpc.pb.go +++ b/paymentservice/paymentserviceproto/paymentservice_drpc.pb.go @@ -41,7 +41,14 @@ type DRPCAnyPaymentProcessingClient interface { DRPCConn() drpc.Conn GetSubscriptionStatus(ctx context.Context, in *GetSubscriptionRequestSigned) (*GetSubscriptionResponse, error) + IsNameValid(ctx context.Context, in *IsNameValidRequest) (*IsNameValidResponse, error) BuySubscription(ctx context.Context, in *BuySubscriptionRequestSigned) (*BuySubscriptionResponse, error) + FinalizeSubscription(ctx context.Context, in *FinalizeSubscriptionRequestSigned) (*FinalizeSubscriptionResponse, error) + GetSubscriptionPortalLink(ctx context.Context, in *GetSubscriptionPortalLinkRequestSigned) (*GetSubscriptionPortalLinkResponse, error) + GetVerificationEmail(ctx context.Context, in *GetVerificationEmailRequestSigned) (*GetVerificationEmailResponse, error) + VerifyEmail(ctx context.Context, in *VerifyEmailRequestSigned) (*VerifyEmailResponse, error) + GetAllTiers(ctx context.Context, in *GetTiersRequestSigned) (*GetTiersResponse, error) + VerifyAppStoreReceipt(ctx context.Context, in *VerifyAppStoreReceiptRequestSigned) (*VerifyAppStoreReceiptResponse, error) } type drpcAnyPaymentProcessingClient struct { @@ -63,6 +70,15 @@ func (c *drpcAnyPaymentProcessingClient) GetSubscriptionStatus(ctx context.Conte return out, nil } +func (c *drpcAnyPaymentProcessingClient) IsNameValid(ctx context.Context, in *IsNameValidRequest) (*IsNameValidResponse, error) { + out := new(IsNameValidResponse) + err := c.cc.Invoke(ctx, "/AnyPaymentProcessing/IsNameValid", drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + func (c *drpcAnyPaymentProcessingClient) BuySubscription(ctx context.Context, in *BuySubscriptionRequestSigned) (*BuySubscriptionResponse, error) { out := new(BuySubscriptionResponse) err := c.cc.Invoke(ctx, "/AnyPaymentProcessing/BuySubscription", drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}, in, out) @@ -72,9 +88,70 @@ func (c *drpcAnyPaymentProcessingClient) BuySubscription(ctx context.Context, in return out, nil } +func (c *drpcAnyPaymentProcessingClient) FinalizeSubscription(ctx context.Context, in *FinalizeSubscriptionRequestSigned) (*FinalizeSubscriptionResponse, error) { + out := new(FinalizeSubscriptionResponse) + err := c.cc.Invoke(ctx, "/AnyPaymentProcessing/FinalizeSubscription", drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *drpcAnyPaymentProcessingClient) GetSubscriptionPortalLink(ctx context.Context, in *GetSubscriptionPortalLinkRequestSigned) (*GetSubscriptionPortalLinkResponse, error) { + out := new(GetSubscriptionPortalLinkResponse) + err := c.cc.Invoke(ctx, "/AnyPaymentProcessing/GetSubscriptionPortalLink", drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *drpcAnyPaymentProcessingClient) GetVerificationEmail(ctx context.Context, in *GetVerificationEmailRequestSigned) (*GetVerificationEmailResponse, error) { + out := new(GetVerificationEmailResponse) + err := c.cc.Invoke(ctx, "/AnyPaymentProcessing/GetVerificationEmail", drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *drpcAnyPaymentProcessingClient) VerifyEmail(ctx context.Context, in *VerifyEmailRequestSigned) (*VerifyEmailResponse, error) { + out := new(VerifyEmailResponse) + err := c.cc.Invoke(ctx, "/AnyPaymentProcessing/VerifyEmail", drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *drpcAnyPaymentProcessingClient) GetAllTiers(ctx context.Context, in *GetTiersRequestSigned) (*GetTiersResponse, error) { + out := new(GetTiersResponse) + err := c.cc.Invoke(ctx, "/AnyPaymentProcessing/GetAllTiers", drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *drpcAnyPaymentProcessingClient) VerifyAppStoreReceipt(ctx context.Context, in *VerifyAppStoreReceiptRequestSigned) (*VerifyAppStoreReceiptResponse, error) { + out := new(VerifyAppStoreReceiptResponse) + err := c.cc.Invoke(ctx, "/AnyPaymentProcessing/VerifyAppStoreReceipt", drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + type DRPCAnyPaymentProcessingServer interface { GetSubscriptionStatus(context.Context, *GetSubscriptionRequestSigned) (*GetSubscriptionResponse, error) + IsNameValid(context.Context, *IsNameValidRequest) (*IsNameValidResponse, error) BuySubscription(context.Context, *BuySubscriptionRequestSigned) (*BuySubscriptionResponse, error) + FinalizeSubscription(context.Context, *FinalizeSubscriptionRequestSigned) (*FinalizeSubscriptionResponse, error) + GetSubscriptionPortalLink(context.Context, *GetSubscriptionPortalLinkRequestSigned) (*GetSubscriptionPortalLinkResponse, error) + GetVerificationEmail(context.Context, *GetVerificationEmailRequestSigned) (*GetVerificationEmailResponse, error) + VerifyEmail(context.Context, *VerifyEmailRequestSigned) (*VerifyEmailResponse, error) + GetAllTiers(context.Context, *GetTiersRequestSigned) (*GetTiersResponse, error) + VerifyAppStoreReceipt(context.Context, *VerifyAppStoreReceiptRequestSigned) (*VerifyAppStoreReceiptResponse, error) } type DRPCAnyPaymentProcessingUnimplementedServer struct{} @@ -83,13 +160,41 @@ func (s *DRPCAnyPaymentProcessingUnimplementedServer) GetSubscriptionStatus(cont return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } +func (s *DRPCAnyPaymentProcessingUnimplementedServer) IsNameValid(context.Context, *IsNameValidRequest) (*IsNameValidResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + func (s *DRPCAnyPaymentProcessingUnimplementedServer) BuySubscription(context.Context, *BuySubscriptionRequestSigned) (*BuySubscriptionResponse, error) { return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } +func (s *DRPCAnyPaymentProcessingUnimplementedServer) FinalizeSubscription(context.Context, *FinalizeSubscriptionRequestSigned) (*FinalizeSubscriptionResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + +func (s *DRPCAnyPaymentProcessingUnimplementedServer) GetSubscriptionPortalLink(context.Context, *GetSubscriptionPortalLinkRequestSigned) (*GetSubscriptionPortalLinkResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + +func (s *DRPCAnyPaymentProcessingUnimplementedServer) GetVerificationEmail(context.Context, *GetVerificationEmailRequestSigned) (*GetVerificationEmailResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + +func (s *DRPCAnyPaymentProcessingUnimplementedServer) VerifyEmail(context.Context, *VerifyEmailRequestSigned) (*VerifyEmailResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + +func (s *DRPCAnyPaymentProcessingUnimplementedServer) GetAllTiers(context.Context, *GetTiersRequestSigned) (*GetTiersResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + +func (s *DRPCAnyPaymentProcessingUnimplementedServer) VerifyAppStoreReceipt(context.Context, *VerifyAppStoreReceiptRequestSigned) (*VerifyAppStoreReceiptResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + type DRPCAnyPaymentProcessingDescription struct{} -func (DRPCAnyPaymentProcessingDescription) NumMethods() int { return 2 } +func (DRPCAnyPaymentProcessingDescription) NumMethods() int { return 9 } func (DRPCAnyPaymentProcessingDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { switch n { @@ -103,6 +208,15 @@ func (DRPCAnyPaymentProcessingDescription) Method(n int) (string, drpc.Encoding, ) }, DRPCAnyPaymentProcessingServer.GetSubscriptionStatus, true case 1: + return "/AnyPaymentProcessing/IsNameValid", drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCAnyPaymentProcessingServer). + IsNameValid( + ctx, + in1.(*IsNameValidRequest), + ) + }, DRPCAnyPaymentProcessingServer.IsNameValid, true + case 2: return "/AnyPaymentProcessing/BuySubscription", drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCAnyPaymentProcessingServer). @@ -111,6 +225,60 @@ func (DRPCAnyPaymentProcessingDescription) Method(n int) (string, drpc.Encoding, in1.(*BuySubscriptionRequestSigned), ) }, DRPCAnyPaymentProcessingServer.BuySubscription, true + case 3: + return "/AnyPaymentProcessing/FinalizeSubscription", drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCAnyPaymentProcessingServer). + FinalizeSubscription( + ctx, + in1.(*FinalizeSubscriptionRequestSigned), + ) + }, DRPCAnyPaymentProcessingServer.FinalizeSubscription, true + case 4: + return "/AnyPaymentProcessing/GetSubscriptionPortalLink", drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCAnyPaymentProcessingServer). + GetSubscriptionPortalLink( + ctx, + in1.(*GetSubscriptionPortalLinkRequestSigned), + ) + }, DRPCAnyPaymentProcessingServer.GetSubscriptionPortalLink, true + case 5: + return "/AnyPaymentProcessing/GetVerificationEmail", drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCAnyPaymentProcessingServer). + GetVerificationEmail( + ctx, + in1.(*GetVerificationEmailRequestSigned), + ) + }, DRPCAnyPaymentProcessingServer.GetVerificationEmail, true + case 6: + return "/AnyPaymentProcessing/VerifyEmail", drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCAnyPaymentProcessingServer). + VerifyEmail( + ctx, + in1.(*VerifyEmailRequestSigned), + ) + }, DRPCAnyPaymentProcessingServer.VerifyEmail, true + case 7: + return "/AnyPaymentProcessing/GetAllTiers", drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCAnyPaymentProcessingServer). + GetAllTiers( + ctx, + in1.(*GetTiersRequestSigned), + ) + }, DRPCAnyPaymentProcessingServer.GetAllTiers, true + case 8: + return "/AnyPaymentProcessing/VerifyAppStoreReceipt", drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCAnyPaymentProcessingServer). + VerifyAppStoreReceipt( + ctx, + in1.(*VerifyAppStoreReceiptRequestSigned), + ) + }, DRPCAnyPaymentProcessingServer.VerifyAppStoreReceipt, true default: return "", nil, nil, nil, false } @@ -136,6 +304,22 @@ func (x *drpcAnyPaymentProcessing_GetSubscriptionStatusStream) SendAndClose(m *G return x.CloseSend() } +type DRPCAnyPaymentProcessing_IsNameValidStream interface { + drpc.Stream + SendAndClose(*IsNameValidResponse) error +} + +type drpcAnyPaymentProcessing_IsNameValidStream struct { + drpc.Stream +} + +func (x *drpcAnyPaymentProcessing_IsNameValidStream) SendAndClose(m *IsNameValidResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}); err != nil { + return err + } + return x.CloseSend() +} + type DRPCAnyPaymentProcessing_BuySubscriptionStream interface { drpc.Stream SendAndClose(*BuySubscriptionResponse) error @@ -151,3 +335,99 @@ func (x *drpcAnyPaymentProcessing_BuySubscriptionStream) SendAndClose(m *BuySubs } return x.CloseSend() } + +type DRPCAnyPaymentProcessing_FinalizeSubscriptionStream interface { + drpc.Stream + SendAndClose(*FinalizeSubscriptionResponse) error +} + +type drpcAnyPaymentProcessing_FinalizeSubscriptionStream struct { + drpc.Stream +} + +func (x *drpcAnyPaymentProcessing_FinalizeSubscriptionStream) SendAndClose(m *FinalizeSubscriptionResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}); err != nil { + return err + } + return x.CloseSend() +} + +type DRPCAnyPaymentProcessing_GetSubscriptionPortalLinkStream interface { + drpc.Stream + SendAndClose(*GetSubscriptionPortalLinkResponse) error +} + +type drpcAnyPaymentProcessing_GetSubscriptionPortalLinkStream struct { + drpc.Stream +} + +func (x *drpcAnyPaymentProcessing_GetSubscriptionPortalLinkStream) SendAndClose(m *GetSubscriptionPortalLinkResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}); err != nil { + return err + } + return x.CloseSend() +} + +type DRPCAnyPaymentProcessing_GetVerificationEmailStream interface { + drpc.Stream + SendAndClose(*GetVerificationEmailResponse) error +} + +type drpcAnyPaymentProcessing_GetVerificationEmailStream struct { + drpc.Stream +} + +func (x *drpcAnyPaymentProcessing_GetVerificationEmailStream) SendAndClose(m *GetVerificationEmailResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}); err != nil { + return err + } + return x.CloseSend() +} + +type DRPCAnyPaymentProcessing_VerifyEmailStream interface { + drpc.Stream + SendAndClose(*VerifyEmailResponse) error +} + +type drpcAnyPaymentProcessing_VerifyEmailStream struct { + drpc.Stream +} + +func (x *drpcAnyPaymentProcessing_VerifyEmailStream) SendAndClose(m *VerifyEmailResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}); err != nil { + return err + } + return x.CloseSend() +} + +type DRPCAnyPaymentProcessing_GetAllTiersStream interface { + drpc.Stream + SendAndClose(*GetTiersResponse) error +} + +type drpcAnyPaymentProcessing_GetAllTiersStream struct { + drpc.Stream +} + +func (x *drpcAnyPaymentProcessing_GetAllTiersStream) SendAndClose(m *GetTiersResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}); err != nil { + return err + } + return x.CloseSend() +} + +type DRPCAnyPaymentProcessing_VerifyAppStoreReceiptStream interface { + drpc.Stream + SendAndClose(*VerifyAppStoreReceiptResponse) error +} + +type drpcAnyPaymentProcessing_VerifyAppStoreReceiptStream struct { + drpc.Stream +} + +func (x *drpcAnyPaymentProcessing_VerifyAppStoreReceiptStream) SendAndClose(m *VerifyAppStoreReceiptResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}); err != nil { + return err + } + return x.CloseSend() +} diff --git a/paymentservice/paymentserviceproto/paymentservice_tiers.pb.go b/paymentservice/paymentserviceproto/paymentservice_tiers.pb.go new file mode 100644 index 00000000..61461422 --- /dev/null +++ b/paymentservice/paymentserviceproto/paymentservice_tiers.pb.go @@ -0,0 +1,2016 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: paymentservice/paymentserviceproto/protos/paymentservice_tiers.proto + +package paymentserviceproto + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type PeriodType int32 + +const ( + PeriodType_PeriodTypeUnknown PeriodType = 0 + PeriodType_PeriodTypeUnlimited PeriodType = 1 + PeriodType_PeriodTypeDays PeriodType = 2 + PeriodType_PeriodTypeWeeks PeriodType = 3 + PeriodType_PeriodTypeMonths PeriodType = 4 + PeriodType_PeriodTypeYears PeriodType = 5 +) + +var PeriodType_name = map[int32]string{ + 0: "PeriodTypeUnknown", + 1: "PeriodTypeUnlimited", + 2: "PeriodTypeDays", + 3: "PeriodTypeWeeks", + 4: "PeriodTypeMonths", + 5: "PeriodTypeYears", +} + +var PeriodType_value = map[string]int32{ + "PeriodTypeUnknown": 0, + "PeriodTypeUnlimited": 1, + "PeriodTypeDays": 2, + "PeriodTypeWeeks": 3, + "PeriodTypeMonths": 4, + "PeriodTypeYears": 5, +} + +func (x PeriodType) String() string { + return proto.EnumName(PeriodType_name, int32(x)) +} + +func (PeriodType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_597ac3048c641f44, []int{0} +} + +type Feature struct { + Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` +} + +func (m *Feature) Reset() { *m = Feature{} } +func (m *Feature) String() string { return proto.CompactTextString(m) } +func (*Feature) ProtoMessage() {} +func (*Feature) Descriptor() ([]byte, []int) { + return fileDescriptor_597ac3048c641f44, []int{0} +} +func (m *Feature) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Feature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Feature.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Feature) XXX_Merge(src proto.Message) { + xxx_messageInfo_Feature.Merge(m, src) +} +func (m *Feature) XXX_Size() int { + return m.Size() +} +func (m *Feature) XXX_DiscardUnknown() { + xxx_messageInfo_Feature.DiscardUnknown(m) +} + +var xxx_messageInfo_Feature proto.InternalMessageInfo + +func (m *Feature) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +type GetTiersRequest struct { + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() + OwnerAnyId string `protobuf:"bytes,1,opt,name=ownerAnyId,proto3" json:"ownerAnyId,omitempty"` + Locale string `protobuf:"bytes,2,opt,name=locale,proto3" json:"locale,omitempty"` +} + +func (m *GetTiersRequest) Reset() { *m = GetTiersRequest{} } +func (m *GetTiersRequest) String() string { return proto.CompactTextString(m) } +func (*GetTiersRequest) ProtoMessage() {} +func (*GetTiersRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_597ac3048c641f44, []int{1} +} +func (m *GetTiersRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetTiersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetTiersRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetTiersRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetTiersRequest.Merge(m, src) +} +func (m *GetTiersRequest) XXX_Size() int { + return m.Size() +} +func (m *GetTiersRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetTiersRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetTiersRequest proto.InternalMessageInfo + +func (m *GetTiersRequest) GetOwnerAnyId() string { + if m != nil { + return m.OwnerAnyId + } + return "" +} + +func (m *GetTiersRequest) GetLocale() string { + if m != nil { + return m.Locale + } + return "" +} + +type GetTiersRequestSigned struct { + // GetTiersRequest struct + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + // this is payload signed with payload.ownerAnyID + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (m *GetTiersRequestSigned) Reset() { *m = GetTiersRequestSigned{} } +func (m *GetTiersRequestSigned) String() string { return proto.CompactTextString(m) } +func (*GetTiersRequestSigned) ProtoMessage() {} +func (*GetTiersRequestSigned) Descriptor() ([]byte, []int) { + return fileDescriptor_597ac3048c641f44, []int{2} +} +func (m *GetTiersRequestSigned) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetTiersRequestSigned) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetTiersRequestSigned.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetTiersRequestSigned) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetTiersRequestSigned.Merge(m, src) +} +func (m *GetTiersRequestSigned) XXX_Size() int { + return m.Size() +} +func (m *GetTiersRequestSigned) XXX_DiscardUnknown() { + xxx_messageInfo_GetTiersRequestSigned.DiscardUnknown(m) +} + +var xxx_messageInfo_GetTiersRequestSigned proto.InternalMessageInfo + +func (m *GetTiersRequestSigned) GetPayload() []byte { + if m != nil { + return m.Payload + } + return nil +} + +func (m *GetTiersRequestSigned) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +type TierData struct { + // this is a unique ID of the tier + // you should hardcode this in your app and provide icon, graphics, etc for each tier + // (even for old/historical/inactive/hidden tiers) + Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // localazied name of the tier + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // just a short technical description + // you don't have to use it, you can use your own UI-friendly texts + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + // can you buy it (ON ALL PLATFORMS, without clarification)? + IsActive bool `protobuf:"varint,4,opt,name=isActive,proto3" json:"isActive,omitempty"` + // is this tier for debugging only? + IsTest bool `protobuf:"varint,5,opt,name=isTest,proto3" json:"isTest,omitempty"` + // hidden tiers are only visible once user got them + IsHiddenTier bool `protobuf:"varint,6,opt,name=isHiddenTier,proto3" json:"isHiddenTier,omitempty"` + // how long is the period of the subscription + PeriodType PeriodType `protobuf:"varint,7,opt,name=periodType,proto3,enum=PeriodType" json:"periodType,omitempty"` + // i.e. "5 days" or "3 years" + PeriodValue uint32 `protobuf:"varint,8,opt,name=periodValue,proto3" json:"periodValue,omitempty"` + // this one is a price we use ONLY on Stripe platform + PriceStripeUsdCents uint32 `protobuf:"varint,9,opt,name=priceStripeUsdCents,proto3" json:"priceStripeUsdCents,omitempty"` + // number of ANY NS names that this tier includes + // (not counted as a "feature" and not in the features list) + AnyNamesCountIncluded uint32 `protobuf:"varint,10,opt,name=anyNamesCountIncluded,proto3" json:"anyNamesCountIncluded,omitempty"` + // somename.any - len of 8 + AnyNameMinLength uint32 `protobuf:"varint,11,opt,name=anyNameMinLength,proto3" json:"anyNameMinLength,omitempty"` + // each tier has a set of features + Features []*Feature `protobuf:"bytes,12,rep,name=features,proto3" json:"features,omitempty"` + // green, blue, red, purple or custom color in string format #ff00ff + ColorStr string `protobuf:"bytes,13,opt,name=colorStr,proto3" json:"colorStr,omitempty"` + // Stripe platform-specific data: + StripeProductId string `protobuf:"bytes,14,opt,name=stripeProductId,proto3" json:"stripeProductId,omitempty"` + StripeManageUrl string `protobuf:"bytes,15,opt,name=stripeManageUrl,proto3" json:"stripeManageUrl,omitempty"` + // iOS platform-specific data: + IosProductId string `protobuf:"bytes,16,opt,name=iosProductId,proto3" json:"iosProductId,omitempty"` + IosManageUrl string `protobuf:"bytes,17,opt,name=iosManageUrl,proto3" json:"iosManageUrl,omitempty"` + // Android platform-specific data: + AndroidProductId string `protobuf:"bytes,18,opt,name=androidProductId,proto3" json:"androidProductId,omitempty"` + AndroidManageUrl string `protobuf:"bytes,19,opt,name=androidManageUrl,proto3" json:"androidManageUrl,omitempty"` +} + +func (m *TierData) Reset() { *m = TierData{} } +func (m *TierData) String() string { return proto.CompactTextString(m) } +func (*TierData) ProtoMessage() {} +func (*TierData) Descriptor() ([]byte, []int) { + return fileDescriptor_597ac3048c641f44, []int{3} +} +func (m *TierData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TierData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TierData.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TierData) XXX_Merge(src proto.Message) { + xxx_messageInfo_TierData.Merge(m, src) +} +func (m *TierData) XXX_Size() int { + return m.Size() +} +func (m *TierData) XXX_DiscardUnknown() { + xxx_messageInfo_TierData.DiscardUnknown(m) +} + +var xxx_messageInfo_TierData proto.InternalMessageInfo + +func (m *TierData) GetId() uint32 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *TierData) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *TierData) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *TierData) GetIsActive() bool { + if m != nil { + return m.IsActive + } + return false +} + +func (m *TierData) GetIsTest() bool { + if m != nil { + return m.IsTest + } + return false +} + +func (m *TierData) GetIsHiddenTier() bool { + if m != nil { + return m.IsHiddenTier + } + return false +} + +func (m *TierData) GetPeriodType() PeriodType { + if m != nil { + return m.PeriodType + } + return PeriodType_PeriodTypeUnknown +} + +func (m *TierData) GetPeriodValue() uint32 { + if m != nil { + return m.PeriodValue + } + return 0 +} + +func (m *TierData) GetPriceStripeUsdCents() uint32 { + if m != nil { + return m.PriceStripeUsdCents + } + return 0 +} + +func (m *TierData) GetAnyNamesCountIncluded() uint32 { + if m != nil { + return m.AnyNamesCountIncluded + } + return 0 +} + +func (m *TierData) GetAnyNameMinLength() uint32 { + if m != nil { + return m.AnyNameMinLength + } + return 0 +} + +func (m *TierData) GetFeatures() []*Feature { + if m != nil { + return m.Features + } + return nil +} + +func (m *TierData) GetColorStr() string { + if m != nil { + return m.ColorStr + } + return "" +} + +func (m *TierData) GetStripeProductId() string { + if m != nil { + return m.StripeProductId + } + return "" +} + +func (m *TierData) GetStripeManageUrl() string { + if m != nil { + return m.StripeManageUrl + } + return "" +} + +func (m *TierData) GetIosProductId() string { + if m != nil { + return m.IosProductId + } + return "" +} + +func (m *TierData) GetIosManageUrl() string { + if m != nil { + return m.IosManageUrl + } + return "" +} + +func (m *TierData) GetAndroidProductId() string { + if m != nil { + return m.AndroidProductId + } + return "" +} + +func (m *TierData) GetAndroidManageUrl() string { + if m != nil { + return m.AndroidManageUrl + } + return "" +} + +type GetTiersResponse struct { + // list of all available tiers + Tiers []*TierData `protobuf:"bytes,1,rep,name=tiers,proto3" json:"tiers,omitempty"` +} + +func (m *GetTiersResponse) Reset() { *m = GetTiersResponse{} } +func (m *GetTiersResponse) String() string { return proto.CompactTextString(m) } +func (*GetTiersResponse) ProtoMessage() {} +func (*GetTiersResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_597ac3048c641f44, []int{4} +} +func (m *GetTiersResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetTiersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetTiersResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetTiersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetTiersResponse.Merge(m, src) +} +func (m *GetTiersResponse) XXX_Size() int { + return m.Size() +} +func (m *GetTiersResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetTiersResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetTiersResponse proto.InternalMessageInfo + +func (m *GetTiersResponse) GetTiers() []*TierData { + if m != nil { + return m.Tiers + } + return nil +} + +func init() { + proto.RegisterEnum("PeriodType", PeriodType_name, PeriodType_value) + proto.RegisterType((*Feature)(nil), "Feature") + proto.RegisterType((*GetTiersRequest)(nil), "GetTiersRequest") + proto.RegisterType((*GetTiersRequestSigned)(nil), "GetTiersRequestSigned") + proto.RegisterType((*TierData)(nil), "TierData") + proto.RegisterType((*GetTiersResponse)(nil), "GetTiersResponse") +} + +func init() { + proto.RegisterFile("paymentservice/paymentserviceproto/protos/paymentservice_tiers.proto", fileDescriptor_597ac3048c641f44) +} + +var fileDescriptor_597ac3048c641f44 = []byte{ + // 618 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x94, 0xc1, 0x4f, 0x13, 0x4f, + 0x14, 0xc7, 0xbb, 0x85, 0x42, 0xfb, 0x5a, 0xda, 0x65, 0xfa, 0xe3, 0xe7, 0xc4, 0x98, 0xda, 0x6c, + 0x3c, 0x34, 0x90, 0x14, 0x03, 0x1e, 0xbd, 0x20, 0x44, 0x6d, 0x22, 0x4a, 0x16, 0xd0, 0xe8, 0xc5, + 0x8c, 0x3b, 0xcf, 0x32, 0x61, 0x3b, 0xb3, 0xce, 0x4c, 0x21, 0xfd, 0x2f, 0xf8, 0x97, 0xbc, 0x79, + 0xe4, 0xe8, 0xd1, 0xc0, 0x3f, 0x62, 0x76, 0x5a, 0x76, 0xb7, 0x85, 0xc4, 0x4b, 0xdb, 0xf7, 0xf9, + 0x7e, 0xdf, 0x37, 0x6f, 0x66, 0xdf, 0x16, 0x0e, 0x12, 0x36, 0x19, 0xa1, 0xb4, 0x06, 0xf5, 0x85, + 0x88, 0x70, 0x7b, 0xbe, 0x4c, 0xb4, 0xb2, 0x6a, 0xdb, 0x7d, 0x9a, 0x05, 0xe9, 0xab, 0x15, 0xa8, + 0x4d, 0xdf, 0x69, 0xc1, 0x16, 0xac, 0xbe, 0x46, 0x66, 0xc7, 0x1a, 0x49, 0x17, 0xea, 0x1c, 0x4d, + 0xa4, 0x45, 0x62, 0x85, 0x92, 0xd4, 0xeb, 0x7a, 0xbd, 0x5a, 0x58, 0x44, 0xc1, 0x00, 0x5a, 0x6f, + 0xd0, 0x9e, 0xa4, 0xed, 0x21, 0xfe, 0x18, 0xa3, 0xb1, 0xa4, 0x03, 0xa0, 0x2e, 0x25, 0xea, 0x3d, + 0x39, 0x19, 0xf0, 0x59, 0x4f, 0x81, 0x90, 0xff, 0x61, 0x25, 0x56, 0x11, 0x8b, 0x91, 0x96, 0x9d, + 0x36, 0xab, 0x82, 0x0f, 0xb0, 0xb1, 0x10, 0x75, 0x2c, 0x86, 0x12, 0x39, 0xa1, 0xb0, 0x9a, 0xb0, + 0x49, 0xac, 0xd8, 0x34, 0xad, 0x11, 0xde, 0x95, 0xe4, 0x09, 0xd4, 0x8c, 0x18, 0x4a, 0x37, 0xac, + 0x4b, 0x6b, 0x84, 0x39, 0x08, 0x7e, 0x56, 0xa0, 0x9a, 0xc6, 0x1d, 0x30, 0xcb, 0x48, 0x13, 0xca, + 0x62, 0xda, 0xbf, 0x16, 0x96, 0x05, 0x27, 0x04, 0x96, 0x25, 0x1b, 0xdd, 0xcd, 0xe0, 0x7e, 0x2f, + 0x1e, 0x77, 0xe9, 0xde, 0x71, 0xc9, 0x63, 0xa8, 0x0a, 0xb3, 0x17, 0x59, 0x71, 0x81, 0x74, 0xb9, + 0xeb, 0xf5, 0xaa, 0x61, 0x56, 0xa7, 0xe7, 0x12, 0xe6, 0x04, 0x8d, 0xa5, 0x15, 0xa7, 0xcc, 0x2a, + 0x12, 0x40, 0x43, 0x98, 0xb7, 0x82, 0x73, 0x94, 0xe9, 0x34, 0x74, 0xc5, 0xa9, 0x73, 0x8c, 0x6c, + 0x01, 0x24, 0xa8, 0x85, 0xe2, 0x27, 0x93, 0x04, 0xe9, 0x6a, 0xd7, 0xeb, 0x35, 0x77, 0xea, 0xfd, + 0xa3, 0x0c, 0x85, 0x05, 0x39, 0x1d, 0x73, 0x5a, 0x7d, 0x64, 0xf1, 0x18, 0x69, 0xd5, 0x9d, 0xa9, + 0x88, 0xc8, 0x73, 0x68, 0x27, 0x5a, 0x44, 0x78, 0x6c, 0xb5, 0x48, 0xf0, 0xd4, 0xf0, 0xfd, 0xf4, + 0x59, 0xd3, 0x9a, 0x73, 0x3e, 0x24, 0x91, 0x17, 0xb0, 0xc1, 0xe4, 0xe4, 0x3d, 0x1b, 0xa1, 0xd9, + 0x57, 0x63, 0x69, 0x07, 0x32, 0x8a, 0xc7, 0x1c, 0x39, 0x05, 0xd7, 0xf3, 0xb0, 0x48, 0x36, 0xc1, + 0x9f, 0x09, 0x87, 0x42, 0xbe, 0x43, 0x39, 0xb4, 0x67, 0xb4, 0xee, 0x1a, 0xee, 0x71, 0xf2, 0x0c, + 0xaa, 0xdf, 0xa7, 0x6b, 0x65, 0x68, 0xa3, 0xbb, 0xd4, 0xab, 0xef, 0x54, 0xfb, 0xb3, 0x3d, 0x0b, + 0x33, 0x25, 0xbd, 0xe0, 0x48, 0xc5, 0x4a, 0x1f, 0x5b, 0x4d, 0xd7, 0xdc, 0xfd, 0x67, 0x35, 0xe9, + 0x41, 0xcb, 0xb8, 0xa9, 0x8f, 0xb4, 0xe2, 0xe3, 0xc8, 0x0e, 0x38, 0x6d, 0x3a, 0xcb, 0x22, 0xce, + 0x9d, 0x87, 0x4c, 0xb2, 0x21, 0x9e, 0xea, 0x98, 0xb6, 0x8a, 0xce, 0x0c, 0xbb, 0x87, 0xa3, 0x4c, + 0x1e, 0xe8, 0x3b, 0xdb, 0x1c, 0x9b, 0x79, 0xf2, 0xa8, 0xf5, 0xcc, 0x93, 0xe7, 0xb8, 0x9b, 0xe0, + 0x5a, 0x09, 0x9e, 0x67, 0x11, 0xe7, 0xbb, 0xc7, 0x0b, 0xde, 0x3c, 0xb3, 0x3d, 0xe7, 0xcd, 0x78, + 0xb0, 0x0b, 0x7e, 0xfe, 0x52, 0x98, 0x44, 0x49, 0x83, 0xe4, 0x29, 0x54, 0xdc, 0xfb, 0x4a, 0x3d, + 0x77, 0x8d, 0xb5, 0xfe, 0xdd, 0x92, 0x87, 0x53, 0xbe, 0x79, 0xe5, 0x01, 0xe4, 0xbb, 0x43, 0x36, + 0x60, 0x3d, 0xaf, 0x4e, 0xe5, 0xb9, 0x54, 0x97, 0xd2, 0x2f, 0x91, 0x47, 0xd0, 0x2e, 0xe2, 0x58, + 0x8c, 0x84, 0x45, 0xee, 0x7b, 0x84, 0x40, 0x33, 0x17, 0x0e, 0xd8, 0xc4, 0xf8, 0x65, 0xd2, 0x86, + 0x56, 0xce, 0x3e, 0x21, 0x9e, 0x1b, 0x7f, 0x89, 0xfc, 0x07, 0x7e, 0x0e, 0x0f, 0x95, 0xb4, 0x67, + 0xc6, 0x5f, 0x9e, 0xb7, 0x7e, 0x46, 0xa6, 0x8d, 0x5f, 0x79, 0xf5, 0xf2, 0xd7, 0x4d, 0xc7, 0xbb, + 0xbe, 0xe9, 0x78, 0x7f, 0x6e, 0x3a, 0xde, 0xd5, 0x6d, 0xa7, 0x74, 0x7d, 0xdb, 0x29, 0xfd, 0xbe, + 0xed, 0x94, 0xbe, 0x04, 0xff, 0xfe, 0xd3, 0xfa, 0xb6, 0xe2, 0xbe, 0x76, 0xff, 0x06, 0x00, 0x00, + 0xff, 0xff, 0xca, 0xfa, 0xda, 0x87, 0xe1, 0x04, 0x00, 0x00, +} + +func (m *Feature) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Feature) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Feature) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetTiersRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetTiersRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetTiersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Locale) > 0 { + i -= len(m.Locale) + copy(dAtA[i:], m.Locale) + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(len(m.Locale))) + i-- + dAtA[i] = 0x12 + } + if len(m.OwnerAnyId) > 0 { + i -= len(m.OwnerAnyId) + copy(dAtA[i:], m.OwnerAnyId) + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(len(m.OwnerAnyId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetTiersRequestSigned) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetTiersRequestSigned) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetTiersRequestSigned) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TierData) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TierData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TierData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AndroidManageUrl) > 0 { + i -= len(m.AndroidManageUrl) + copy(dAtA[i:], m.AndroidManageUrl) + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(len(m.AndroidManageUrl))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x9a + } + if len(m.AndroidProductId) > 0 { + i -= len(m.AndroidProductId) + copy(dAtA[i:], m.AndroidProductId) + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(len(m.AndroidProductId))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x92 + } + if len(m.IosManageUrl) > 0 { + i -= len(m.IosManageUrl) + copy(dAtA[i:], m.IosManageUrl) + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(len(m.IosManageUrl))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x8a + } + if len(m.IosProductId) > 0 { + i -= len(m.IosProductId) + copy(dAtA[i:], m.IosProductId) + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(len(m.IosProductId))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } + if len(m.StripeManageUrl) > 0 { + i -= len(m.StripeManageUrl) + copy(dAtA[i:], m.StripeManageUrl) + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(len(m.StripeManageUrl))) + i-- + dAtA[i] = 0x7a + } + if len(m.StripeProductId) > 0 { + i -= len(m.StripeProductId) + copy(dAtA[i:], m.StripeProductId) + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(len(m.StripeProductId))) + i-- + dAtA[i] = 0x72 + } + if len(m.ColorStr) > 0 { + i -= len(m.ColorStr) + copy(dAtA[i:], m.ColorStr) + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(len(m.ColorStr))) + i-- + dAtA[i] = 0x6a + } + if len(m.Features) > 0 { + for iNdEx := len(m.Features) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Features[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + } + } + if m.AnyNameMinLength != 0 { + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(m.AnyNameMinLength)) + i-- + dAtA[i] = 0x58 + } + if m.AnyNamesCountIncluded != 0 { + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(m.AnyNamesCountIncluded)) + i-- + dAtA[i] = 0x50 + } + if m.PriceStripeUsdCents != 0 { + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(m.PriceStripeUsdCents)) + i-- + dAtA[i] = 0x48 + } + if m.PeriodValue != 0 { + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(m.PeriodValue)) + i-- + dAtA[i] = 0x40 + } + if m.PeriodType != 0 { + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(m.PeriodType)) + i-- + dAtA[i] = 0x38 + } + if m.IsHiddenTier { + i-- + if m.IsHiddenTier { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if m.IsTest { + i-- + if m.IsTest { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.IsActive { + i-- + if m.IsActive { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if m.Id != 0 { + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *GetTiersResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetTiersResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetTiersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Tiers) > 0 { + for iNdEx := len(m.Tiers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Tiers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPaymentserviceTiers(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintPaymentserviceTiers(dAtA []byte, offset int, v uint64) int { + offset -= sovPaymentserviceTiers(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Feature) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Description) + if l > 0 { + n += 1 + l + sovPaymentserviceTiers(uint64(l)) + } + return n +} + +func (m *GetTiersRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OwnerAnyId) + if l > 0 { + n += 1 + l + sovPaymentserviceTiers(uint64(l)) + } + l = len(m.Locale) + if l > 0 { + n += 1 + l + sovPaymentserviceTiers(uint64(l)) + } + return n +} + +func (m *GetTiersRequestSigned) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovPaymentserviceTiers(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovPaymentserviceTiers(uint64(l)) + } + return n +} + +func (m *TierData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovPaymentserviceTiers(uint64(m.Id)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovPaymentserviceTiers(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovPaymentserviceTiers(uint64(l)) + } + if m.IsActive { + n += 2 + } + if m.IsTest { + n += 2 + } + if m.IsHiddenTier { + n += 2 + } + if m.PeriodType != 0 { + n += 1 + sovPaymentserviceTiers(uint64(m.PeriodType)) + } + if m.PeriodValue != 0 { + n += 1 + sovPaymentserviceTiers(uint64(m.PeriodValue)) + } + if m.PriceStripeUsdCents != 0 { + n += 1 + sovPaymentserviceTiers(uint64(m.PriceStripeUsdCents)) + } + if m.AnyNamesCountIncluded != 0 { + n += 1 + sovPaymentserviceTiers(uint64(m.AnyNamesCountIncluded)) + } + if m.AnyNameMinLength != 0 { + n += 1 + sovPaymentserviceTiers(uint64(m.AnyNameMinLength)) + } + if len(m.Features) > 0 { + for _, e := range m.Features { + l = e.Size() + n += 1 + l + sovPaymentserviceTiers(uint64(l)) + } + } + l = len(m.ColorStr) + if l > 0 { + n += 1 + l + sovPaymentserviceTiers(uint64(l)) + } + l = len(m.StripeProductId) + if l > 0 { + n += 1 + l + sovPaymentserviceTiers(uint64(l)) + } + l = len(m.StripeManageUrl) + if l > 0 { + n += 1 + l + sovPaymentserviceTiers(uint64(l)) + } + l = len(m.IosProductId) + if l > 0 { + n += 2 + l + sovPaymentserviceTiers(uint64(l)) + } + l = len(m.IosManageUrl) + if l > 0 { + n += 2 + l + sovPaymentserviceTiers(uint64(l)) + } + l = len(m.AndroidProductId) + if l > 0 { + n += 2 + l + sovPaymentserviceTiers(uint64(l)) + } + l = len(m.AndroidManageUrl) + if l > 0 { + n += 2 + l + sovPaymentserviceTiers(uint64(l)) + } + return n +} + +func (m *GetTiersResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Tiers) > 0 { + for _, e := range m.Tiers { + l = e.Size() + n += 1 + l + sovPaymentserviceTiers(uint64(l)) + } + } + return n +} + +func sovPaymentserviceTiers(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozPaymentserviceTiers(x uint64) (n int) { + return sovPaymentserviceTiers(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Feature) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Feature: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Feature: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPaymentserviceTiers(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetTiersRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetTiersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetTiersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAnyId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAnyId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Locale", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Locale = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPaymentserviceTiers(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetTiersRequestSigned) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetTiersRequestSigned: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetTiersRequestSigned: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) + if m.Payload == nil { + m.Payload = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPaymentserviceTiers(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TierData) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TierData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TierData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsActive", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsActive = bool(v != 0) + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsTest", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsTest = bool(v != 0) + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsHiddenTier", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsHiddenTier = bool(v != 0) + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PeriodType", wireType) + } + m.PeriodType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PeriodType |= PeriodType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PeriodValue", wireType) + } + m.PeriodValue = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PeriodValue |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PriceStripeUsdCents", wireType) + } + m.PriceStripeUsdCents = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PriceStripeUsdCents |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AnyNamesCountIncluded", wireType) + } + m.AnyNamesCountIncluded = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AnyNamesCountIncluded |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AnyNameMinLength", wireType) + } + m.AnyNameMinLength = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AnyNameMinLength |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Features", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Features = append(m.Features, &Feature{}) + if err := m.Features[len(m.Features)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ColorStr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ColorStr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StripeProductId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StripeProductId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StripeManageUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StripeManageUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IosProductId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IosProductId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 17: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IosManageUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IosManageUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 18: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AndroidProductId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AndroidProductId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 19: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AndroidManageUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AndroidManageUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPaymentserviceTiers(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetTiersResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetTiersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetTiersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tiers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tiers = append(m.Tiers, &TierData{}) + if err := m.Tiers[len(m.Tiers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPaymentserviceTiers(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentserviceTiers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipPaymentserviceTiers(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPaymentserviceTiers + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthPaymentserviceTiers + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPaymentserviceTiers + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthPaymentserviceTiers + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthPaymentserviceTiers = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPaymentserviceTiers = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPaymentserviceTiers = fmt.Errorf("proto: unexpected end of group") +) diff --git a/paymentservice/paymentserviceproto/protos/paymentservice.proto b/paymentservice/paymentserviceproto/protos/paymentservice.proto index 63bce053..c2708e0c 100644 --- a/paymentservice/paymentserviceproto/protos/paymentservice.proto +++ b/paymentservice/paymentserviceproto/protos/paymentservice.proto @@ -1,86 +1,101 @@ syntax = "proto3"; option go_package = "paymentservice/paymentserviceproto"; -// TODO: no marshalling avail :-( -//import "google/protobuf/timestamp.proto"; +import "paymentservice/paymentserviceproto/protos/paymentservice_tiers.proto"; +// TODO: +// later we will have an interface to enumerate all available tiers +// it's a bad idea to list them here, because interface will be changed often enum SubscriptionTier { - Tier_Unknown = 0; + TierUnknown = 0; + // "free" tier + TierExplorer = 1; - Tier_Friend = 1; - Tier_Supporter1Year = 2; - Tier_Patron1Year = 3; + // these can be used just for testing in debug mode + // it will still create an active subscription, but with NO features + TierBuilder1WeekTEST = 2; + TierCoCreator1WeekTEST = 3; + + // these are the real tiers: + TierBuilder1Year = 4; + TierCoCreator1Year = 5; + + TierBuilderPlus = 6; + TierAnytypeTeam = 7; } enum SubscriptionStatus { - Status_Unknown = 0; - Status_Pending = 1; - Status_Active = 2; - Status_Expired = 3; - Status_Canceled = 4; + StatusUnknown = 0; + // payment is still pending + // this will be the status until the payment is confirmed or N is elapsed and no payment is received + // in the last case the subscription will switch to Status_Unknown or Status_Active + StatusPending = 1; + StatusActive = 2; + // when buying from other side - some data is missing in the Subscription + // we need to provide additional data after the payment + // please call FinalizeSubscription to fill-in needed fields + StatusPendingRequiresFinalization = 3; } enum PaymentMethod { - Method_Card = 0; - Method_Crypto = 1; - Method_ApplePay = 2; - Method_GooglePay = 3; + MethodCard = 0; + MethodCrypto = 1; + MethodApplePay = 2; + MethodGooglePay = 3; + MethodAppleInapp = 4; + MethodGoogleInapp = 5; + MethodNone = 6; } -// 1 message GetSubscriptionRequest { - // in the following format: "12D3KooWA8EXV3KjBxEU5EnsPfneLx84vMWAtTBQBeyooN82KSuS" + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() string ownerAnyID = 1; } message GetSubscriptionRequestSigned { // GetSubscriptionRequest bytes payload = 1; - // this is payload signed with payload.ownerAnyID bytes signature = 2; } message GetSubscriptionResponse { - SubscriptionTier tier = 1; + // was SubscriptionTier before, changed to uint32 to allow us to use dynamic tiers + uint32 tier = 1; SubscriptionStatus status = 2; - - //TODO: use google.protobuf.Timestamp and marshall it uint64 dateStarted = 3; uint64 dateEnds = 4; bool isAutoRenew = 5; - - // if client has "downgraded" - he is still able to use the service until the end of the period - // (dateEnds) but then he will be on nextTier until nextTierEnds - // - // if Tier0_Unknown -> then no next tier - SubscriptionTier nextTier = 6; - uint64 nextTierEnds = 7; - - PaymentMethod paymentMethod = 8; + PaymentMethod paymentMethod = 6; + string requestedAnyName = 7; + // if user verified her email OR provided it while buying a subscription, it will be here + string userEmail = 8; + bool subscribeToNewsletter = 9; } -// 2 message BuySubscriptionRequest { - // in the following format: "12D3KooWA8EXV3KjBxEU5EnsPfneLx84vMWAtTBQBeyooN82KSuS" - string ownerAnyID = 1; - - // this is the owner's ETH main EOA (External Owned Account) address - // not AccountAbstraction's SCW (Smart Contract Wallet) address! - // + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() + string ownerAnyId = 1; + // this is the owner's main EOA (Externally Owned Account) address + // not AccountAbstraction's SCW (Smart Contract Wallet) address! + // this is required to reserve a name for the owner (later that is done by user) // in the following format: "0x7a250d5630b4cf539739df2c5dacb4c659f2488d" - // this is required to reserve a name for the owner string ownerEthAddress = 2; - - SubscriptionTier requestedTier = 3; - + // was SubscriptionTier before, changed to uint32 to allow us to use dynamic tiers + uint32 requestedTier = 3; PaymentMethod paymentMethod = 4; + // if empty - then no name requested + // if non-empty - PP node will register that name on behalf of the user + string requestedAnyName = 5; + // for some payment methods we need to know the user's email + string userEmail = 6; } message BuySubscriptionRequestSigned { // BuySubscriptionRequest bytes payload = 1; - // this is payload signed with payload.ownerAnyID bytes signature = 2; } @@ -89,19 +104,206 @@ message BuySubscriptionResponse { // will feature current billing ID // stripe.com/?client_reference_id=1234 string paymentUrl = 1; + // billingID is passed via mobile client to payment platform + string billingID = 2; } +message FinalizeSubscriptionRequest { + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() + string ownerAnyId = 1; + // this is the owner's main EOA (Externally Owned Account) address + // not AccountAbstraction's SCW (Smart Contract Wallet) address! + // this is required to reserve a name for the owner (later that is done by user) + // in the following format: "0x7a250d5630b4cf539739df2c5dacb4c659f2488d" + string ownerEthAddress = 2; + // if empty - then no name requested + string requestedAnyName = 3; +} + +message FinalizeSubscriptionResponse { + +} + +message FinalizeSubscriptionRequestSigned { + // VerifyEmailRequest + bytes payload = 1; + // this is payload signed with payload.ownerAnyID + bytes signature = 2; +} + +message GetSubscriptionPortalLinkRequest { + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() + string ownerAnyId = 1; +} + +message GetSubscriptionPortalLinkRequestSigned { + // GetSubscriptionPortalLinkRequest + bytes payload = 1; + // this is payload signed with payload.ownerAnyID + bytes signature = 2; +} + +message GetSubscriptionPortalLinkResponse { + string portalUrl = 1; +} + +message GetVerificationEmailRequest { + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() + string ownerAnyId = 1; + string email = 2; + bool subscribeToNewsletter = 3; +} + +message GetVerificationEmailResponse { + +} + +message GetVerificationEmailRequestSigned { + // GetVerificationEmailRequest + bytes payload = 1; + // this is payload signed with payload.ownerAnyID + bytes signature = 2; +} + +message VerifyEmailRequest { + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() + string ownerAnyId = 1; + // this is the owner's main EOA (Externally Owned Account) address + // not AccountAbstraction's SCW (Smart Contract Wallet) address! + // this is required to reserve a name for the owner (later that is done by user) + // in the following format: "0x7a250d5630b4cf539739df2c5dacb4c659f2488d" + string ownerEthAddress = 2; + // code received in the email + string code = 3; +} + +message VerifyEmailResponse { + bool success = 1; +} + +message VerifyEmailRequestSigned { + // VerifyEmailRequest + bytes payload = 1; + // this is payload signed with payload.ownerAnyID + bytes signature = 2; +} + +message IsNameValidRequest { + uint32 requestedTier = 1; + string requestedAnyName = 2; +} + +message IsNameValidResponse { + Code code = 1; + string description = 2; + + enum Code { + Valid = 0; + NoDotAny = 1; + TooShort = 2; + TooLong = 3; + HasInvalidChars = 4; + TierFeatureNoName = 5; + CanNotReserve = 6; + // if everything is fine - "name is already taken" check should be done in the NS + // see IsNameAvailable() + } +} + +message VerifyAppStoreReceiptRequest { + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() + string ownerAnyId = 1; + // receipt is a JWT-encoded information about subscription purchase + string receipt = 2; +} + +message VerifyAppStoreReceiptRequestSigned { + // VerifyAppStoreReceiptRequest + bytes payload = 1; + // this is payload signed with payload.ownerAnyID + bytes signature = 2; +} + +message VerifyAppStoreReceiptResponse { + +} + +enum ErrorCodes { + Unexpected = 0; + + EthAddressEmpty = 1; + InvalidSignature = 2; + TierWrong = 3; + TierNotFound = 4; + TierInactive = 5; + PaymentMethodWrong = 6; + BadAnyName = 7; + Unknown = 8; + + SubsAlreadyActive = 9; + SubsNotFound = 10; + SubsWrongState = 11; + + EmailWrongFormat = 12; + EmailAlreadyVerified = 13; + EmailAlreadySent = 14; + EmailFailedToSend = 15; + EmailExpired = 16; + EmailWrongCode = 17; + + AppleInvalidReceipt = 18; + ApplePurchaseRegistration = 19; + AppleSubscriptionRenew = 20; + + ErrorOffset = 600; +} + +// NOTICE: +// 1 - User can not ask for a payment/other links on behalf of another user (a signature is required) +// 2 - Admin can do that on behalf of any user service AnyPaymentProcessing { rpc GetSubscriptionStatus(GetSubscriptionRequestSigned) returns (GetSubscriptionResponse) {} - // Will save a new BillingID to DB, and return a payment link - // You can: - // a) buy a subscription - // b) TODO: upgrade your tier - // c) TODO: renew subscription - // - // WARNING: - // 1 - User can not ask for a payment link on behalf of another user (a signature is required) - // 2 - Admin can do that on behalf of a user + // Check if the requested name is valid for the requested tier + // before requesting a payment link and paying + rpc IsNameValid(IsNameValidRequest) returns (IsNameValidResponse) {} + + // Save a new BillingID to DB, and return a payment link. + // You can call BuySubscription multiple times even if current payment is not processed yet + // (to get new payment link). + // If user has already an active subscription, then this will return an error. rpc BuySubscription(BuySubscriptionRequestSigned) returns (BuySubscriptionResponse) {} + + // If your subscription is in StatusPendingRequiresFinalization, then you need to call this method + rpc FinalizeSubscription(FinalizeSubscriptionRequestSigned) returns (FinalizeSubscriptionResponse) {} + + // Generate a link to the portal where user can: + // a) change her billing details + // b) see payment info, invoices, etc + // c) cancel/renew the subscription + rpc GetSubscriptionPortalLink(GetSubscriptionPortalLinkRequestSigned) returns (GetSubscriptionPortalLinkResponse) {} + + // Verify user's email: 1st step - get a verification link to the email + // Will fail if already verified, i.e. you can not change your email + rpc GetVerificationEmail(GetVerificationEmailRequestSigned) returns (GetVerificationEmailResponse) {} + + // Enter the code from the email + // Will fail if: link was not requested, link is expired, if email is already verified + rpc VerifyEmail(VerifyEmailRequestSigned) returns (VerifyEmailResponse) {} + + // Returns all available application tiers, including inactive + // 1 - this list does not depend on the current platform (iOS, Android, Desktop) + // 2 - this list can be different for different users, based on their account ID + // 3 - user can not buy stripe + // 4 - some tiers are custom () + rpc GetAllTiers(GetTiersRequestSigned) returns (GetTiersResponse) {} + + // Verify purchase in case subscription was bought via AppStore + // Incoming receipt contains all information to register purchase on Payment Node + rpc VerifyAppStoreReceipt(VerifyAppStoreReceiptRequestSigned) returns (VerifyAppStoreReceiptResponse) {} } diff --git a/paymentservice/paymentserviceproto/protos/paymentservice_tiers.proto b/paymentservice/paymentserviceproto/protos/paymentservice_tiers.proto new file mode 100644 index 00000000..4369e2fb --- /dev/null +++ b/paymentservice/paymentserviceproto/protos/paymentservice_tiers.proto @@ -0,0 +1,81 @@ +syntax = "proto3"; +option go_package = "paymentservice/paymentserviceproto"; + + +enum PeriodType { + PeriodTypeUnknown = 0; + PeriodTypeUnlimited = 1; + PeriodTypeDays = 2; + PeriodTypeWeeks = 3; + PeriodTypeMonths = 4; + PeriodTypeYears = 5; +} + +message Feature { + string description = 1; +} + +message GetTiersRequest { + // in the following format: "A5k2d9sFZw84yisTxRnz2bPRd1YPfVfhxqymZ6yESprFTG65" + // you can get it with Account().SignKey.GetPublic().Account() + string ownerAnyId = 1; + + string locale = 2; +} + +message GetTiersRequestSigned { + // GetTiersRequest struct + bytes payload = 1; + // this is payload signed with payload.ownerAnyID + bytes signature = 2; +} + +message TierData { + // this is a unique ID of the tier + // you should hardcode this in your app and provide icon, graphics, etc for each tier + // (even for old/historical/inactive/hidden tiers) + uint32 id = 1; + // localazied name of the tier + string name = 2; + // just a short technical description + // you don't have to use it, you can use your own UI-friendly texts + string description = 3; + // can you buy it (ON ALL PLATFORMS, without clarification)? + bool isActive = 4; + // is this tier for debugging only? + bool isTest = 5; + // hidden tiers are only visible once user got them + bool isHiddenTier = 6; + // how long is the period of the subscription + PeriodType periodType = 7; + // i.e. "5 days" or "3 years" + uint32 periodValue = 8; + // this one is a price we use ONLY on Stripe platform + uint32 priceStripeUsdCents = 9; + // number of ANY NS names that this tier includes + // (not counted as a "feature" and not in the features list) + uint32 anyNamesCountIncluded = 10; + // somename.any - len of 8 + uint32 anyNameMinLength = 11; + // each tier has a set of features + repeated Feature features = 12; + // green, blue, red, purple or custom color in string format #ff00ff + string colorStr = 13; + + // Stripe platform-specific data: + string stripeProductId = 14; + string stripeManageUrl = 15; + + // iOS platform-specific data: + string iosProductId = 16; + string iosManageUrl = 17; + + // Android platform-specific data: + string androidProductId = 18; + string androidManageUrl = 19; +} + +message GetTiersResponse { + // list of all available tiers + repeated TierData tiers = 1; +} diff --git a/testutil/anymock/anymock.go b/testutil/anymock/anymock.go new file mode 100644 index 00000000..0a6f7922 --- /dev/null +++ b/testutil/anymock/anymock.go @@ -0,0 +1,22 @@ +package anymock + +import "go.uber.org/mock/gomock" + +type MockComp interface { + Name() *gomock.Call + Init(x any) *gomock.Call +} + +type MockCompRunnable interface { + Run(x any) *gomock.Call + Close(x any) *gomock.Call +} + +func ExpectComp(c MockComp, name string) { + c.Name().Return(name).AnyTimes() + c.Init(gomock.Any()).AnyTimes() + if cr, ok := c.(MockCompRunnable); ok { + cr.Run(gomock.Any()).AnyTimes() + cr.Close(gomock.Any()).AnyTimes() + } +} diff --git a/util/crypto/mnemonic.go b/util/crypto/mnemonic.go index f1565e9d..9aed9022 100644 --- a/util/crypto/mnemonic.go +++ b/util/crypto/mnemonic.go @@ -7,11 +7,11 @@ import ( "fmt" "github.com/anyproto/go-slip10" + "github.com/btcsuite/btcd/chaincfg" + "github.com/btcsuite/btcutil/hdkeychain" "github.com/tyler-smith/go-bip39" - hdwallet "github.com/miguelmota/go-ethereum-hdwallet" - - "github.com/ethereum/go-ethereum/common" + "github.com/anyproto/any-sync/util/ethereum/accounts" ) var ( @@ -40,6 +40,9 @@ type DerivationResult struct { OldAccountKey PrivKey MasterNode slip10.Node + // Anytype uses ED25519 + // Ethereum and Bitcoin use ECDSA secp256k1 elliptic curves + // // this key is used to sign ethereum transactions to use Any Naming Service // same mnemonic/seed phrase is used as for AnyType identity // m/44'/60'/0'/0/index @@ -134,7 +137,7 @@ func (m Mnemonic) DeriveKeys(index uint32) (res DerivationResult, err error) { res.OldAccountKey = oldRes.MasterKey // now derive ethereum key - _, pk, err := m.ethereumKeyFromMnemonic(index, defaultEthereumDerivation) + pk, err := m.ethereumKeyFromMnemonic(index, defaultEthereumDerivation) if err != nil { return } @@ -164,28 +167,49 @@ func genKey(node slip10.Node) (key PrivKey, err error) { return } -func (m Mnemonic) ethereumKeyFromMnemonic(index uint32, path string) (addr common.Address, pk *ecdsa.PrivateKey, err error) { - wallet, err := hdwallet.NewFromMnemonic(string(m)) +func derivePrivateKey(masterKey *hdkeychain.ExtendedKey, path accounts.DerivationPath) (*ecdsa.PrivateKey, error) { + var err error + key := masterKey + for _, n := range path { + key, err = key.DeriveNonStandard(n) + + if err != nil { + return nil, err + } + } + + privateKey, err := key.ECPrivKey() + privateKeyECDSA := privateKey.ToECDSA() if err != nil { - return common.Address{}, nil, err + return nil, err + } + + return privateKeyECDSA, nil +} + +func (m Mnemonic) ethereumKeyFromMnemonic(index uint32, path string) (pk *ecdsa.PrivateKey, err error) { + seed, err := m.Seed() + if err != nil { + return + } + + masterKey, err := hdkeychain.NewMaster(seed, &chaincfg.MainNetParams) + if err != nil { + return nil, err } // m/44'/60'/0'/0/0 for first account // m/44'/60'/0'/0/1 for second account, etc fullPath := fmt.Sprintf("%s/%d", path, index) - - p := hdwallet.MustParseDerivationPath(fullPath) - account, err := wallet.Derive(p, false) + p, err := accounts.ParseDerivationPath(fullPath) if err != nil { - return common.Address{}, nil, err + panic(err) } - addr = account.Address - - pk, err = wallet.PrivateKey(account) + pk, err = derivePrivateKey(masterKey, p) if err != nil { - return common.Address{}, nil, err + return nil, err } - return addr, pk, nil + return pk, nil } diff --git a/util/crypto/mnemonic_test.go b/util/crypto/mnemonic_test.go index 6c3dc52c..95af7c42 100644 --- a/util/crypto/mnemonic_test.go +++ b/util/crypto/mnemonic_test.go @@ -2,17 +2,49 @@ package crypto import ( "crypto/ecdsa" + "crypto/elliptic" "crypto/rand" + "encoding/hex" + "fmt" "strings" "testing" "github.com/anyproto/go-slip10" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/require" + "golang.org/x/crypto/sha3" ) +func Keccak256(data []byte) []byte { + hash := sha3.NewLegacyKeccak256() + hash.Write(data) + return hash.Sum(nil) +} + +func PublicKeyToAddress(pub *ecdsa.PublicKey) string { + // Serialize the public key to a byte slice + pubBytes := elliptic.Marshal(pub.Curve, pub.X, pub.Y) + + // Compute the Keccak256 hash of the public key (excluding the first byte) + hash := Keccak256(pubBytes[1:]) + + // Take the last 20 bytes of the hash as the address + address := hash[12:] + + return fmt.Sprintf("0x%x", address) +} + +func PrivateKeyToBytes(priv *ecdsa.PrivateKey) []byte { + return priv.D.Bytes() +} + +// Encode encodes b as a hex string with 0x prefix. +func Encode(b []byte) string { + enc := make([]byte, len(b)*2+2) + copy(enc, "0x") + hex.Encode(enc[2:], b) + return string(enc) +} + func TestMnemonic(t *testing.T) { phrase, err := NewMnemonicGenerator().WithWordCount(12) require.NoError(t, err) @@ -55,33 +87,53 @@ func TestMnemonic(t *testing.T) { publicKey := res.EthereumIdentity.Public() publicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey) require.Equal(t, true, ok) - ethAddress := crypto.PubkeyToAddress(*publicKeyECDSA) - require.Equal(t, common.HexToAddress("0xC49926C4124cEe1cbA0Ea94Ea31a6c12318df947"), ethAddress) + // convert publicKeyECDSA to address + ethAddress := PublicKeyToAddress(publicKeyECDSA) + shouldBe := strings.ToLower("0xC49926C4124cEe1cbA0Ea94Ea31a6c12318df947") + require.Equal(t, shouldBe, ethAddress) } func TestMnemonic_ethereumKeyFromMnemonic(t *testing.T) { var badPphrase Mnemonic = "tag volcano" - _, _, err := badPphrase.ethereumKeyFromMnemonic(0, defaultEthereumDerivation) + _, err := badPphrase.ethereumKeyFromMnemonic(0, defaultEthereumDerivation) require.Error(t, err) // good var phrase Mnemonic = "tag volcano eight thank tide danger coast health above argue embrace heavy" - addr, pk, err := phrase.ethereumKeyFromMnemonic(0, defaultEthereumDerivation) + pk, err := phrase.ethereumKeyFromMnemonic(0, defaultEthereumDerivation) require.NoError(t, err) - require.Equal(t, common.HexToAddress("0xC49926C4124cEe1cbA0Ea94Ea31a6c12318df947"), addr) + + // check address + publicKey := pk.Public() + publicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey) + require.Equal(t, true, ok) + + // convert publicKeyECDSA to address + ethAddress := PublicKeyToAddress(publicKeyECDSA) + shouldBe := strings.ToLower("0xC49926C4124cEe1cbA0Ea94Ea31a6c12318df947") + require.Equal(t, shouldBe, ethAddress) // what wallet.PrivateKeyHex(account) does - bytes := crypto.FromECDSA(pk) - pkStr := hexutil.Encode(bytes)[2:] + bytes := PrivateKeyToBytes(pk) + pkStr := Encode(bytes)[2:] require.Equal(t, "63e21d10fd50155dbba0e7d3f7431a400b84b4c2ac1ee38872f82448fe3ecfb9", pkStr) - addr, pk, err = phrase.ethereumKeyFromMnemonic(1, defaultEthereumDerivation) + pk, err = phrase.ethereumKeyFromMnemonic(1, defaultEthereumDerivation) require.NoError(t, err) - require.Equal(t, common.HexToAddress("0x8230645aC28A4EdD1b0B53E7Cd8019744E9dD559"), addr) - bytes = crypto.FromECDSA(pk) - pkStr = hexutil.Encode(bytes)[2:] + // check address + publicKey = pk.Public() + publicKeyECDSA, ok = publicKey.(*ecdsa.PublicKey) + require.Equal(t, true, ok) + + // convert publicKeyECDSA to address + ethAddress = PublicKeyToAddress(publicKeyECDSA) + shouldBe = strings.ToLower("0x8230645aC28A4EdD1b0B53E7Cd8019744E9dD559") + require.Equal(t, shouldBe, ethAddress) + + bytes = PrivateKeyToBytes(pk) + pkStr = Encode(bytes)[2:] require.Equal(t, "b31048b0aa87649bdb9016c0ee28c788ddfc45e52cd71cc0da08c47cb4390ae7", pkStr) } diff --git a/util/debug/stack.go b/util/debug/stack.go new file mode 100644 index 00000000..a7940649 --- /dev/null +++ b/util/debug/stack.go @@ -0,0 +1,28 @@ +package debug + +import ( + "bytes" + "compress/gzip" + "encoding/base64" + "runtime" +) + +func StackCompact(allGoroutines bool) string { + var buf bytes.Buffer + gz := gzip.NewWriter(&buf) + _, _ = gz.Write(Stack(allGoroutines)) + _ = gz.Close() + + return base64.StdEncoding.EncodeToString(buf.Bytes()) +} + +func Stack(allGoroutines bool) []byte { + buf := make([]byte, 1024) + for { + n := runtime.Stack(buf, allGoroutines) + if n < len(buf) { + return buf[:n] + } + buf = make([]byte, 2*len(buf)) + } +} diff --git a/util/debug/stack_test.go b/util/debug/stack_test.go new file mode 100644 index 00000000..ccb4634f --- /dev/null +++ b/util/debug/stack_test.go @@ -0,0 +1,38 @@ +package debug + +import ( + "bytes" + "compress/gzip" + "encoding/base64" + "strings" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestStack(t *testing.T) { + stack := Stack(true) + require.True(t, strings.Contains(string(stack), "main.main")) +} + +func TestStackCompact(t *testing.T) { + stack := StackCompact(true) + decoded, err := base64.StdEncoding.DecodeString(string(stack)) + require.NoError(t, err) + rd, err := gzip.NewReader(bytes.NewReader(decoded)) + require.NoError(t, err) + var ( + buf = make([]byte, 1024) + res []byte + ) + for { + n, err := rd.Read(buf) + if n > 0 { + res = append(res, buf[:n]...) + } + if err != nil { + break + } + } + require.True(t, strings.Contains(string(res), "main.main")) +} diff --git a/util/ethereum/accounts/hd.go b/util/ethereum/accounts/hd.go new file mode 100644 index 00000000..2ec577fc --- /dev/null +++ b/util/ethereum/accounts/hd.go @@ -0,0 +1,112 @@ +// Copyright 2017 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package accounts + +import ( + "errors" + "fmt" + "math" + "math/big" + "strings" +) + +// DefaultRootDerivationPath is the root path to which custom derivation endpoints +// are appended. As such, the first account will be at m/44'/60'/0'/0, the second +// at m/44'/60'/0'/1, etc. +var DefaultRootDerivationPath = DerivationPath{0x80000000 + 44, 0x80000000 + 60, 0x80000000 + 0, 0} + +// DefaultBaseDerivationPath is the base path from which custom derivation endpoints +// are incremented. As such, the first account will be at m/44'/60'/0'/0/0, the second +// at m/44'/60'/0'/0/1, etc. +var DefaultBaseDerivationPath = DerivationPath{0x80000000 + 44, 0x80000000 + 60, 0x80000000 + 0, 0, 0} + +// DerivationPath represents the computer friendly version of a hierarchical +// deterministic wallet account derivation path. +// +// The BIP-32 spec https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki +// defines derivation paths to be of the form: +// +// m / purpose' / coin_type' / account' / change / address_index +// +// The BIP-44 spec https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki +// defines that the `purpose` be 44' (or 0x8000002C) for crypto currencies, and +// SLIP-44 https://github.com/satoshilabs/slips/blob/master/slip-0044.md assigns +// the `coin_type` 60' (or 0x8000003C) to Ethereum. +// +// The root path for Ethereum is m/44'/60'/0'/0 according to the specification +// from https://github.com/ethereum/EIPs/issues/84, albeit it's not set in stone +// yet whether accounts should increment the last component or the children of +// that. We will go with the simpler approach of incrementing the last component. +type DerivationPath []uint32 + +// ParseDerivationPath converts a user specified derivation path string to the +// internal binary representation. +// +// Full derivation paths need to start with the `m/` prefix, relative derivation +// paths (which will get appended to the default root path) must not have prefixes +// in front of the first element. Whitespace is ignored. +func ParseDerivationPath(path string) (DerivationPath, error) { + var result DerivationPath + + // Handle absolute or relative paths + components := strings.Split(path, "/") + switch { + case len(components) == 0: + return nil, errors.New("empty derivation path") + + case strings.TrimSpace(components[0]) == "": + return nil, errors.New("ambiguous path: use 'm/' prefix for absolute paths, or no leading '/' for relative ones") + + case strings.TrimSpace(components[0]) == "m": + components = components[1:] + + default: + result = append(result, DefaultRootDerivationPath...) + } + // All remaining components are relative, append one by one + if len(components) == 0 { + return nil, errors.New("empty derivation path") // Empty relative paths + } + for _, component := range components { + // Ignore any user added whitespace + component = strings.TrimSpace(component) + var value uint32 + + // Handle hardened paths + if strings.HasSuffix(component, "'") { + value = 0x80000000 + component = strings.TrimSpace(strings.TrimSuffix(component, "'")) + } + // Handle the non hardened component + bigval, ok := new(big.Int).SetString(component, 0) + if !ok { + return nil, fmt.Errorf("invalid component: %s", component) + } + max := math.MaxUint32 - value + if bigval.Sign() < 0 || bigval.Cmp(big.NewInt(int64(max))) > 0 { + if value == 0 { + return nil, fmt.Errorf("component %v out of allowed range [0, %d]", bigval, max) + } + return nil, fmt.Errorf("component %v out of allowed hardened range [0, %d]", bigval, max) + } + value += uint32(bigval.Uint64()) + + // Append and repeat + result = append(result, value) + } + return result, nil +}