user

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyModeCustodial = "custodial"
	KeyModeExternal  = "external"
)

Key mode constants for user registration type.

Variables

View Source
var ErrKeyNotFound = errors.New("key not found")
View Source
var ErrUserNotFound = errors.New("user not found")

Functions

This section is empty.

Types

type PendingTopology

type PendingTopology struct {
	Topology  *identity.ExternalPartyTopology
	PublicKey []byte // SPKI public key bytes
	ExpiresAt time.Time
}

PendingTopology holds the topology data for a pending external user registration.

type PrepareTopologyResponse

type PrepareTopologyResponse struct {
	TopologyHash         string `json:"topology_hash"`
	PublicKeyFingerprint string `json:"public_key_fingerprint"`
	RegistrationToken    string `json:"registration_token"`
}

PrepareTopologyResponse is the response from the prepare-topology step of external user registration.

type RegisterRequest

type RegisterRequest struct {
	// Web3 user registration (EIP-191 signature)
	Signature string `json:"signature,omitzero"`
	Message   string `json:"message,omitzero"`

	// Canton native user registration (Loop wallet signMessage)
	CantonPartyID   string `json:"canton_party_id,omitzero"`
	CantonSignature string `json:"canton_signature,omitzero"`

	// Optional: hex-encoded 32-byte Canton signing key. When provided for native
	// registration, the handler stores it so the API server can sign Interactive
	// Submission transactions on the user's behalf (e.g. transfers via /eth).
	CantonPrivateKey string `json:"canton_private_key,omitzero"`

	// External (non-custodial) user registration
	KeyMode           string `json:"key_mode,omitzero"`           // "external" for non-custodial
	CantonPublicKey   string `json:"canton_public_key,omitzero"`  // hex compressed secp256k1 public key
	RegistrationToken string `json:"registration_token,omitzero"` // from prepare-topology response
	TopologySignature string `json:"topology_signature,omitzero"` // DER sig of topology hash (hex)
}

RegisterRequest represents a registration request Supports three registration modes: 1. Web3 user (custodial): signature + message (EIP-191 signature from MetaMask) 2. Canton native user: canton_party_id + canton_signature + message (from Loop wallet signMessage) 3. External user (non-custodial): key_mode="external" + canton_public_key + registration_token + topology_signature

type RegisterResponse

type RegisterResponse struct {
	Party       string `json:"party"`
	Fingerprint string `json:"fingerprint"`
	MappingCID  string `json:"mapping_cid,omitzero"`
	EVMAddress  string `json:"evm_address,omitzero"` // Returned for Canton native users
	PrivateKey  string `json:"private_key,omitzero"` // Returned for Canton native users (for MetaMask import)
	KeyMode     string `json:"key_mode,omitzero"`    // "custodial" or "external"
}

RegisterResponse represents a registration response

type User

type User struct {
	EVMAddress                 string     `json:"evm_address"`
	CantonParty                string     `json:"canton_party"`
	Fingerprint                string     `json:"fingerprint"`
	MappingCID                 string     `json:"mapping_cid"`
	CantonPartyID              string     `json:"-"`
	CantonKeyCreatedAt         *time.Time `json:"-"`
	CantonPrivateKeyEncrypted  string     `json:"-"`
	KeyMode                    string     `json:"key_mode"` // "custodial" or "external"
	CantonPublicKeyFingerprint string     `json:"-"`        // For external users: Canton multihash fingerprint
}

User represents the domain model for a registered user.

func New

func New(evmAddress, cantonPartyID, fingerprint, mappingCID, encryptedPKey string) *User

New creates a custodial User from the given parameters.

func NewExternal

func NewExternal(evmAddress, cantonPartyID, fingerprint, mappingCID, publicKeyFingerprint string) *User

NewExternal creates a non-custodial (external) User. No private key is stored.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL