Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUserAlreadyRegistered = errors.New("user already registered") ErrNotWhitelisted = errors.New("address not whitelisted for registration") ErrPartyAlreadyAllocated = errors.New("canton party already allocated for this user") ErrInvalidCantonSignature = errors.New("invalid Canton signature") ErrPartyAlreadyRegistered = errors.New("canton party already registered") )
View Source
var ( ErrTopologyNotFound = errors.New("topology not found") ErrTopologyExpired = errors.New("topology expired") )
Functions ¶
Types ¶
type HTTP ¶
type HTTP struct {
// contains filtered or unexported fields
}
HTTP wraps the Service to provide HTTP endpoints
type Service ¶
type Service interface {
RegisterWeb3User(ctx context.Context, req *user.RegisterRequest) (*user.RegisterResponse, error)
RegisterCantonNativeUser(ctx context.Context, req *user.RegisterRequest) (*user.RegisterResponse, error)
PrepareExternalRegistration(ctx context.Context, req *user.RegisterRequest) (*user.PrepareTopologyResponse, error)
GetUser(ctx context.Context, evmAddress, msg, sig string) (*user.User, error)
}
Service defines the interface for the registration business logic
type Store ¶
type Store interface {
UserExists(ctx context.Context, evmAddress string) (bool, error)
IsWhitelisted(ctx context.Context, evmAddress string) (bool, error)
CreateUser(ctx context.Context, user *user.User) error
GetUserByCantonPartyID(ctx context.Context, partyID string) (*user.User, error)
GetUserByEVMAddress(ctx context.Context, evmAddress string) (*user.User, error)
DeleteUser(ctx context.Context, evmAddress string) error
}
Store is the narrow data-access interface for the registration service. Defined here to keep registration service decoupled from userstore implementation details.
type TopologyCache ¶
type TopologyCache struct {
// contains filtered or unexported fields
}
TopologyCache stores pending topology data for two-step external user registration.
func NewTopologyCache ¶
func NewTopologyCache(ttl time.Duration) *TopologyCache
NewTopologyCache creates a new topology cache with the given TTL.
func (*TopologyCache) GetAndDelete ¶
func (c *TopologyCache) GetAndDelete(token string) (*user.PendingTopology, error)
GetAndDelete atomically retrieves and removes a pending topology.
func (*TopologyCache) Put ¶
func (c *TopologyCache) Put(token string, topo *identity.ExternalPartyTopology, spkiKey []byte)
Put stores a pending topology keyed by registration token.
type TopologyCacheProvider ¶
type TopologyCacheProvider interface {
Put(token string, topo *identity.ExternalPartyTopology, spkiKey []byte)
GetAndDelete(token string) (*user.PendingTopology, error)
}
TopologyCacheProvider is the interface for storing and retrieving pending topology data.
Click to show internal directories.
Click to hide internal directories.