Documentation
¶
Overview ¶
Package jws signs and verifies the compact JSON Web Signatures that the Auth-All authorization server issues. It supports ES256 and RS256, and it reads the public JSON Web Key forms of both.
Index ¶
- Constants
- Variables
- func Decode(s string) ([]byte, error)
- func Encode(b []byte) string
- func PublicJWK(pub crypto.PublicKey, algorithm, id string) (map[string]any, error)
- func PublicKeyFromJWK(jwk map[string]any) (crypto.PublicKey, error)
- func Thumbprint(jwk map[string]any) (string, error)
- func Verify(token string, pub crypto.PublicKey) ([]byte, error)
- type Header
- type Key
Constants ¶
View Source
const ( ES256 = "ES256" RS256 = "RS256" )
Algorithms this package supports.
Variables ¶
View Source
var ErrInvalidSignature = errors.New("authall/jws: the signature is invalid")
ErrInvalidSignature reports a token that fails any verification step.
Functions ¶
func PublicKeyFromJWK ¶
PublicKeyFromJWK reads the public key of a JSON Web Key. It accepts the two key types this package signs with.
func Thumbprint ¶
Thumbprint returns the RFC 7638 SHA-256 thumbprint of a public JSON Web Key. DPoP uses it as the confirmation value of a bound token.
Types ¶
type Header ¶
type Header struct {
Algorithm string `json:"alg"`
KeyID string `json:"kid"`
Type string `json:"typ"`
// JWK carries the proof key of a DPoP proof.
JWK map[string]any `json:"jwk"`
}
Header holds the fields of a compact header that a verifier reads.
Click to show internal directories.
Click to hide internal directories.