cloudkms

package
v0.0.0-...-ce7e112 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 2 more Imports: 8 Imported by: 0

Documentation

Overview

Package cloudkms contains utilities for communicating with CloudKMS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnwrapShare

func UnwrapShare(ctx context.Context, client Client, opts UnwrapOpts) ([]byte, error)

UnwrapShare uses a KMS client to unwrap the given share using Cloud KMS.

func WrapShare

func WrapShare(ctx context.Context, client Client, opts WrapOpts) ([]byte, error)

WrapShare uses a KMS client to wrap the given share using Cloud KMS.

Types

type Client

type Client interface {
	GetCryptoKey(context.Context, *spb.GetCryptoKeyRequest, ...gax.CallOption) (*rpb.CryptoKey, error)
	Encrypt(context.Context, *spb.EncryptRequest, ...gax.CallOption) (*spb.EncryptResponse, error)
	Decrypt(context.Context, *spb.DecryptRequest, ...gax.CallOption) (*spb.DecryptResponse, error)
	Close() error
}

Client defines an interface compatible with Cloud KMS client.

type ClientFactory

type ClientFactory struct {
	CredsMap    map[string]Client
	StetVersion string
	// contains filtered or unexported fields
}

ClientFactory manages singleton instances of KMS Clients mapped to JSON credentials.

func NewClientFactory

func NewClientFactory(version string) *ClientFactory

NewClientFactory initializes a ClientMap with the provided version.

func (*ClientFactory) Client

func (m *ClientFactory) Client(ctx context.Context, credentials string) (Client, error)

Client returns a KMS Client initialized with the provided credentials. If a client with these credentials already exists, it returns that.

func (*ClientFactory) Close

func (m *ClientFactory) Close() error

Close iterates through all the clients in the map and closes them.

type UnwrapOpts

type UnwrapOpts struct {
	Share   []byte
	KeyName string
}

UnwrapOpts does xyz.

type WrapOpts

type WrapOpts struct {
	Share   []byte
	KeyName string
	RPCOpts []gax.CallOption
}

WrapOpts does xyz.

Jump to

Keyboard shortcuts

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