Versions in this module Expand all Collapse all v1 v1.0.0 Feb 5, 2025 Changes in this version + var A128CBC = AESPreset + var A128GCM = AESPreset + var A128GCMKW = AESPreset + var A128KW = AESPreset + var A192CBC = AESPreset + var A192GCM = AESPreset + var A192GCMKW = AESPreset + var A192KW = AESPreset + var A256CBC = AESPreset + var A256GCM = AESPreset + var A256GCMKW = AESPreset + var A256KW = AESPreset + var ES256 = ECDSAPreset + var ES384 = ECDSAPreset + var ES512 = ECDSAPreset + var ErrJWKMismatch = errors.New("jwk and key mismatch") + var ErrKeyNotFound = errors.New("key not found") + var HS256 = HMACPreset + var HS384 = HMACPreset + var HS512 = HMACPreset + var PS256 = RSAPreset + var PS384 = RSAPreset + var PS512 = RSAPreset + var RS256 = RSAPreset + var RS384 = RSAPreset + var RS512 = RSAPreset + var RSAOAEP = RSAPreset + var RSAOAEP256 = RSAPreset + func ConsumeECDH(source *jwa.JWK) (*Key[*ecdh.PrivateKey], *Key[*ecdh.PublicKey], error) + func ConsumeECDSA(source *jwa.JWK, preset ECDSAPreset) (*Key[*ecdsa.PrivateKey], *Key[*ecdsa.PublicKey], error) + func ConsumeED25519(source *jwa.JWK) (*Key[ed25519.PrivateKey], *Key[ed25519.PublicKey], error) + func ConsumeRSA(source *jwa.JWK, preset RSAPreset) (*Key[*rsa.PrivateKey], *Key[*rsa.PublicKey], error) + func GenerateECDH() (*Key[*ecdh.PrivateKey], *Key[*ecdh.PublicKey], error) + func GenerateECDSA(preset ECDSAPreset) (*Key[*ecdsa.PrivateKey], *Key[*ecdsa.PublicKey], error) + func GenerateED25519() (*Key[ed25519.PrivateKey], *Key[ed25519.PublicKey], error) + func GenerateRSA(preset RSAPreset) (*Key[*rsa.PrivateKey], *Key[*rsa.PublicKey], error) + type AESPreset struct + Alg jwa.Alg + KeyOps []jwa.KeyOp + KeySize int + type ECDSAPreset struct + Alg jwa.Alg + Curve elliptic.Curve + type HMACPreset struct + Alg jwa.Alg + KeySize int + type Key struct + func ConsumeAES(source *jwa.JWK, preset AESPreset) (*Key[[]byte], error) + func ConsumeHMAC(source *jwa.JWK, preset HMACPreset) (*Key[[]byte], error) + func GenerateAES(preset AESPreset) (*Key[[]byte], error) + func GenerateHMAC(preset HMACPreset) (*Key[[]byte], error) + func NewKey[K any](jwk *jwa.JWK, parsed K) *Key[K] + func (key *Key[K]) Key() K + type KeyParser func(ctx context.Context, jwk *jwa.JWK) (*Key[K], error) + type KeysFetcher func(ctx context.Context) ([]*jwa.JWK, error) + type RSAPreset struct + Alg jwa.Alg + KeySize int + PrivateKeyOps []jwa.KeyOp + PublicKeyOps []jwa.KeyOp + Use jwa.Use + type Source struct + func NewAESSource(config SourceConfig, preset AESPreset) *Source[[]byte] + func NewECDHPrivateSource(config SourceConfig) *Source[*ecdh.PrivateKey] + func NewECDHPublicSource(config SourceConfig) *Source[*ecdh.PublicKey] + func NewECDSAPrivateSource(config SourceConfig, preset ECDSAPreset) *Source[*ecdsa.PrivateKey] + func NewECDSAPublicSource(config SourceConfig, preset ECDSAPreset) *Source[*ecdsa.PublicKey] + func NewED25519PrivateSource(config SourceConfig) *Source[ed25519.PrivateKey] + func NewED25519PublicSource(config SourceConfig) *Source[ed25519.PublicKey] + func NewGenericSource[K any](config SourceConfig, parser KeyParser[K]) *Source[K] + func NewHMACSource(config SourceConfig, preset HMACPreset) *Source[[]byte] + func NewRSAPrivateSource(config SourceConfig, preset RSAPreset) *Source[*rsa.PrivateKey] + func NewRSAPublicSource(config SourceConfig, preset RSAPreset) *Source[*rsa.PublicKey] + func (source *Source[K]) Get(ctx context.Context, kid string) (*Key[K], error) + func (source *Source[K]) List(ctx context.Context) ([]*Key[K], error) + type SourceConfig struct + CacheDuration time.Duration + Fetch KeysFetcher