Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidKey = errors.New("invalid JWK")
ErrInvalidKey is returned when passed JWK is invalid.
Functions ¶
func GetED25519PublicKey ¶
GetED25519PublicKey retunns ed25519 public key.
func IsCompactJWS ¶
IsCompactJWS checks weather input is a compact JWS (based on https://tools.ietf.org/html/rfc7516#section-9)
Types ¶
type JSONWebSignature ¶
type JSONWebSignature struct { ProtectedHeaders jws.Headers UnprotectedHeaders jws.Headers Payload []byte // contains filtered or unexported fields }
JSONWebSignature defines JSON Web Signature (https://tools.ietf.org/html/rfc7515)
func NewJWS ¶
func NewJWS(protectedHeaders, unprotectedHeaders jws.Headers, payload []byte, signer Signer) (*JSONWebSignature, error)
NewJWS creates JSON Web Signature.
func ParseJWS ¶
func ParseJWS(jwsStr string, opts ...ParseOpt) (*JSONWebSignature, error)
ParseJWS parses serialized JWS. Currently only JWS Compact Serialization parsing is supported.
func VerifyJWS ¶ added in v0.1.4
VerifyJWS parses and validates serialized JWS. Currently only JWS Compact Serialization parsing is supported.
func (JSONWebSignature) SerializeCompact ¶
func (s JSONWebSignature) SerializeCompact(detached bool) (string, error)
SerializeCompact makes JWS Compact Serialization (https://tools.ietf.org/html/rfc7515#section-7.1)
func (JSONWebSignature) Signature ¶
func (s JSONWebSignature) Signature() []byte
Signature returns a copy of JWS signature.
type JWK ¶
JWK (JSON Web Key) is a JSON data structure that represents a cryptographic key.
func (*JWK) MarshalJSON ¶
MarshalJSON serializes the given key to its JSON representation.
func (*JWK) PublicKeyBytes ¶
PublicKeyBytes converts a public key to bytes.
func (*JWK) UnmarshalJSON ¶
UnmarshalJSON reads a key from its JSON representation.
type ParseOpt ¶
type ParseOpt func(opts *jwsParseOpts)
ParseOpt is the JWS Parser option.
func WithJWSDetachedPayload ¶
WithJWSDetachedPayload option is for definition of JWS detached payload.
type Signer ¶
type Signer interface { // Sign signs. Sign(data []byte) ([]byte, error) // Headers provides JWS headers. "alg" header must be provided (see https://tools.ietf.org/html/rfc7515#section-4.1) Headers() jws.Headers }
Signer defines JWS Signer interface. It makes signing of data and provides custom JWS headers relevant to the signer.