signer

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParsePrivateKey

func ParsePrivateKey(filename string) (crypto.PrivateKey, error)

ParsePrivateKey pase PEM private key file, and returns a crypto.PrivateKey interface.

Types

type ECJWTSigner

type ECJWTSigner struct {
	PrivateKey *ecdsa.PrivateKey
	PublicKey  *ecdsa.PublicKey
	Kid        string
	// contains filtered or unexported fields
}

func NewECJWTSigner

func NewECJWTSigner(k *ecdsa.PrivateKey, alg, mockKid string) (*ECJWTSigner, error)

func (*ECJWTSigner) DecryptJWT added in v0.18.0

func (k *ECJWTSigner) DecryptJWT(encryptedJwt, alg string) (string, error)

func (*ECJWTSigner) JWKS

func (k *ECJWTSigner) JWKS() ([]byte, error)

JWKS is the JSON JWKS representation of the rsa.PublicKey

func (*ECJWTSigner) SignJWT

func (k *ECJWTSigner) SignJWT(claims jwt.Claims) (string, error)

SignJWT signs jwt.Claims with the Keypair and returns a token string

type JwtSigner

type JwtSigner interface {
	JWKS() ([]byte, error)                               // marshal of JWKS
	SignJWT(claims jwt.Claims) (string, error)           // signs jwt claims
	DecryptJWT(encryptedJwt, alg string) (string, error) // decrypt jwt
}

JwtSigner interface for signing jwt and generating jwks

func NewJwtSigner

func NewJwtSigner(key crypto.PrivateKey, alg, mockKid string) (JwtSigner, error)

NewJwtSigner create a JwtSigned for the correspond key type

supported key tupes are rsa.PrivateKey and ecdsa.PrivateKey

type RSAJWTSigner

type RSAJWTSigner struct {
	PrivateKey *rsa.PrivateKey
	PublicKey  *rsa.PublicKey
	Kid        string
	// contains filtered or unexported fields
}

func NewRSAJWTSigner

func NewRSAJWTSigner(k *rsa.PrivateKey, alg, mockKid string) (*RSAJWTSigner, error)

func (*RSAJWTSigner) DecryptJWT added in v0.18.0

func (k *RSAJWTSigner) DecryptJWT(encryptedJwt, alg string) (string, error)

DecryptJWT decrypt jwt

func (*RSAJWTSigner) JWKS

func (k *RSAJWTSigner) JWKS() ([]byte, error)

JWKS is the JSON JWKS representation of the rsa.PublicKey

func (*RSAJWTSigner) SignJWT

func (k *RSAJWTSigner) SignJWT(claims jwt.Claims) (string, error)

SignJWT signs jwt.Claims with the Keypair and returns a token string

Jump to

Keyboard shortcuts

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