Documentation
¶
Index ¶
- Constants
- type CertStorageCosmosDB
- type CosmosDB
- func (c *CosmosDB) ActivateSessionKey(userID []byte, active bool) error
- func (c *CosmosDB) AddAccount(userID []byte, accountAddress []byte, signature []byte, ...) error
- func (c *CosmosDB) AddSessionKey(userID []byte, key common.GWSessionKey) error
- func (c *CosmosDB) AddUser(userID []byte, privateKey []byte) error
- func (c *CosmosDB) DeleteUser(userID []byte) error
- func (c *CosmosDB) GetEncryptionKey() []byte
- func (c *CosmosDB) GetUser(userID []byte) (*common.GWUser, error)
- func (c *CosmosDB) RemoveSessionKey(userID []byte) error
- type EncryptedCertDocument
- type EncryptedDocument
- type MetricsDocument
- type MetricsStorage
- type MetricsStorageCosmosDB
Constants ¶
const ( DATABASE_NAME = "gatewayDB" USERS_CONTAINER_NAME = "users" )
Constants for the CosmosDB database and container names
const ( METRICS_CONTAINER_NAME = "metrics" METRICS_DOC_ID = "global_metrics" )
const (
CERT_CONTAINER_NAME = "certificates"
)
const MAX_RETRIES = 3
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CertStorageCosmosDB ¶ added in v1.0.0
type CertStorageCosmosDB struct {
// contains filtered or unexported fields
}
CertStorageCosmosDB implements autocert.Cache interface using CosmosDB
func NewCertStorageCosmosDB ¶ added in v1.0.0
func NewCertStorageCosmosDB(connectionString string, encryptionKey []byte, encryptionEnabled bool) (*CertStorageCosmosDB, error)
NewCertStorageCosmosDB creates a new CosmosDB-based certificate storage
func (*CertStorageCosmosDB) Delete ¶ added in v1.0.0
func (c *CertStorageCosmosDB) Delete(ctx context.Context, key string) error
Delete removes certificate data for the given key
type CosmosDB ¶
type CosmosDB struct {
// contains filtered or unexported fields
}
CosmosDB struct represents the CosmosDB storage implementation
func NewCosmosDB ¶
func (*CosmosDB) ActivateSessionKey ¶ added in v1.0.0
Sets the ActiveSK flag for the user, with retries on ETag mismatch
func (*CosmosDB) AddAccount ¶
func (c *CosmosDB) AddAccount(userID []byte, accountAddress []byte, signature []byte, signatureType viewingkey.SignatureType) error
Adds a new account for the user, with retries on ETag mismatch
func (*CosmosDB) AddSessionKey ¶ added in v1.0.0
func (c *CosmosDB) AddSessionKey(userID []byte, key common.GWSessionKey) error
Adds or updates a session key for the user, with retries on ETag mismatch
func (*CosmosDB) DeleteUser ¶
func (*CosmosDB) GetEncryptionKey ¶ added in v1.0.0
GetEncryptionKey returns the encryption key used by the CosmosDB instance
func (*CosmosDB) RemoveSessionKey ¶ added in v1.0.0
Removes the session key for the user, with retries on ETag mismatch
type EncryptedCertDocument ¶ added in v1.0.0
EncryptedCertDocument represents the structure of a certificate document in CosmosDB
type EncryptedDocument ¶
EncryptedDocument struct is used to store encrypted user data in CosmosDB We use this structure to add an extra layer of security by encrypting the actual user data The 'ID' field is used as the document ID and partition key in CosmosDB The 'Data' field contains the base64-encoded encrypted user data
type MetricsDocument ¶ added in v1.0.0
type MetricsDocument struct { ID string `json:"id"` TotalUsers uint64 `json:"totalUsers"` AccountsRegistered uint64 `json:"accountsRegistered"` ActiveUsers map[string]string `json:"activeUsers"` // double-hashed userID -> ISO timestamp ActiveUsersCount int `json:"activeUsersCount"` LastUpdated string `json:"lastUpdated"` }
type MetricsStorage ¶ added in v1.0.0
type MetricsStorage interface { LoadMetrics() (*MetricsDocument, error) SaveMetrics(*MetricsDocument) error }
MetricsStorage interface defines the metrics storage operations
func NewNoOpMetricsStorage ¶ added in v1.0.0
func NewNoOpMetricsStorage() MetricsStorage
type MetricsStorageCosmosDB ¶ added in v1.0.0
type MetricsStorageCosmosDB struct {
// contains filtered or unexported fields
}
MetricsStorageCosmosDB handles metrics persistence in CosmosDB
func NewMetricsStorage ¶ added in v1.0.0
func NewMetricsStorage(connectionString string) (*MetricsStorageCosmosDB, error)
func (*MetricsStorageCosmosDB) LoadMetrics ¶ added in v1.0.0
func (m *MetricsStorageCosmosDB) LoadMetrics() (*MetricsDocument, error)
func (*MetricsStorageCosmosDB) SaveMetrics ¶ added in v1.0.0
func (m *MetricsStorageCosmosDB) SaveMetrics(metrics *MetricsDocument) error