(location string)
| 21 | } |
| 22 | |
| 23 | func LoadRSAPublicKeyFromDisk(location string) *rsa.PublicKey { |
| 24 | keyData, e := os.ReadFile(location) |
| 25 | if e != nil { |
| 26 | panic(e.Error()) |
| 27 | } |
| 28 | key, e := jwt.ParseRSAPublicKeyFromPEM(keyData) |
| 29 | if e != nil { |
| 30 | panic(e.Error()) |
| 31 | } |
| 32 | return key |
| 33 | } |
| 34 | |
| 35 | // MakeSampleToken creates and returns a encoded JWT token that has been signed with the specified cryptographic key. |
| 36 | func MakeSampleToken(c jwt.Claims, method jwt.SigningMethod, key any) string { |