aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/golang-jwt/jwt/v5/signing_method.go
diff options
context:
space:
mode:
authorLibravatar Rutger Broekhoff2024-01-02 18:56:31 +0100
committerLibravatar Rutger Broekhoff2024-01-02 18:56:31 +0100
commit8db41da676ac8368ef7c2549d56239a5ff5eedde (patch)
tree09c427fd66de2ec1ebffc8342f5fdbb84b0701b5 /vendor/github.com/golang-jwt/jwt/v5/signing_method.go
parentd4f75fb6db22e57577867445a022227e70958931 (diff)
downloadgitolfs3-8db41da676ac8368ef7c2549d56239a5ff5eedde.tar.gz
gitolfs3-8db41da676ac8368ef7c2549d56239a5ff5eedde.zip
Delete vendor directory
Diffstat (limited to 'vendor/github.com/golang-jwt/jwt/v5/signing_method.go')
-rw-r--r--vendor/github.com/golang-jwt/jwt/v5/signing_method.go49
1 files changed, 0 insertions, 49 deletions
diff --git a/vendor/github.com/golang-jwt/jwt/v5/signing_method.go b/vendor/github.com/golang-jwt/jwt/v5/signing_method.go
deleted file mode 100644
index 0d73631..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/signing_method.go
+++ /dev/null
@@ -1,49 +0,0 @@
1package jwt
2
3import (
4 "sync"
5)
6
7var signingMethods = map[string]func() SigningMethod{}
8var signingMethodLock = new(sync.RWMutex)
9
10// SigningMethod can be used add new methods for signing or verifying tokens. It
11// takes a decoded signature as an input in the Verify function and produces a
12// signature in Sign. The signature is then usually base64 encoded as part of a
13// JWT.
14type SigningMethod interface {
15 Verify(signingString string, sig []byte, key interface{}) error // Returns nil if signature is valid
16 Sign(signingString string, key interface{}) ([]byte, error) // Returns signature or error
17 Alg() string // returns the alg identifier for this method (example: 'HS256')
18}
19
20// RegisterSigningMethod registers the "alg" name and a factory function for signing method.
21// This is typically done during init() in the method's implementation
22func RegisterSigningMethod(alg string, f func() SigningMethod) {
23 signingMethodLock.Lock()
24 defer signingMethodLock.Unlock()
25
26 signingMethods[alg] = f
27}
28
29// GetSigningMethod retrieves a signing method from an "alg" string
30func GetSigningMethod(alg string) (method SigningMethod) {
31 signingMethodLock.RLock()
32 defer signingMethodLock.RUnlock()
33
34 if methodF, ok := signingMethods[alg]; ok {
35 method = methodF()
36 }
37 return
38}
39
40// GetAlgorithms returns a list of registered "alg" names
41func GetAlgorithms() (algs []string) {
42 signingMethodLock.RLock()
43 defer signingMethodLock.RUnlock()
44
45 for alg := range signingMethods {
46 algs = append(algs, alg)
47 }
48 return
49}