fix: make checkKey public
This commit is contained in:
parent
6d0890e280
commit
7e2c22f99b
2 changed files with 17 additions and 12 deletions
15
pkg/rp/jws.go
Normal file
15
pkg/rp/jws.go
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue