Documentation
¶
Index ¶
- Variables
- type ECDSAPreset
- type ECDSASigner
- type ECDSAVerifier
- type ED25519Signer
- type ED25519Verifier
- type HMACPreset
- type HMACSigner
- type HMACVerifier
- type RSAPSSPreset
- type RSAPSSSigner
- type RSAPSSVerifier
- type RSAPreset
- type RSASigner
- type RSAVerifier
- type SourceHMACSigner
- type SourceHMACVerifier
- type SourcedECDSASigner
- type SourcedECDSAVerifier
- type SourcedED25519Signer
- type SourcedED25519Verifier
- type SourcedRSAPSSSigner
- type SourcedRSAPSSVerifier
- type SourcedRSASigner
- type SourcedRSAVerifier
Constants ¶
This section is empty.
Variables ¶
var ( ES256 = ECDSAPreset{ Hash: crypto.SHA256, Alg: jwa.ES256, Crv: elliptic.P256(), } ES384 = ECDSAPreset{ Hash: crypto.SHA384, Alg: jwa.ES384, Crv: elliptic.P384(), } ES512 = ECDSAPreset{ Hash: crypto.SHA512, Alg: jwa.ES512, Crv: elliptic.P521(), } )
var ( HS256 = HMACPreset{ Hash: crypto.SHA256, Alg: jwa.HS256, } HS384 = HMACPreset{ Hash: crypto.SHA384, Alg: jwa.HS384, } HS512 = HMACPreset{ Hash: crypto.SHA512, Alg: jwa.HS512, } )
var ( RS256 = RSAPreset{ Hash: crypto.SHA256, Alg: jwa.RS256, } RS384 = RSAPreset{ Hash: crypto.SHA384, Alg: jwa.RS384, } RS512 = RSAPreset{ Hash: crypto.SHA512, Alg: jwa.RS512, } )
var ( PS256 = RSAPSSPreset{ Hash: crypto.SHA256, Alg: jwa.PS256, } PS384 = RSAPSSPreset{ Hash: crypto.SHA384, Alg: jwa.PS384, } PS512 = RSAPSSPreset{ Hash: crypto.SHA512, Alg: jwa.PS512, } )
var ErrInvalidSignature = errors.New("invalid signature")
Functions ¶
This section is empty.
Types ¶
type ECDSASigner ¶
type ECDSASigner struct {
// contains filtered or unexported fields
}
func NewECDSASigner ¶
func NewECDSASigner(secretKey *ecdsa.PrivateKey, preset ECDSAPreset) *ECDSASigner
NewECDSASigner creates a new jwt.ProducerPlugin for a signed token using ECDSA.
Use any of the ECDSAPreset constants to configure the signing parameters.
- ES256: ECDSA using P-256 and SHA-256
- ES384: ECDSA using P-384 and SHA-384
- ES512: ECDSA using P-521 and SHA-512
type ECDSAVerifier ¶
type ECDSAVerifier struct {
// contains filtered or unexported fields
}
func NewECDSAVerifier ¶
func NewECDSAVerifier(publicKey *ecdsa.PublicKey, preset ECDSAPreset) *ECDSAVerifier
NewECDSAVerifier creates a new jwt.RecipientPlugin for a signed token using ECDSA.
Use any of the ECDSAPreset constants to configure the verification parameters.
- ES256: ECDSA using P-256 and SHA-256
- ES384: ECDSA using P-384 and SHA-384
- ES512: ECDSA using P-521 and SHA-512
type ED25519Signer ¶
type ED25519Signer struct {
// contains filtered or unexported fields
}
func NewED25519Signer ¶
func NewED25519Signer(secretKey ed25519.PrivateKey) *ED25519Signer
NewED25519Signer creates a new jwt.ProducerPlugin for a signed token using Edwards-Curve Digital Signature Algorithm.
type ED25519Verifier ¶
type ED25519Verifier struct {
// contains filtered or unexported fields
}
func NewED25519Verifier ¶
func NewED25519Verifier(publicKey ed25519.PublicKey) *ED25519Verifier
NewED25519Verifier creates a new jwt.RecipientPlugin for a signed token using Edwards-Curve Digital Signature Algorithm.
type HMACSigner ¶
type HMACSigner struct {
// contains filtered or unexported fields
}
func NewHMACSigner ¶
func NewHMACSigner(secretKey []byte, preset HMACPreset) *HMACSigner
NewHMACSigner creates a new jwt.ProducerPlugin for a signed token using HMAC with SHA-2.
Use any of the HMACPreset constants to configure the signing parameters.
- HS256: HMAC using SHA-256
- HS384: HMAC using SHA-384
- HS512: HMAC using SHA-512
type HMACVerifier ¶
type HMACVerifier struct {
// contains filtered or unexported fields
}
func NewHMACVerifier ¶
func NewHMACVerifier(secretKey []byte, preset HMACPreset) *HMACVerifier
NewHMACVerifier creates a new jwt.RecipientPlugin for a signed token using HMAC with SHA-2.
Use any of the HMACPreset constants to configure the signing parameters.
- HS256: HMAC using SHA-256
- HS384: HMAC using SHA-384
- HS512: HMAC using SHA-512
type RSAPSSSigner ¶
type RSAPSSSigner struct {
// contains filtered or unexported fields
}
func NewRSAPSSSigner ¶
func NewRSAPSSSigner(secretKey *rsa.PrivateKey, preset RSAPSSPreset) *RSAPSSSigner
NewRSAPSSSigner creates a new jwt.ProducerPlugin for a signed token using RSASSA-PSS.
A key of size 2048 bits or larger MUST be used with this algorithm.
Use any of the RSAPSSPreset constants to configure the signing parameters.
- PS256: RSASSA-PSS using SHA-384 and MGF1 with SHA-256
- PS384: RSASSA-PSS using SHA-384 and MGF1 with SHA-384
- PS512: RSASSA-PSS using SHA-512 and MGF1 with SHA-512
type RSAPSSVerifier ¶
type RSAPSSVerifier struct {
// contains filtered or unexported fields
}
func NewRSAPSSVerifier ¶
func NewRSAPSSVerifier(publicKey *rsa.PublicKey, preset RSAPSSPreset) *RSAPSSVerifier
NewRSAPSSVerifier creates a new jwt.RecipientPlugin for a signed token using RSASSA-PSS.
A key of size 2048 bits or larger MUST be used with this algorithm.
Use any of the RSAPSSPreset constants to configure the signing parameters.
- PS256: RSASSA-PSS using SHA-384 and MGF1 with SHA-256
- PS384: RSASSA-PSS using SHA-384 and MGF1 with SHA-384
- PS512: RSASSA-PSS using SHA-512 and MGF1 with SHA-512
type RSASigner ¶
type RSASigner struct {
// contains filtered or unexported fields
}
func NewRSASigner ¶
func NewRSASigner(secretKey *rsa.PrivateKey, preset RSAPreset) *RSASigner
NewRSASigner creates a new jwt.ProducerPlugin for a signed token using RSASSA-PKCS1-v1_5. A key of size 2048 bits or larger MUST be used with these algorithms.
Use any of the RSAPreset constants to configure the signing parameters.
- RS256: RSASSA-PKCS1-v1_5 using SHA-256
- RS384: RSASSA-PKCS1-v1_5 using SHA-384
- RS512: RSASSA-PKCS1-v1_5 using SHA-512
type RSAVerifier ¶
type RSAVerifier struct {
// contains filtered or unexported fields
}
func NewRSAVerifier ¶
func NewRSAVerifier(publicKey *rsa.PublicKey, preset RSAPreset) *RSAVerifier
NewRSAVerifier creates a new jwt.RecipientPlugin for a signed token using RSASSA-PKCS1-v1_5. A key of size 2048 bits or larger MUST be used with these algorithms.
Use any of the RSAPreset constants to configure the signing parameters.
- RS256: RSASSA-PKCS1-v1_5 using SHA-256
- RS384: RSASSA-PKCS1-v1_5 using SHA-384
- RS512: RSASSA-PKCS1-v1_5 using SHA-512
type SourceHMACSigner ¶
type SourceHMACSigner struct {
// contains filtered or unexported fields
}
func NewSourcedHMACSigner ¶
func NewSourcedHMACSigner(source *jwk.Source[[]byte], preset HMACPreset) *SourceHMACSigner
NewSourceHMACSigner creates a new jwt.ProducerPlugin for a signed token using HMAC with SHA-2.
Use any of the HMACPreset constants to configure the signing parameters.
- HS256: HMAC using SHA-256
- HS384: HMAC using SHA-384
- HS512: HMAC using SHA-512
type SourceHMACVerifier ¶
type SourceHMACVerifier struct {
// contains filtered or unexported fields
}
func NewSourcedHMACVerifier ¶
func NewSourcedHMACVerifier(source *jwk.Source[[]byte], preset HMACPreset) *SourceHMACVerifier
NewSourceHMACVerifier creates a new jwt.RecipientPlugin for a signed token using HMAC with SHA-2.
Use any of the HMACPreset constants to configure the signing parameters.
- HS256: HMAC using SHA-256
- HS384: HMAC using SHA-384
- HS512: HMAC using SHA-512
type SourcedECDSASigner ¶
type SourcedECDSASigner struct {
// contains filtered or unexported fields
}
func NewSourcedECDSASigner ¶
func NewSourcedECDSASigner(source *jwk.Source[*ecdsa.PrivateKey], preset ECDSAPreset) *SourcedECDSASigner
NewSourcedECDSASigner creates a new jwt.ProducerPlugin for a signed token using ECDSA.
Use any of the ECDSAPreset constants to configure the signing parameters.
- ES256: ECDSA using P-256 and SHA-256
- ES384: ECDSA using P-384 and SHA-384
- ES512: ECDSA using P-521 and SHA-512
type SourcedECDSAVerifier ¶
type SourcedECDSAVerifier struct {
// contains filtered or unexported fields
}
func NewSourcedECDSAVerifier ¶
func NewSourcedECDSAVerifier(source *jwk.Source[*ecdsa.PublicKey], preset ECDSAPreset) *SourcedECDSAVerifier
NewSourcedECDSAVerifier creates a new jwt.RecipientPlugin for a signed token using ECDSA.
Use any of the ECDSAPreset constants to configure the verification parameters.
- ES256: ECDSA using P-256 and SHA-256
- ES384: ECDSA using P-384 and SHA-384
- ES512: ECDSA using P-521 and SHA-512
type SourcedED25519Signer ¶
type SourcedED25519Signer struct {
// contains filtered or unexported fields
}
func NewSourcedED25519Signer ¶
func NewSourcedED25519Signer(source *jwk.Source[ed25519.PrivateKey]) *SourcedED25519Signer
NewSourcedED25519Signer creates a new jwt.ProducerPlugin for a signed token using Edwards-Curve Digital Signature Algorithm.
type SourcedED25519Verifier ¶
type SourcedED25519Verifier struct {
// contains filtered or unexported fields
}
func NewSourcedED25519Verifier ¶
func NewSourcedED25519Verifier(source *jwk.Source[ed25519.PublicKey]) *SourcedED25519Verifier
NewSourcedED25519Verifier creates a new jwt.RecipientPlugin for a signed token using Edwards-Curve Digital Signature Algorithm.
type SourcedRSAPSSSigner ¶
type SourcedRSAPSSSigner struct {
// contains filtered or unexported fields
}
func NewSourcedRSAPSSSigner ¶
func NewSourcedRSAPSSSigner(source *jwk.Source[*rsa.PrivateKey], preset RSAPSSPreset) *SourcedRSAPSSSigner
NewSourcedRSAPSSSigner creates a new jwt.ProducerPlugin for a signed token using RSASSA-PSS.
A key of size 2048 bits or larger MUST be used with this algorithm.
Use any of the RSAPSSPreset constants to configure the signing parameters.
- PS256: RSASSA-PSS using SHA-384 and MGF1 with SHA-256
- PS384: RSASSA-PSS using SHA-384 and MGF1 with SHA-384
- PS512: RSASSA-PSS using SHA-512 and MGF1 with SHA-512
type SourcedRSAPSSVerifier ¶
type SourcedRSAPSSVerifier struct {
// contains filtered or unexported fields
}
func NewSourcedRSAPSSVerifier ¶
func NewSourcedRSAPSSVerifier(source *jwk.Source[*rsa.PublicKey], preset RSAPSSPreset) *SourcedRSAPSSVerifier
NewSourcedRSAPSSVerifier creates a new jwt.RecipientPlugin for a signed token using RSASSA-PSS.
A key of size 2048 bits or larger MUST be used with this algorithm.
Use any of the RSAPSSPreset constants to configure the signing parameters.
- PS256: RSASSA-PSS using SHA-384 and MGF1 with SHA-256
- PS384: RSASSA-PSS using SHA-384 and MGF1 with SHA-384
- PS512: RSASSA-PSS using SHA-512 and MGF1 with SHA-512
type SourcedRSASigner ¶
type SourcedRSASigner struct {
// contains filtered or unexported fields
}
func NewSourcedRSASigner ¶
func NewSourcedRSASigner(source *jwk.Source[*rsa.PrivateKey], preset RSAPreset) *SourcedRSASigner
NewSourcedRSASigner creates a new jwt.ProducerPlugin for a signed token using RSASSA-PKCS1-v1_5. A key of size 2048 bits or larger MUST be used with these algorithms.
Use any of the RSAPreset constants to configure the signing parameters.
- RS256: RSASSA-PKCS1-v1_5 using SHA-256
- RS384: RSASSA-PKCS1-v1_5 using SHA-384
- RS512: RSASSA-PKCS1-v1_5 using SHA-512
type SourcedRSAVerifier ¶
type SourcedRSAVerifier struct {
// contains filtered or unexported fields
}
func NewSourcedRSAVerifier ¶
func NewSourcedRSAVerifier(source *jwk.Source[*rsa.PublicKey], preset RSAPreset) *SourcedRSAVerifier
NewSourcedRSAVerifier creates a new jwt.RecipientPlugin for a signed token using RSASSA-PKCS1-v1_5. A key of size 2048 bits or larger MUST be used with these algorithms.
Use any of the RSAPreset constants to configure the signing parameters.
- RS256: RSASSA-PKCS1-v1_5 using SHA-256
- RS384: RSASSA-PKCS1-v1_5 using SHA-384
- RS512: RSASSA-PKCS1-v1_5 using SHA-512