Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
Better docs explaining embedded JWKs
Browse files Browse the repository at this point in the history
  • Loading branch information
csstaub committed Sep 22, 2016
1 parent d00415a commit 299620e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions signing.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,18 @@ func (ctx *genericSigner) SetNonceSource(source NonceSource) {
ctx.nonceSource = source
}

// SetEmbedJwk specifies if the signing key should be embedded in the protected header,
// if any. It defaults to 'true'.
// SetEmbedJwk specifies if the signing key should be embedded in the protected
// header, if any. It defaults to 'true', though that may change in the future.
// Note that the use of embedded JWKs in the signature header can be dangerous,
// as you cannot assume that the key received in a payload is trusted.
func (ctx *genericSigner) SetEmbedJwk(embed bool) {
ctx.embedJwk = embed
}

// Verify validates the signature on the object and returns the payload.
// Be careful when verifying signatures based on embedded JWKs inside the
// payload header! You cannot assume that the key received in a payload is
// trusted.
func (obj JsonWebSignature) Verify(verificationKey interface{}) ([]byte, error) {
verifier, err := newVerifier(verificationKey)
if err != nil {
Expand Down

0 comments on commit 299620e

Please sign in to comment.