Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurin-Notemann committed Nov 8, 2023
1 parent c37696e commit 3c0ecdd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func ExampleParseWithClaims_customClaimsType() {
}

token, err := jwt.ParseWithClaims(tokenString, &MyCustomClaims{}, func(token *jwt.Token) (interface{}, error) {
// []byte("AllYourBase") refers to the signing key that is used to sign the claim with
// []byte("AllYourBase") refers to the signing key that is used to sign the claim with
return []byte("AllYourBase"), nil
})
if err != nil {
Expand All @@ -110,7 +110,7 @@ func ExampleParseWithClaims_validationOptions() {
}

token, err := jwt.ParseWithClaims(tokenString, &MyCustomClaims{}, func(token *jwt.Token) (interface{}, error) {
// []byte("AllYourBase") refers to the signing key that is used to sign the claim with
// []byte("AllYourBase") refers to the signing key that is used to sign the claim with
return []byte("AllYourBase"), nil
}, jwt.WithLeeway(5*time.Second))
if err != nil {
Expand Down Expand Up @@ -150,7 +150,7 @@ func ExampleParseWithClaims_customValidation() {
tokenString := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJpc3MiOiJ0ZXN0IiwiYXVkIjoic2luZ2xlIn0.QAWg1vGvnqRuCFTMcPkjZljXHh8U3L_qUjszOtQbeaA"

token, err := jwt.ParseWithClaims(tokenString, &MyCustomClaims{}, func(token *jwt.Token) (interface{}, error) {
// []byte("AllYourBase") refers to the signing key that is used to sign the claim with
// []byte("AllYourBase") refers to the signing key that is used to sign the claim with
return []byte("AllYourBase"), nil
}, jwt.WithLeeway(5*time.Second))
if err != nil {
Expand All @@ -170,7 +170,7 @@ func ExampleParse_errorChecking() {
var tokenString = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJleHAiOjE1MDAwLCJpc3MiOiJ0ZXN0In0.HE7fK0xOQwFEr4WDgRWj4teRPZ6i3GLwD5YCm6Pwu_c"

token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) {
// []byte("AllYourBase") refers to the signing key that is used to sign the claim with
// []byte("AllYourBase") refers to the signing key that is used to sign the claim with
return []byte("AllYourBase"), nil
})

Expand Down
2 changes: 1 addition & 1 deletion hmac.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (m *SigningMethodHMAC) Verify(signingString string, sig []byte, key interfa
func (m *SigningMethodHMAC) Sign(signingString string, key interface{}) ([]byte, error) {
if keyBytes, ok := key.([]byte); ok {
if !m.Hash.Available() {
return nil, newError("hmac sign expects []byte", ErrInvalidKeyType)
return nil, newError("hmac sign expects []byte", ErrInvalidKeyType)
}

hasher := hmac.New(m.Hash.New, keyBytes)
Expand Down

0 comments on commit 3c0ecdd

Please sign in to comment.