fix: make checkKey public

This commit is contained in:
Livio Amstutz 2020-02-06 07:24:28 +01:00
parent 6d0890e280
commit 7e2c22f99b
2 changed files with 17 additions and 12 deletions

15
pkg/rp/jws.go Normal file
View file

@ -0,0 +1,15 @@
package rp
import (
"gopkg.in/square/go-jose.v2"
)
func CheckKey(keyID string, keys []jose.JSONWebKey, jws *jose.JSONWebSignature) ([]byte, error, bool) {
for _, key := range keys {
if keyID == "" || key.KeyID == keyID {
payload, err := jws.Verify(&key)
return payload, err, true
}
}
return nil, nil, false
}