Documentation
¶
Index ¶
- type DynamoDBClientAPI
- type DynamoDBEnvelopedeprecated
- type DynamoDBMetastoredeprecated
- type DynamoDBMetastoreOptiondeprecated
- type LoaderFunc
- type MemoryMetastore
- func (s *MemoryMetastore) Load(_ context.Context, keyID string, created int64) (*appencryption.EnvelopeKeyRecord, error)
- func (s *MemoryMetastore) LoadLatest(_ context.Context, keyID string) (*appencryption.EnvelopeKeyRecord, error)
- func (s *MemoryMetastore) Store(_ context.Context, keyID string, created int64, ...) (bool, error)
- type SQLMetastore
- func (s *SQLMetastore) Load(ctx context.Context, keyID string, created int64) (*appencryption.EnvelopeKeyRecord, error)
- func (s *SQLMetastore) LoadLatest(ctx context.Context, keyID string) (*appencryption.EnvelopeKeyRecord, error)
- func (s *SQLMetastore) Store(ctx context.Context, keyID string, created int64, ...) (bool, error)
- type SQLMetastoreDBType
- type SQLMetastoreOption
- type StorerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DynamoDBClientAPI ¶ added in v0.5.0
type DynamoDBClientAPI = awsV1Persistence.DynamoDBClientAPI
type DynamoDBEnvelope
deprecated
added in
v0.1.3
type DynamoDBEnvelope = awsV1Persistence.DynamoDBEnvelope
DynamoDBEnvelope is used to convert the EncryptedKey to a Base64 encoded string to save in DynamoDB.
Deprecated: AWS SDK v1 reached end-of-life July 31, 2025. Use github.com/godladdy/asherah/go/appencryption/plugins/aws-v2/dynamodb/metastore instead.
type DynamoDBMetastore
deprecated
type DynamoDBMetastore = awsV1Persistence.DynamoDBMetastore
DynamoDBMetastore implements the Metastore interface.
Deprecated: AWS SDK v1 reached end-of-life July 31, 2025. Use github.com/godladdy/asherah/go/appencryption/plugins/aws-v2/dynamodb/metastore instead.
func NewDynamoDBMetastore
deprecated
func NewDynamoDBMetastore(sess awsV1Persistence.ConfigProvider, opts ...DynamoDBMetastoreOption) *DynamoDBMetastore
NewDynamoDBMetastore returns a new DynamoDBMetastore.
Deprecated: AWS SDK v1 reached end-of-life July 31, 2025. Use github.com/godladdy/asherah/go/appencryption/plugins/aws-v2/dynamodb/metastore instead.
type DynamoDBMetastoreOption
deprecated
added in
v0.1.1
type DynamoDBMetastoreOption = awsV1Persistence.DynamoDBMetastoreOption
DynamoDBMetastoreOption is used to configure additional options in a DynamoDBMetastore.
Deprecated: AWS SDK v1 reached end-of-life July 31, 2025. Use github.com/godladdy/asherah/go/appencryption/plugins/aws-v2/dynamodb/metastore instead.
func WithClient
deprecated
added in
v0.5.0
func WithClient(c DynamoDBClientAPI) DynamoDBMetastoreOption
WithClient configures the DynamoDBMetastore to use the specified DynamoDB client.
Deprecated: AWS SDK v1 reached end-of-life July 31, 2025. Use github.com/godladdy/asherah/go/appencryption/plugins/aws-v2/dynamodb/metastore instead.
func WithDynamoDBRegionSuffix
deprecated
added in
v0.1.1
func WithDynamoDBRegionSuffix(enabled bool) DynamoDBMetastoreOption
WithDynamoDBRegionSuffix configures the DynamoDBMetastore to use a regional suffix for all writes. This feature should be enabled when using DynamoDB global tables to avoid write conflicts arising from the "last writer wins" method of conflict resolution.
Deprecated: AWS SDK v1 reached end-of-life July 31, 2025. Use github.com/godladdy/asherah/go/appencryption/plugins/aws-v2/dynamodb/metastore instead.
func WithTableName
deprecated
added in
v0.1.2
func WithTableName(table string) DynamoDBMetastoreOption
WithTableName configures the DynamoDBMetastore to use the specified table name.
Deprecated: AWS SDK v1 reached end-of-life July 31, 2025. Use github.com/godladdy/asherah/go/appencryption/plugins/aws-v2/dynamodb/metastore instead.
type LoaderFunc ¶ added in v0.1.6
type LoaderFunc func(ctx context.Context, key interface{}) (*appencryption.DataRowRecord, error)
LoaderFunc is an adapter to allow the use of ordinary functions as Loaders. If f is a function with the appropriate signature, LoaderFunc(f) is an appencryption.Loader that calls f.
func (LoaderFunc) Load ¶ added in v0.1.6
func (f LoaderFunc) Load(ctx context.Context, key interface{}) (*appencryption.DataRowRecord, error)
Load calls f(ctx, key).
type MemoryMetastore ¶
type MemoryMetastore struct {
sync.RWMutex
Envelopes map[string]map[int64]*appencryption.EnvelopeKeyRecord
}
MemoryMetastore is an in-memory implementation of a Metastore. NOTE: It should not be used in production and is for testing only!
func NewMemoryMetastore ¶
func NewMemoryMetastore() *MemoryMetastore
NewMemoryMetastore returns a new in-memory metastore.
func (*MemoryMetastore) Load ¶
func (s *MemoryMetastore) Load(_ context.Context, keyID string, created int64) (*appencryption.EnvelopeKeyRecord, error)
Load retrieves a specific key by id and created timestamp. The return value will be nil if not already present.
func (*MemoryMetastore) LoadLatest ¶
func (s *MemoryMetastore) LoadLatest(_ context.Context, keyID string) (*appencryption.EnvelopeKeyRecord, error)
LoadLatest returns the latest key matching the provided ID. The return value will be nil if not already present.
func (*MemoryMetastore) Store ¶
func (s *MemoryMetastore) Store(_ context.Context, keyID string, created int64, envelope *appencryption.EnvelopeKeyRecord) (bool, error)
Store attempts to insert the key into the metastore if one is not already present. If a key exists, the method will return false. If one is not present, the value will be inserted and we return true.
type SQLMetastore ¶
type SQLMetastore struct {
// contains filtered or unexported fields
}
SQLMetastore implements the Metastore interface for a RDBMS metastore.
See https://github.com/godaddy/asherah/blob/master/docs/Metastore.md#rdbms for the required table structure and other relevant information.
func NewSQLMetastore ¶
func NewSQLMetastore(dbHandle *sql.DB, opts ...SQLMetastoreOption) *SQLMetastore
NewSQLMetastore returns a new SQLMetastore with the provided policy and sql connection.
func (*SQLMetastore) Load ¶
func (s *SQLMetastore) Load(ctx context.Context, keyID string, created int64) (*appencryption.EnvelopeKeyRecord, error)
Load returns the key matching the id and created timestamp provided. The envelope will be nil if it does not exist in the metastore.
func (*SQLMetastore) LoadLatest ¶
func (s *SQLMetastore) LoadLatest(ctx context.Context, keyID string) (*appencryption.EnvelopeKeyRecord, error)
LoadLatest returns the newest record matching the ID.
func (*SQLMetastore) Store ¶
func (s *SQLMetastore) Store(ctx context.Context, keyID string, created int64, envelope *appencryption.EnvelopeKeyRecord) (bool, error)
Store attempts to insert the key into the metastore if one is not already present. If a key exists, the method will return false. If one is not present, the value will be inserted and we return true. Note that as of this writing, the Go sql package doesn't expose a way to detect duplicate keys, so they are treated similarly to all errors that may happen in the insert.
type SQLMetastoreDBType ¶ added in v0.3.0
type SQLMetastoreDBType string
SQLMetastoreDBType identifies a specific database/sql driver.
const ( Postgres SQLMetastoreDBType = "postgres" Oracle SQLMetastoreDBType = "oracle" MySQL SQLMetastoreDBType = "mysql" DefaultDBType = MySQL )
type SQLMetastoreOption ¶ added in v0.3.0
type SQLMetastoreOption func(*SQLMetastore)
SQLMetastoreOption is used to configure additional options in a SQLMetastore.
func WithSQLMetastoreDBType ¶ added in v0.3.0
func WithSQLMetastoreDBType(t SQLMetastoreDBType) SQLMetastoreOption
WithSQLMetastoreDBType configures the SQLMetastore for use with the specified family of database/sql drivers such as Postgres, Oracle, or MySQL (default).
type StorerFunc ¶ added in v0.1.6
type StorerFunc func(ctx context.Context, d appencryption.DataRowRecord) (interface{}, error)
StorerFunc is an adapter to allow the use of ordinary functions as Storers. If f is a function with the appropriate signature, StorerFunc(f) is an appencryption.Storer that calls f.
func (StorerFunc) Store ¶ added in v0.1.6
func (f StorerFunc) Store(ctx context.Context, d appencryption.DataRowRecord) (interface{}, error)
Store calls f(ctx, key, d).