Documentation
¶
Index ¶
- Constants
- Variables
- type Channel
- type CloseSessionArgs
- type CloseSessionReply
- type Config
- type CreateSessionArgs
- type CreateSessionReply
- type Factory
- type GetSessionArgs
- type GetSessionReply
- type HealthArgs
- type HealthReply
- type Message
- type SendMessageArgs
- type SendMessageReply
- type Service
- func (s *Service) CloseSession(r *http.Request, args *CloseSessionArgs, reply *CloseSessionReply) error
- func (s *Service) CreateSession(r *http.Request, args *CreateSessionArgs, reply *CreateSessionReply) error
- func (s *Service) GetSession(r *http.Request, args *GetSessionArgs, reply *GetSessionReply) error
- func (s *Service) Health(r *http.Request, args *HealthArgs, reply *HealthReply) error
- func (s *Service) SendMessage(r *http.Request, args *SendMessageArgs, reply *SendMessageReply) error
- type Session
- type VM
- func (vm *VM) CloseSession(sessionID ids.ID) error
- func (vm *VM) CreateHandlers(ctx context.Context) (map[string]http.Handler, error)
- func (vm *VM) CreateSession(participants []ids.ID, publicKeys [][]byte) (*Session, error)
- func (vm *VM) GetSession(sessionID ids.ID) (*Session, error)
- func (vm *VM) HealthCheck(ctx context.Context) (interface{}, error)
- func (vm *VM) Initialize(logger log.Logger, configBytes []byte) error
- func (vm *VM) SendMessage(sessionID ids.ID, sender ids.ID, ciphertext, signature []byte) (*Message, error)
- func (vm *VM) Shutdown(ctx context.Context) error
Constants ¶
const ( // Session states SessionPending = "pending" SessionActive = "active" SessionExpired = "expired" SessionClosed = "closed" )
const Name = "sessionvm"
Name is the human-readable name for this VM
Variables ¶
var VMID = ids.ID{'s', 'e', 's', 's', 'i', 'o', 'n', 'v', 'm'}
VMID is the unique identifier for SessionVM Base58: 2ZbQaVuXHtT7vfJt8FmWEQKAT4NgtPqWEZHg5m3tUvEiSMnQNt
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct {
ID ids.ID `json:"id"`
Name string `json:"name"`
Owner ids.ID `json:"owner"`
Members []ids.ID `json:"members"`
Created time.Time `json:"created"`
MessageCount uint64 `json:"messageCount"`
}
Channel represents a multi-party communication channel
type CloseSessionArgs ¶
type CloseSessionArgs struct {
SessionID string `json:"sessionId"`
}
CloseSessionArgs are the arguments for CloseSession
type CloseSessionReply ¶
type CloseSessionReply struct {
Success bool `json:"success"`
}
CloseSessionReply is the reply for CloseSession
type Config ¶
type Config struct {
SessionTTL int64 `json:"sessionTTL"` // Seconds
MaxMessages int `json:"maxMessages"`
MaxChannels int `json:"maxChannels"`
RetentionDays int `json:"retentionDays"`
IDPrefix string `json:"idPrefix"` // Post-quantum session ID prefix
}
Config holds SessionVM configuration
type CreateSessionArgs ¶
type CreateSessionArgs struct {
Participants []string `json:"participants"`
PublicKeys []string `json:"publicKeys"` // Hex-encoded ML-KEM public keys
}
CreateSessionArgs are the arguments for CreateSession
type CreateSessionReply ¶
type CreateSessionReply struct {
SessionID string `json:"sessionId"`
Expires int64 `json:"expires"`
}
CreateSessionReply is the reply for CreateSession
type GetSessionArgs ¶
type GetSessionArgs struct {
SessionID string `json:"sessionId"`
}
GetSessionArgs are the arguments for GetSession
type GetSessionReply ¶
type GetSessionReply struct {
Session *Session `json:"session"`
}
GetSessionReply is the reply for GetSession
type HealthReply ¶
type HealthReply struct {
Healthy bool `json:"healthy"`
Sessions int `json:"sessions"`
Channels int `json:"channels"`
Pending int `json:"pending"`
}
HealthReply is the reply for Health
type Message ¶
type Message struct {
ID ids.ID `json:"id"`
SessionID ids.ID `json:"sessionId"`
Sender ids.ID `json:"sender"`
Ciphertext []byte `json:"ciphertext"` // Encrypted with session key
Signature []byte `json:"signature"` // ML-DSA signature
Timestamp time.Time `json:"timestamp"`
Sequence uint64 `json:"sequence"`
}
Message represents an encrypted message within a session
type SendMessageArgs ¶
type SendMessageArgs struct {
SessionID string `json:"sessionId"`
Sender string `json:"sender"`
Ciphertext string `json:"ciphertext"` // Hex-encoded encrypted message
Signature string `json:"signature"` // Hex-encoded ML-DSA signature
}
SendMessageArgs are the arguments for SendMessage
type SendMessageReply ¶
type SendMessageReply struct {
MessageID string `json:"messageId"`
Sequence uint64 `json:"sequence"`
}
SendMessageReply is the reply for SendMessage
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides RPC methods for the SessionVM
func (*Service) CloseSession ¶
func (s *Service) CloseSession(r *http.Request, args *CloseSessionArgs, reply *CloseSessionReply) error
CloseSession closes a session
func (*Service) CreateSession ¶
func (s *Service) CreateSession(r *http.Request, args *CreateSessionArgs, reply *CreateSessionReply) error
CreateSession creates a new encrypted session
func (*Service) GetSession ¶
func (s *Service) GetSession(r *http.Request, args *GetSessionArgs, reply *GetSessionReply) error
GetSession returns session details
func (*Service) Health ¶
func (s *Service) Health(r *http.Request, args *HealthArgs, reply *HealthReply) error
Health returns the health status
func (*Service) SendMessage ¶
func (s *Service) SendMessage(r *http.Request, args *SendMessageArgs, reply *SendMessageReply) error
SendMessage sends an encrypted message within a session
type Session ¶
type Session struct {
ID ids.ID `json:"id"`
Participants []ids.ID `json:"participants"`
PublicKeys [][]byte `json:"publicKeys"` // PQ public keys (ML-KEM)
ChannelID ids.ID `json:"channelId"`
Created time.Time `json:"created"`
Expires time.Time `json:"expires"`
Status string `json:"status"`
Metadata map[string]string `json:"metadata"`
}
Session represents an encrypted communication session
type VM ¶
type VM struct {
// contains filtered or unexported fields
}
VM implements the SessionVM
func (*VM) CloseSession ¶
CloseSession closes a session
func (*VM) CreateHandlers ¶
CreateHandlers returns the HTTP handlers for this VM
func (*VM) CreateSession ¶
CreateSession creates a new encrypted session
func (*VM) GetSession ¶
GetSession returns a session by ID
func (*VM) HealthCheck ¶
HealthCheck returns the health status of the VM
func (*VM) Initialize ¶
Initialize initializes the VM