MCPcopy
hub / github.com/golang-jwt/jwt / SignedString

Method SignedString

token.go:63–77  ·  view source on GitHub ↗

SignedString creates and returns a complete, signed JWT. The token is signed using the SigningMethod specified in the token. Please refer to https://golang-jwt.github.io/jwt/usage/signing_methods/#signing-methods-and-key-types for an overview of the different signing methods and their respective key

(key any)

Source from the content-addressed store, hash-verified

61// for an overview of the different signing methods and their respective key
62// types.
63func (t *Token) SignedString(key any) (string, error) {
64 sstr, err := t.SigningString()
65 if err != nil {
66 return "", err
67 }
68
69 sig, err := t.Method.Sign(sstr, key)
70 if err != nil {
71 return "", err
72 }
73
74 t.Signature = sig
75
76 return sstr + "." + t.EncodeSegment(sig), nil
77}
78
79// SigningString generates the signing string. This is the most expensive part
80// of the whole deal. Unless you need this for something special, just go

Callers 9

createTokenFunction · 0.80
benchmarkSigningFunction · 0.80
makeTokenFunction · 0.80
MakeSampleTokenFunction · 0.80
signTokenFunction · 0.80

Calls 3

SigningStringMethod · 0.95
EncodeSegmentMethod · 0.95
SignMethod · 0.65

Tested by 7

createTokenFunction · 0.64
benchmarkSigningFunction · 0.64
makeTokenFunction · 0.64