kmsjwt

package module
v6.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: MIT Imports: 9 Imported by: 0

README

kmsjwt

Godoc CircleCI Go Report Card codecov

This little utility library provides an AWS KMS-based implementation of jwt.SigningMethod.

You will be using an instance of context.Context as the encryption key.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KMS

type KMS interface {
	GetPublicKey(context.Context, *kms.GetPublicKeyInput, ...func(*kms.Options)) (*kms.GetPublicKeyOutput, error)
	Sign(context.Context, *kms.SignInput, ...func(*kms.Options)) (*kms.SignOutput, error)
}

KMS implements a small subset of the KMS API.

type KMSJWT

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

KMSJWT is a JWT signing method implementation using RSA512 with the private key stored in AWS KMS. The public key is retrieved from KMS on initialization.

func New

func New(api KMS, keyID string) *KMSJWT

New provides a KMS-based implementation of JWT signing method.

func NewWithPublicKey

func NewWithPublicKey(api KMS, keyID string, publicKey *rsa.PublicKey) *KMSJWT

NewWithPublicKey provides a KMS-based implementation of JWT signing method with a pre-loaded public key.

func (*KMSJWT) Alg

func (k *KMSJWT) Alg() string

func (*KMSJWT) Sign

func (k *KMSJWT) Sign(signingString string, key interface{}) (string, error)

func (*KMSJWT) Verify

func (k *KMSJWT) Verify(signingString, stringSignature string, key interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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