Documentation
¶
Index ¶
- type CredentialSubjectDoc
- type CredentialSubjectsColl
- type Service
- type TokenStatusListColl
- func (c *TokenStatusListColl) Add(ctx context.Context, section int64, status uint8) (int64, error)
- func (c *TokenStatusListColl) CountDocs(ctx context.Context, filter bson.M) (int64, error)
- func (c *TokenStatusListColl) CreateNewSection(ctx context.Context, section int64, sectionSize int64) error
- func (c *TokenStatusListColl) FindOne(ctx context.Context, section, index int64) (*TokenStatusListDoc, error)
- func (c *TokenStatusListColl) GetAllStatusesForSection(ctx context.Context, section int64) ([]uint8, error)
- func (c *TokenStatusListColl) InitializeIfEmpty(ctx context.Context) error
- func (c *TokenStatusListColl) UpdateStatus(ctx context.Context, section int64, index int64, status uint8) error
- type TokenStatusListDoc
- type TokenStatusListMetadataColl
- type TokenStatusListMetadataDoc
- type TokenStatusListMetadataStore
- type TokenStatusListStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CredentialSubjectDoc ¶
type CredentialSubjectDoc struct {
Identifier string `bson:"identifier"`
Section int64 `bson:"section"`
Index int64 `bson:"index"`
}
CredentialSubjectDoc represents a credential subject with their token status list reference
type CredentialSubjectsColl ¶
type CredentialSubjectsColl struct {
Service *Service
Coll *mongo.Collection
// contains filtered or unexported fields
}
CredentialSubjectsColl is the collection for credential subjects (person info linked to Token Status List entries)
func NewCredentialSubjectsColl ¶
func NewCredentialSubjectsColl(ctx context.Context, collName string, service *Service, log *logger.Log) (*CredentialSubjectsColl, error)
NewCredentialSubjectsColl creates a new credential subjects collection
func (*CredentialSubjectsColl) Add ¶
func (c *CredentialSubjectsColl) Add(ctx context.Context, doc *CredentialSubjectDoc) error
Add adds a new credential subject to the collection
func (*CredentialSubjectsColl) Search ¶
func (c *CredentialSubjectsColl) Search(ctx context.Context, identifier string) ([]*CredentialSubjectDoc, error)
Search searches for credential subjects by identifier
type Service ¶
type Service struct {
MongoClient *mongo.Client
// Token Status List collections (MongoDB)
TokenStatusListColl *TokenStatusListColl
TokenStatusListMetadata *TokenStatusListMetadataColl
CredentialSubjects *CredentialSubjectsColl
// contains filtered or unexported fields
}
Service is the database service
type TokenStatusListColl ¶
type TokenStatusListColl struct {
Service *Service
Coll *mongo.Collection
// contains filtered or unexported fields
}
TokenStatusListColl is the collection for status list
func NewTokenStatusListColl ¶
func NewTokenStatusListColl(ctx context.Context, collName string, service *Service, log *logger.Log) (*TokenStatusListColl, error)
NewTokenStatusListColl creates a new Token Status List coll
func (*TokenStatusListColl) Add ¶
Add adds a new status to the status list collection, return index of the added status or an error
func (*TokenStatusListColl) CreateNewSection ¶
func (c *TokenStatusListColl) CreateNewSection(ctx context.Context, section int64, sectionSize int64) error
CreateNewSection creates a new section with decoy entries.
func (*TokenStatusListColl) FindOne ¶
func (c *TokenStatusListColl) FindOne(ctx context.Context, section, index int64) (*TokenStatusListDoc, error)
FindOne finds a single status entry by section and index
func (*TokenStatusListColl) GetAllStatusesForSection ¶
func (c *TokenStatusListColl) GetAllStatusesForSection(ctx context.Context, section int64) ([]uint8, error)
GetAllStatusesForSection retrieves all status entries for a given section, ordered by index. Returns a slice of status values (uint8) suitable for encoding into a Status List Token.
func (*TokenStatusListColl) InitializeIfEmpty ¶
func (c *TokenStatusListColl) InitializeIfEmpty(ctx context.Context) error
InitializeIfEmpty checks if the collection is empty and initializes it with sample data
func (*TokenStatusListColl) UpdateStatus ¶
func (c *TokenStatusListColl) UpdateStatus(ctx context.Context, section int64, index int64, status uint8) error
UpdateStatus updates the status of an existing entry at the given section and index.
type TokenStatusListDoc ¶
type TokenStatusListDoc struct {
Index int64 `bson:"index"`
Status uint8 `bson:"status"`
Decoy bool `bson:"decoy"`
Section int64 `bson:"section"`
}
TokenStatusListDoc represents a document in the Token Status List document
type TokenStatusListMetadataColl ¶
type TokenStatusListMetadataColl struct {
Service *Service
Coll *mongo.Collection
// contains filtered or unexported fields
}
TokenStatusListMetadataColl is the collection for status list metadata
func NewTokenStatusListMetadataColl ¶
func NewTokenStatusListMetadataColl(ctx context.Context, collName string, service *Service, log *logger.Log) (*TokenStatusListMetadataColl, error)
NewTokenStatusListMetadataColl creates a new StatusListMetadataColl
func (*TokenStatusListMetadataColl) GetAllSections ¶
func (c *TokenStatusListMetadataColl) GetAllSections(ctx context.Context) ([]int64, error)
GetAllSections returns all section IDs that have been created. Used for Status List Aggregation (Section 9.3).
func (*TokenStatusListMetadataColl) GetCurrentSection ¶
func (c *TokenStatusListMetadataColl) GetCurrentSection(ctx context.Context) (int64, error)
GetCurrentSection returns the current section number
func (*TokenStatusListMetadataColl) UpdateCurrentSection ¶
func (c *TokenStatusListMetadataColl) UpdateCurrentSection(ctx context.Context, newSection int64) error
UpdateCurrentSection updates the current section and adds it to the sections list
type TokenStatusListMetadataDoc ¶
type TokenStatusListMetadataDoc struct {
CurrentSection int64 `bson:"current_section"`
Sections []int64 `bson:"sections"`
}
TokenStatusListMetadataDoc represents a document in the status list metadata collection
type TokenStatusListMetadataStore ¶
type TokenStatusListMetadataStore interface {
GetCurrentSection(ctx context.Context) (int64, error)
UpdateCurrentSection(ctx context.Context, newSection int64) error
GetAllSections(ctx context.Context) ([]int64, error)
}
TokenStatusListMetadataStore defines the interface for token status list metadata operations
type TokenStatusListStore ¶
type TokenStatusListStore interface {
CountDocs(ctx context.Context, filter bson.M) (int64, error)
CreateNewSection(ctx context.Context, section int64, sectionSize int64) error
Add(ctx context.Context, section int64, status uint8) (int64, error)
UpdateStatus(ctx context.Context, section int64, index int64, status uint8) error
GetAllStatusesForSection(ctx context.Context, section int64) ([]uint8, error)
InitializeIfEmpty(ctx context.Context) error
FindOne(ctx context.Context, section, index int64) (*TokenStatusListDoc, error)
}
TokenStatusListStore defines the interface for token status list operations