1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-10 18:10:49 +09:00

GO-5297: fixes

Signed-off-by: AnastasiaShemyakinskaya <shem98a@mail.ru>
This commit is contained in:
AnastasiaShemyakinskaya 2025-03-21 18:42:08 +01:00
parent f41af256fa
commit 1b107488d2
No known key found for this signature in database
GPG key ID: CCD60ED83B103281
4 changed files with 14 additions and 11 deletions

View file

@ -108,11 +108,11 @@ import (
"github.com/anyproto/anytype-heart/space/spacecore"
"github.com/anyproto/anytype-heart/space/spacecore/clientserver"
"github.com/anyproto/anytype-heart/space/spacecore/credentialprovider"
"github.com/anyproto/anytype-heart/space/spacecore/keystore"
"github.com/anyproto/anytype-heart/space/spacecore/localdiscovery"
"github.com/anyproto/anytype-heart/space/spacecore/oldstorage"
"github.com/anyproto/anytype-heart/space/spacecore/peermanager"
"github.com/anyproto/anytype-heart/space/spacecore/peerstore"
"github.com/anyproto/anytype-heart/space/spacecore/spacekeystore"
"github.com/anyproto/anytype-heart/space/spacecore/storage"
"github.com/anyproto/anytype-heart/space/spacecore/storage/migrator"
"github.com/anyproto/anytype-heart/space/spacecore/storage/migratorfinisher"
@ -322,7 +322,7 @@ func Bootstrap(a *app.App, components ...app.Component) {
Register(peerstatus.New()).
Register(spaceview.New()).
Register(api.New()).
Register(keystore.New()).
Register(spacekeystore.New()).
Register(pushnotifcation.New())
}

View file

@ -9,7 +9,8 @@ import (
"github.com/anyproto/anytype-heart/core/pushnotifcation/client"
"github.com/anyproto/anytype-heart/core/wallet"
"github.com/anyproto/anytype-heart/pb"
"github.com/anyproto/anytype-heart/space/spacecore/keystore"
"github.com/anyproto/anytype-heart/space/spacecore/spacekeystore"
)
const CName = "core.pushnotification.service"
@ -30,13 +31,13 @@ func New() Service {
type service struct {
pushClient client.Client
wallet wallet.Wallet
spaceKeyStore keystore.SpaceKeyStore
spaceKeyStore spacekeystore.Store
}
func (s *service) Init(a *app.App) (err error) {
s.pushClient = client.NewClient()
s.wallet = app.MustComponent[wallet.Wallet](a)
s.spaceKeyStore = app.MustComponent[keystore.SpaceKeyStore](a)
s.spaceKeyStore = app.MustComponent[spacekeystore.Store](a)
return
}

View file

@ -18,7 +18,7 @@ import (
"github.com/anyproto/anytype-heart/space/internal/components/participantwatcher"
"github.com/anyproto/anytype-heart/space/internal/components/spaceloader"
"github.com/anyproto/anytype-heart/space/internal/components/spacestatus"
"github.com/anyproto/anytype-heart/space/spacecore/keystore"
"github.com/anyproto/anytype-heart/space/spacecore/spacekeystore"
"github.com/anyproto/anytype-heart/space/spaceinfo"
)
@ -50,7 +50,7 @@ type aclObjectManager struct {
notificationService aclnotifications.AclNotification
participantWatcher participantwatcher.ParticipantWatcher
inviteMigrator invitemigrator.InviteMigrator
spaceKeyStore keystore.SpaceKeyStore
spaceKeyStore spacekeystore.Store
ownerMetadata []byte
lastIndexed string
@ -97,7 +97,7 @@ func (a *aclObjectManager) Init(ap *app.App) (err error) {
a.statService.AddProvider(a)
a.waitLoad = make(chan struct{})
a.wait = make(chan struct{})
a.spaceKeyStore = app.MustComponent[keystore.SpaceKeyStore](ap)
a.spaceKeyStore = app.MustComponent[spacekeystore.Store](ap)
return nil
}

View file

@ -1,4 +1,4 @@
package keystore
package spacekeystore
import (
"bytes"
@ -22,7 +22,7 @@ var ErrNotFound = errors.New("key not found")
const (
CName = "space.core.spaceKeyStore"
spaceKeyPath = "m/SLIP-0021/anytype/space/key"
spaceKeyPath = "m/99999'/1'"
spaceVersion = 0xB5
)
@ -42,6 +42,7 @@ type SpaceKeyStore struct {
}
func (s *SpaceKeyStore) Init(a *app.App) (err error) {
s.eventSender = app.MustComponent[event.Sender](a)
return nil
}
@ -49,13 +50,14 @@ func (s *SpaceKeyStore) Name() (name string) {
return CName
}
func New() app.Component {
func New() Store {
return &SpaceKeyStore{
spaceIdToKey: make(map[string]string),
spaceKeyToEncryptionKey: make(map[string]crypto.PrivKey),
spaceKeyToAclRecordId: make(map[string]string),
}
}
func (s *SpaceKeyStore) SyncKeysFromAclState(spaceID string, aclState *list.AclState) {
s.Lock()
defer s.Unlock()