Documentation
¶
Overview ¶
Package kchain provides the K-Chain (KMS) adapter for the DAG indexer. Handles distributed key management, threshold signatures, and post-quantum algorithms.
Index ¶
- Constants
- type Adapter
- func (a *Adapter) GetKeyByID(ctx context.Context, id string) (*Key, error)
- func (a *Adapter) GetKeysByAlgorithm(ctx context.Context, store storage.Store, algorithm string, limit, offset int) ([]Key, error)
- func (a *Adapter) GetPostQuantumKeys(ctx context.Context, store storage.Store, limit, offset int) ([]Key, error)
- func (a *Adapter) GetRecentVertices(ctx context.Context, limit int) ([]json.RawMessage, error)
- func (a *Adapter) GetStats(ctx context.Context, store storage.Store) (map[string]interface{}, error)
- func (a *Adapter) GetThresholdKeys(ctx context.Context, store storage.Store, limit, offset int) ([]Key, error)
- func (a *Adapter) GetVertexByID(ctx context.Context, id string) (json.RawMessage, error)
- func (a *Adapter) InitSchema(ctx context.Context, store storage.Store) error
- func (a *Adapter) ListAlgorithms(ctx context.Context) ([]Algorithm, error)
- func (a *Adapter) ListKeys(ctx context.Context, algorithm, status string, offset, limit int) ([]Key, error)
- func (a *Adapter) ParseVertex(data json.RawMessage) (*dag.Vertex, error)
- func (a *Adapter) StoreEncryptionRequest(ctx context.Context, store storage.Store, req EncryptionRequest) error
- func (a *Adapter) StoreKey(ctx context.Context, store storage.Store, k Key) error
- func (a *Adapter) StoreKeyOperation(ctx context.Context, store storage.Store, op KeyOperation) error
- func (a *Adapter) StoreSignatureRequest(ctx context.Context, store storage.Store, req SignatureRequest) error
- func (a *Adapter) StoreVertex(ctx context.Context, store storage.Store, v *dag.Vertex) error
- func (a *Adapter) UpdateExtendedStats(ctx context.Context, store storage.Store) error
- type Algorithm
- type AlgorithmType
- type EncryptionRequest
- type Key
- type KeyOperation
- type KeyStatus
- type SignatureRequest
Constants ¶
const ( // DefaultPort for K-Chain indexer API DefaultPort = 4900 // DefaultDatabase name DefaultDatabase = "explorer_kchain" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter implements the DAG adapter interface for K-Chain
func (*Adapter) GetKeyByID ¶
GetKeyByID fetches a specific key by ID
func (*Adapter) GetKeysByAlgorithm ¶
func (a *Adapter) GetKeysByAlgorithm(ctx context.Context, store storage.Store, algorithm string, limit, offset int) ([]Key, error)
GetKeysByAlgorithm returns keys filtered by algorithm
func (*Adapter) GetPostQuantumKeys ¶
func (a *Adapter) GetPostQuantumKeys(ctx context.Context, store storage.Store, limit, offset int) ([]Key, error)
GetPostQuantumKeys returns all post-quantum keys
func (*Adapter) GetRecentVertices ¶
GetRecentVertices fetches recent vertices from K-Chain RPC
func (*Adapter) GetStats ¶
func (a *Adapter) GetStats(ctx context.Context, store storage.Store) (map[string]interface{}, error)
GetStats returns K-Chain specific statistics using unified storage
func (*Adapter) GetThresholdKeys ¶
func (a *Adapter) GetThresholdKeys(ctx context.Context, store storage.Store, limit, offset int) ([]Key, error)
GetThresholdKeys returns all threshold keys (threshold > 1)
func (*Adapter) GetVertexByID ¶
GetVertexByID fetches a specific vertex by ID
func (*Adapter) InitSchema ¶
InitSchema creates K-Chain specific database tables using unified storage
func (*Adapter) ListAlgorithms ¶
ListAlgorithms fetches supported algorithms
func (*Adapter) ListKeys ¶
func (a *Adapter) ListKeys(ctx context.Context, algorithm, status string, offset, limit int) ([]Key, error)
ListKeys fetches all keys from K-Chain
func (*Adapter) ParseVertex ¶
ParseVertex parses K-Chain vertex data
func (*Adapter) StoreEncryptionRequest ¶
func (a *Adapter) StoreEncryptionRequest(ctx context.Context, store storage.Store, req EncryptionRequest) error
StoreEncryptionRequest stores an encryption request
func (*Adapter) StoreKeyOperation ¶
func (a *Adapter) StoreKeyOperation(ctx context.Context, store storage.Store, op KeyOperation) error
StoreKeyOperation stores a key operation
func (*Adapter) StoreSignatureRequest ¶
func (a *Adapter) StoreSignatureRequest(ctx context.Context, store storage.Store, req SignatureRequest) error
StoreSignatureRequest stores a signature request
func (*Adapter) StoreVertex ¶
StoreVertex stores vertex data
type Algorithm ¶
type Algorithm struct {
Name string `json:"name"`
Type string `json:"type"`
SecurityLevel int `json:"securityLevel"`
KeySize int `json:"keySize"`
SignatureSize int `json:"signatureSize"`
PostQuantum bool `json:"postQuantum"`
ThresholdSupport bool `json:"thresholdSupport"`
Description string `json:"description"`
Standards []string `json:"standards"`
}
Algorithm represents a supported cryptographic algorithm
type AlgorithmType ¶
type AlgorithmType string
AlgorithmType represents cryptographic algorithm categories
const ( AlgorithmTypeKeyExchange AlgorithmType = "key-exchange" AlgorithmTypeSigning AlgorithmType = "signing" AlgorithmTypeEncryption AlgorithmType = "encryption" )
type EncryptionRequest ¶
type EncryptionRequest struct {
ID string `json:"id"`
KeyID string `json:"keyId"`
Requester string `json:"requester"`
DataSize int64 `json:"dataSize"`
Success bool `json:"success"`
Timestamp time.Time `json:"timestamp"`
}
EncryptionRequest represents an encryption operation
type Key ¶
type Key struct {
ID string `json:"id"`
Name string `json:"name"`
Algorithm string `json:"algorithm"`
KeyType string `json:"keyType"`
PublicKey string `json:"publicKey"`
Threshold int `json:"threshold"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Status KeyStatus `json:"status"`
Tags []string `json:"tags"`
}
Key represents a distributed cryptographic key
type KeyOperation ¶
type KeyOperation struct {
ID string `json:"id"`
KeyID string `json:"keyId"`
Operation string `json:"operation"` // create, rotate, revoke, delete
Initiator string `json:"initiator"`
Participants []string `json:"participants"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
KeyOperation represents a key lifecycle operation
type SignatureRequest ¶
type SignatureRequest struct {
ID string `json:"id"`
KeyID string `json:"keyId"`
Signers []string `json:"signers"`
MessageHash string `json:"messageHash"`
Algorithm string `json:"algorithm"`
Success bool `json:"success"`
Timestamp time.Time `json:"timestamp"`
}
SignatureRequest represents a signing operation