From e6457899c3796e56d9cc3e0723a1f0561cdc0e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Lewandowski?= Date: Mon, 17 Nov 2025 12:15:01 +0100 Subject: [PATCH] fix: activate storage provider methods for bsv desktop --- .../server/rpc_storage_provider.gen.go | 25 ++++++++++++++++--- pkg/wdk/storage.interface.go | 3 --- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/pkg/storage/internal/server/rpc_storage_provider.gen.go b/pkg/storage/internal/server/rpc_storage_provider.gen.go index 2a1dd366..b89468e1 100644 --- a/pkg/storage/internal/server/rpc_storage_provider.gen.go +++ b/pkg/storage/internal/server/rpc_storage_provider.gen.go @@ -167,19 +167,38 @@ func (p *RPCStorageProvider) ListActions(ctx context.Context, auth wdk.AuthID, a // GetSyncChunk retrieves a chunk of sync data for a user between two storages using the provided synchronization arguments. // Skipped in WalletStorage interface and not exposed in StorageManager. func (p *RPCStorageProvider) GetSyncChunk(ctx context.Context, args wdk.RequestSyncChunkArgs) (*wdk.SyncChunk, error) { - return nil, fmt.Errorf("method not allowed to be called via RPC") + err := p.verifyAuthenticated(ctx) + if err != nil { + return nil, err + } + + return p.localProvider.GetSyncChunk(ctx, args) } // FindOrInsertSyncStateAuth retrieves an existing sync state or inserts a new one based on the provided authentication and storage details. // Skipped in WalletStorage interface and not exposed in StorageManager. func (p *RPCStorageProvider) FindOrInsertSyncStateAuth(ctx context.Context, auth wdk.AuthID, storageIdentityKey string, storageName string) (*wdk.FindOrInsertSyncStateAuthResponse, error) { - return nil, fmt.Errorf("method not allowed to be called via RPC") + err := p.verifyAuthID(ctx, auth) + if err != nil { + return nil, err + } + err = p.ensureUserID(ctx, &auth) + if err != nil { + return nil, err + } + + return p.localProvider.FindOrInsertSyncStateAuth(ctx, auth, storageIdentityKey, storageName) } // ProcessSyncChunk processes a sync chunk for a user, applying the changes contained within it. // Skipped in WalletStorage interface and not exposed in StorageManager. func (p *RPCStorageProvider) ProcessSyncChunk(ctx context.Context, args wdk.RequestSyncChunkArgs, chunk *wdk.SyncChunk) (*wdk.ProcessSyncChunkResult, error) { - return nil, fmt.Errorf("method not allowed to be called via RPC") + err := p.verifyAuthenticated(ctx) + if err != nil { + return nil, err + } + + return p.localProvider.ProcessSyncChunk(ctx, args, chunk) } // AbortAction aborts a transaction that is in progress and has not yet been finalized or sent to the network. diff --git a/pkg/wdk/storage.interface.go b/pkg/wdk/storage.interface.go index 2d7f672a..d6259d65 100644 --- a/pkg/wdk/storage.interface.go +++ b/pkg/wdk/storage.interface.go @@ -69,19 +69,16 @@ type WalletStorageProvider interface { // GetSyncChunk retrieves a chunk of sync data for a user between two storages using the provided synchronization arguments. // Skipped in WalletStorage interface and not exposed in StorageManager. // @Sync - // @NonRPC GetSyncChunk(ctx context.Context, args RequestSyncChunkArgs) (*SyncChunk, error) // FindOrInsertSyncStateAuth retrieves an existing sync state or inserts a new one based on the provided authentication and storage details. // Skipped in WalletStorage interface and not exposed in StorageManager. // @Sync - // @NonRPC FindOrInsertSyncStateAuth(ctx context.Context, auth AuthID, storageIdentityKey, storageName string) (*FindOrInsertSyncStateAuthResponse, error) // ProcessSyncChunk processes a sync chunk for a user, applying the changes contained within it. // Skipped in WalletStorage interface and not exposed in StorageManager. // @Sync - // @NonRPC ProcessSyncChunk(ctx context.Context, args RequestSyncChunkArgs, chunk *SyncChunk) (*ProcessSyncChunkResult, error) // AbortAction aborts a transaction that is in progress and has not yet been finalized or sent to the network.