Files
Igor Sirotin f9cc782a6f refactor: move services to pkg/services
Part of the Go project layout migration, item 31.

Pure move plus import-path rewrite across 687 files. No API or behaviour
change.

The services keep their grouping under pkg/services/<name> rather than
being promoted to pkg/<name>: 27 top-level directories in pkg/ would read
worse than what we have, and the grouping is what makes "an RPC service"
identifiable at a glance.

Paths that follow the move: the logosstorage test target and generate
step, the two wallet token-list tools, the migration-order check (and the
pre-rebase hook symlinked to it), and the storage env helper.

refs #7067
2026-08-21 10:11:05 +02:00

39 lines
1.3 KiB
Go

package personal
import (
"errors"
"github.com/status-im/status-go/internal/accounts-management/generator"
"github.com/status-im/status-go/internal/crypto/types"
)
var (
ErrInvalidSignatureLength = errors.New("invalid signature, must be 65 bytes long")
ErrInvalidSignatureV = errors.New("invalid Ethereum signature (V is not 27 or 28)")
)
// PublicAPI represents a set of APIs from the `web3.personal` namespace.
type PublicAPI struct {
s *Service
}
// NewAPI creates an instance of the personal API.
func NewAPI(s *Service) *PublicAPI {
return &PublicAPI{s}
}
// Recover is an implementation of `personal_ecRecover` or `web3.personal.ecRecover` API
func (api *PublicAPI) Recover(rpcParams RecoverParams) (addr types.Address, err error) {
return api.s.Recover(rpcParams)
}
// CanRecover is an implementation of `personal_ecRecover` or `web3.personal.ecRecover` API
func (api *PublicAPI) CanRecover(rpcParams RecoverParams, revealedAddress types.Address) (bool, error) {
return api.s.CanRecover(rpcParams, revealedAddress)
}
// Sign is an implementation of `personal_sign` or `web3.personal.sign` API
func (api *PublicAPI) Sign(rpcParams SignParams, verifiedAccount *generator.Account) (result types.HexBytes, err error) {
return api.s.Sign(rpcParams, verifiedAccount)
}