Files
self/sdk/sdk-go/config.go
Vishalkulkarni45 f163367022 SDK Go version (#920)
* feat: helper functions and constant for go-sdk

* feat: formatRevealedDataPacked in go

* chore: refactor

* feat: define struct for selfBackendVerifier

* feat: verify function for selfBackendVerifier

* feat(wip): custom hasher

* feat: SelfVerifierBacked in go

* test(wip): scope and userContextHash is failing

* test: zk proof verified

* fix: MockConfigStore getactionId function

* chore: refactor

* chore: remove abi duplicate files

* chore: move configStore to utils

* chore: modified VcAndDiscloseProof struct

* chore: more review changes

* feat: impl DefaultConfig and InMemoryConfigStore

* chore: refactor and export functions

* fix: module import and README

* chore: remove example folder

* chore: remove pointers from VerificationConfig

* chore: coderabbit review fixes

* chore: more coderabbit review fix

* chore: add license

* fix: convert attestationIdd to int

* chore: remove duplicate code

---------

Co-authored-by: ayman <aymanshaik1015@gmail.com>
2025-08-20 14:51:48 +05:30

44 lines
1.5 KiB
Go

package self
import (
"context"
)
// ConfigStore interface defines methods for storing and retrieving verification configurations
type ConfigStore interface {
// GetConfig retrieves a verification configuration by ID
GetConfig(ctx context.Context, id string) (VerificationConfig, error)
// SetConfig stores a verification configuration with the given ID
SetConfig(ctx context.Context, id string, config VerificationConfig) (bool, error)
// GetActionId retrieves the action ID for a given user identifier and user-defined data
GetActionId(ctx context.Context, userIdentifier string, actionId string) (string, error)
}
// DefaultConfigStore provides a simple in-memory implementation of ConfigStore
type DefaultConfigStore struct {
config VerificationConfig
}
// NewDefaultConfigStore creates a new DefaultConfigStore with the given configuration
func NewDefaultConfigStore(config VerificationConfig) *DefaultConfigStore {
return &DefaultConfigStore{
config: config,
}
}
// GetConfig returns the stored configuration
func (store *DefaultConfigStore) GetConfig(ctx context.Context, id string) (VerificationConfig, error) {
return store.config, nil
}
// SetConfig updates the stored configuration
func (store *DefaultConfigStore) SetConfig(ctx context.Context, id string, config VerificationConfig) (bool, error) {
store.config = config
return true, nil
}
// GetActionId returns a default action ID
func (store *DefaultConfigStore) GetActionId(ctx context.Context, userIdentifier string, userDefinedData string) (string, error) {
return "random-id", nil
}