storage

package
v2.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package storage implements storage backends for DEKs.

If an unset DEK is requested, the backend MUST return ErrDEKUnset.

Index

Constants

This section is empty.

Variables

View Source
var ErrDEKUnset = errors.New("requested DEK not set")

ErrDEKUnset indicates if a key is not found in storage.

Functions

This section is empty.

Types

type AWSS3Storage

type AWSS3Storage struct {
	// contains filtered or unexported fields
}

AWSS3Storage is an implementation of the Storage interface, storing keys in AWS S3 buckets.

func NewAWSS3Storage

func NewAWSS3Storage(ctx context.Context, bucketID string, optFns ...func(*s3.Options)) (*AWSS3Storage, error)

NewAWSS3Storage creates a Storage client for AWS S3: https://aws.amazon.com/s3/

You need to provide credentials to authenticate to AWS using the cfg parameter.

func (*AWSS3Storage) Get

func (s *AWSS3Storage) Get(ctx context.Context, keyID string) ([]byte, error)

Get returns a DEK from from AWS S3 Storage by key ID.

func (*AWSS3Storage) Put

func (s *AWSS3Storage) Put(ctx context.Context, keyID string, data []byte) error

Put saves a DEK to AWS S3 Storage by key ID.

type AzureOpts

type AzureOpts struct {
	// contains filtered or unexported fields
}

AzureOpts are additional options to be used when interacting with the Azure API.

type AzureStorage

type AzureStorage struct {
	// contains filtered or unexported fields
}

AzureStorage is an implementation of the Storage interface, storing keys in the Azure Blob Store.

func NewAzureStorage

func NewAzureStorage(ctx context.Context, connectionString, containerName string, opts *AzureOpts) (*AzureStorage, error)

NewAzureStorage initializes a storage client using Azure's Blob Storage: https://azure.microsoft.com/en-us/services/storage/blobs/

A connections string is required to connect to the Storage Account, see https://docs.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string If the container does not exists, a new one is created automatically. Connect options for the Client, Downloader and Uploader can be configured using opts.

func (*AzureStorage) Get

func (s *AzureStorage) Get(ctx context.Context, keyID string) ([]byte, error)

Get returns a DEK from from Azure Blob Storage by key ID.

func (*AzureStorage) Put

func (s *AzureStorage) Put(ctx context.Context, keyID string, encDEK []byte) error

Put saves a DEK to Azure Blob Storage by key ID.

type GoogleCloudStorage

type GoogleCloudStorage struct {
	// contains filtered or unexported fields
}

GoogleCloudStorage is an implementation of the Storage interface, storing keys in Google Cloud Storage buckets.

func NewGoogleCloudStorage

func NewGoogleCloudStorage(ctx context.Context, projectID, bucketName string, bucketOptions *storage.BucketAttrs, opts ...option.ClientOption) (*GoogleCloudStorage, error)

NewGoogleCloudStorage creates a Storage client for Google Cloud Storage: https://cloud.google.com/storage/docs/

The parameter bucketOptions is optional, if not present default options will be created.

func (*GoogleCloudStorage) Get

func (s *GoogleCloudStorage) Get(ctx context.Context, keyID string) ([]byte, error)

Get returns a DEK from Google Cloud Storage by key ID.

func (*GoogleCloudStorage) Put

func (s *GoogleCloudStorage) Put(ctx context.Context, keyID string, data []byte) error

Put saves a DEK to Google Cloud Storage by key ID.

type MemMapStorage

type MemMapStorage struct {
	// contains filtered or unexported fields
}

MemMapStorage is the standard implementation of the Storage interface, storing keys in memory only.

func NewMemMapStorage

func NewMemMapStorage() *MemMapStorage

NewMemMapStorage creates and initialises a new MemMapStorage object.

func (*MemMapStorage) Get

func (s *MemMapStorage) Get(ctx context.Context, keyID string) ([]byte, error)

Get returns a DEK from MemMapStorage by key ID.

func (*MemMapStorage) Put

func (s *MemMapStorage) Put(ctx context.Context, keyID string, encDEK []byte) error

Put saves a DEK to MemMapStorage by key ID.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL