Documentation
¶
Index ¶
- Variables
- func CreateTestCheckpoint(epoch int64, root string) *types.Checkpoint
- func CreateTestReportEvent(from, to *TestKeyPair, context, reasonCode string) (*events.Event, error)
- func CreateTestRuleset() *types.Ruleset
- func CreateTestScoreRecord(did, context string, score float64) *types.ScoreRecord
- func CreateTestVouchEvent(from, to *TestKeyPair, context string) (*events.Event, error)
- func CreateVouchChain(network []*TestKeyPair, context string) ([]*events.Event, error)
- func GenerateRandomSeed() ([]byte, error)
- func GenerateTestSeed(identifier string) []byte
- type MockCheckpointService
- func (m *MockCheckpointService) CreateCheckpoint(ctx context.Context, treeRoot string, treeID string, epoch int64) (*types.Checkpoint, error)
- func (m *MockCheckpointService) GetCheckpoint(ctx context.Context, epoch int64) (*types.Checkpoint, error)
- func (m *MockCheckpointService) GetLatestCheckpoint(ctx context.Context) (*types.Checkpoint, error)
- func (m *MockCheckpointService) SubmitPartialSignature(ctx context.Context, checkpointData []byte, signerIndex int, signature []byte) error
- func (m *MockCheckpointService) VerifyCheckpoint(ctx context.Context, checkpoint *types.Checkpoint) (bool, error)
- type MockEventService
- func (m *MockEventService) GetEvent(ctx context.Context, c ipfscid.Cid) (*events.Event, error)
- func (m *MockEventService) GetEventsByDID(ctx context.Context, did string, eventType events.EventType, limit int) ([]*events.Event, error)
- func (m *MockEventService) SubmitEvent(ctx context.Context, event *events.Event) (*types.EventReceipt, error)
- func (m *MockEventService) ValidateEvent(ctx context.Context, event *events.Event) error
- type MockScorerService
- func (m *MockScorerService) ComputeScore(ctx context.Context, did, context string) (*types.ScoreRecord, error)
- func (m *MockScorerService) GenerateThresholdProof(ctx context.Context, did, context string, threshold float64, nonce string) (*types.ThresholdProof, error)
- func (m *MockScorerService) GetScore(ctx context.Context, did, context string) (*types.ScoreRecord, error)
- func (m *MockScorerService) SetScore(did, context string, score float64)
- func (m *MockScorerService) UpdateScores(ctx context.Context, eventCIDs []ipfscid.Cid) error
- func (m *MockScorerService) VerifyThresholdProof(ctx context.Context, proof *types.ThresholdProof) (bool, error)
- type MockStorageService
- func (m *MockStorageService) Delete(ctx context.Context, c ipfscid.Cid) error
- func (m *MockStorageService) Get(ctx context.Context, c ipfscid.Cid) ([]byte, error)
- func (m *MockStorageService) Has(ctx context.Context, c ipfscid.Cid) (bool, error)
- func (m *MockStorageService) Index(ctx context.Context, c ipfscid.Cid, metadata map[string]interface{}) error
- func (m *MockStorageService) Put(ctx context.Context, data []byte) (ipfscid.Cid, error)
- func (m *MockStorageService) Size(ctx context.Context, c ipfscid.Cid) (int64, error)
- type TestEventValidator
- type TestKeyPair
Constants ¶
This section is empty.
Variables ¶
var (
ErrContentNotFound = fmt.Errorf("content not found")
)
TestErrors defines common test errors
Functions ¶
func CreateTestCheckpoint ¶
func CreateTestCheckpoint(epoch int64, root string) *types.Checkpoint
CreateTestCheckpoint creates a test checkpoint
func CreateTestReportEvent ¶
func CreateTestReportEvent(from, to *TestKeyPair, context, reasonCode string) (*events.Event, error)
CreateTestReportEvent creates a test report event
func CreateTestRuleset ¶
CreateTestRuleset creates a test ruleset with sensible defaults
func CreateTestScoreRecord ¶
func CreateTestScoreRecord(did, context string, score float64) *types.ScoreRecord
CreateTestScoreRecord creates a test score record
func CreateTestVouchEvent ¶
func CreateTestVouchEvent(from, to *TestKeyPair, context string) (*events.Event, error)
CreateTestVouchEvent creates a test vouch event
func CreateVouchChain ¶
func CreateVouchChain(network []*TestKeyPair, context string) ([]*events.Event, error)
CreateVouchChain creates a chain of vouches between test identities
func GenerateRandomSeed ¶
GenerateRandomSeed generates a random seed for testing
func GenerateTestSeed ¶
GenerateTestSeed generates a deterministic test seed
Types ¶
type MockCheckpointService ¶
type MockCheckpointService struct {
// contains filtered or unexported fields
}
MockCheckpointService provides mock checkpoint functionality
func NewMockCheckpointService ¶
func NewMockCheckpointService() *MockCheckpointService
func (*MockCheckpointService) CreateCheckpoint ¶
func (m *MockCheckpointService) CreateCheckpoint(ctx context.Context, treeRoot string, treeID string, epoch int64) (*types.Checkpoint, error)
func (*MockCheckpointService) GetCheckpoint ¶
func (m *MockCheckpointService) GetCheckpoint(ctx context.Context, epoch int64) (*types.Checkpoint, error)
func (*MockCheckpointService) GetLatestCheckpoint ¶
func (m *MockCheckpointService) GetLatestCheckpoint(ctx context.Context) (*types.Checkpoint, error)
func (*MockCheckpointService) SubmitPartialSignature ¶
func (*MockCheckpointService) VerifyCheckpoint ¶
func (m *MockCheckpointService) VerifyCheckpoint(ctx context.Context, checkpoint *types.Checkpoint) (bool, error)
type MockEventService ¶
type MockEventService struct {
// contains filtered or unexported fields
}
MockEventService provides a mock event service for testing
func NewMockEventService ¶
func NewMockEventService() *MockEventService
NewMockEventService creates a new mock event service
func (*MockEventService) GetEventsByDID ¶
func (*MockEventService) SubmitEvent ¶
func (m *MockEventService) SubmitEvent(ctx context.Context, event *events.Event) (*types.EventReceipt, error)
func (*MockEventService) ValidateEvent ¶
type MockScorerService ¶
type MockScorerService struct {
// contains filtered or unexported fields
}
MockScorerService provides a mock scorer service for testing
func NewMockScorerService ¶
func NewMockScorerService() *MockScorerService
NewMockScorerService creates a new mock scorer service
func (*MockScorerService) ComputeScore ¶
func (m *MockScorerService) ComputeScore(ctx context.Context, did, context string) (*types.ScoreRecord, error)
func (*MockScorerService) GenerateThresholdProof ¶
func (m *MockScorerService) GenerateThresholdProof(ctx context.Context, did, context string, threshold float64, nonce string) (*types.ThresholdProof, error)
func (*MockScorerService) GetScore ¶
func (m *MockScorerService) GetScore(ctx context.Context, did, context string) (*types.ScoreRecord, error)
func (*MockScorerService) SetScore ¶
func (m *MockScorerService) SetScore(did, context string, score float64)
SetScore allows tests to set specific scores
func (*MockScorerService) UpdateScores ¶
func (*MockScorerService) VerifyThresholdProof ¶
func (m *MockScorerService) VerifyThresholdProof(ctx context.Context, proof *types.ThresholdProof) (bool, error)
type MockStorageService ¶
type MockStorageService struct {
// contains filtered or unexported fields
}
MockStorageService provides an in-memory storage implementation for testing
func NewMockStorageService ¶
func NewMockStorageService() *MockStorageService
NewMockStorageService creates a new mock storage service
type TestEventValidator ¶
type TestEventValidator struct {
// contains filtered or unexported fields
}
TestEventValidator provides validation utilities for tests
func NewTestEventValidator ¶
func NewTestEventValidator() *TestEventValidator
NewTestEventValidator creates a new test event validator
func (*TestEventValidator) ValidateEventSignature ¶
func (v *TestEventValidator) ValidateEventSignature(event *events.Event) (bool, error)
ValidateEventSignature validates an event signature against its DID
type TestKeyPair ¶
type TestKeyPair struct {
KeyPair *crypto.Ed25519KeyPair
DID *didvc.DID
Signer *crypto.Ed25519Signer
}
TestKeyPair represents a test key pair with DID
func CreateTestNetwork ¶
func CreateTestNetwork(size int) ([]*TestKeyPair, error)
CreateTestNetwork creates a set of interconnected test key pairs
func NewTestKeyPair ¶
func NewTestKeyPair() (*TestKeyPair, error)
NewTestKeyPair creates a new test key pair with associated DID
func NewTestKeyPairFromSeed ¶
func NewTestKeyPairFromSeed(seed []byte) (*TestKeyPair, error)
NewTestKeyPairFromSeed creates a test key pair from a deterministic seed