kms

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package kms implements crypto.KMSClient on top of the AWS KMS SDK.

It is separate from pkg/crypto so that the encryption primitives — AES-GCM, HKDF, Argon2, BIP39 — and the crypto.KMSClient interface they are described in carry no cloud SDK. Importing pkg/crypto costs nothing; importing this package pulls the AWS SDK, and only a caller that actually uses KMS envelope encryption pays for it (RFC 0022 §6).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	Encrypt(ctx context.Context, params *awskms.EncryptInput, optFns ...func(*awskms.Options)) (*awskms.EncryptOutput, error)
	Decrypt(ctx context.Context, params *awskms.DecryptInput, optFns ...func(*awskms.Options)) (*awskms.DecryptOutput, error)
}

API defines the subset of the AWS KMS SDK client required by Client.

type Client

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

Client wraps the AWS KMS SDK v2 client and implements crypto.KMSClient.

func New

func New(ctx context.Context, arn string, opts ...Option) (*Client, error)

New creates a KMS client for arn with the provided options.

func (*Client) Decrypt

func (d *Client) Decrypt(ctx context.Context, ciphertext []byte) ([]byte, error)

func (*Client) Encrypt

func (d *Client) Encrypt(ctx context.Context, plaintext []byte) ([]byte, error)

type Option

type Option func(*clientConfig)

Option configures a KMS client.

func WithConfig

func WithConfig(cfg aws.Config) Option

WithConfig sets the full AWS config for KMS.

func WithEndpoint

func WithEndpoint(url string) Option

WithEndpoint sets a custom base URL for KMS (e.g. for MinIO or localstack).

func WithRegion

func WithRegion(region string) Option

WithRegion sets the AWS region for KMS.

Jump to

Keyboard shortcuts

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