summaryrefslogtreecommitdiff
path: root/vendor/github.com/golang-jwt/jwt/v5/signing_method.go
diff options
context:
space:
mode:
authorLibravatar Terin Stock <terinjokes@gmail.com>2025-03-09 17:47:56 +0100
committerLibravatar Terin Stock <terinjokes@gmail.com>2025-03-10 01:59:49 +0100
commit3ac1ee16f377d31a0fb80c8dae28b6239ac4229e (patch)
treef61faa581feaaeaba2542b9f2b8234a590684413 /vendor/github.com/golang-jwt/jwt/v5/signing_method.go
parent[chore] update URLs to forked source (diff)
downloadgotosocial-3ac1ee16f377d31a0fb80c8dae28b6239ac4229e.tar.xz
[chore] remove vendor
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 0d73631c1..000000000
--- a/vendor/github.com/golang-jwt/jwt/v5/signing_method.go
+++ /dev/null
@@ -1,49 +0,0 @@
-package jwt
-
-import (
- "sync"
-)
-
-var signingMethods = map[string]func() SigningMethod{}
-var signingMethodLock = new(sync.RWMutex)
-
-// SigningMethod can be used add new methods for signing or verifying tokens. It
-// takes a decoded signature as an input in the Verify function and produces a
-// signature in Sign. The signature is then usually base64 encoded as part of a
-// JWT.
-type SigningMethod interface {
- Verify(signingString string, sig []byte, key interface{}) error // Returns nil if signature is valid
- Sign(signingString string, key interface{}) ([]byte, error) // Returns signature or error
- Alg() string // returns the alg identifier for this method (example: 'HS256')
-}
-
-// RegisterSigningMethod registers the "alg" name and a factory function for signing method.
-// This is typically done during init() in the method's implementation
-func RegisterSigningMethod(alg string, f func() SigningMethod) {
- signingMethodLock.Lock()
- defer signingMethodLock.Unlock()
-
- signingMethods[alg] = f
-}
-
-// GetSigningMethod retrieves a signing method from an "alg" string
-func GetSigningMethod(alg string) (method SigningMethod) {
- signingMethodLock.RLock()
- defer signingMethodLock.RUnlock()
-
- if methodF, ok := signingMethods[alg]; ok {
- method = methodF()
- }
- return
-}
-
-// GetAlgorithms returns a list of registered "alg" names
-func GetAlgorithms() (algs []string) {
- signingMethodLock.RLock()
- defer signingMethodLock.RUnlock()
-
- for alg := range signingMethods {
- algs = append(algs, alg)
- }
- return
-}