Skip to content

Commit

Permalink
fix issues highlighted by ameba
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Jun 21, 2019
1 parent 964d2d8 commit 4dd0e8b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions spec/integration/algorithms/rsa_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ describe JWT do
"-----END PRIVATE KEY-----\n"

public_key = "-----BEGIN PUBLIC KEY-----\n" +
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC5+5+xnWggxNnnmCSNbIwTQFjc\n" +
"yawcvmPupeXs10sfhUAHUxtmT5zH3AI46JrRZN7KV5Ac5bQWzF9ZMPeHqmq5FBdY\n" +
"ooIF8W7lVtYx23OQX5vjFRN0LRY8hyOKL07Us+aUeMwDXX7M6o58XO4bqOh8pGOq\n" +
"FLscCAkdAP9lDgeDGwIDAQAB\n" +
"-----END PUBLIC KEY-----\n"
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC5+5+xnWggxNnnmCSNbIwTQFjc\n" +
"yawcvmPupeXs10sfhUAHUxtmT5zH3AI46JrRZN7KV5Ac5bQWzF9ZMPeHqmq5FBdY\n" +
"ooIF8W7lVtYx23OQX5vjFRN0LRY8hyOKL07Us+aUeMwDXX7M6o58XO4bqOh8pGOq\n" +
"FLscCAkdAP9lDgeDGwIDAQAB\n" +
"-----END PUBLIC KEY-----\n"

wrong_key = OpenSSL::RSA.new(1024).to_pem
payload = {"foo" => "bar"}
Expand Down
2 changes: 1 addition & 1 deletion src/jwt.cr
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module JWT
end

def decode(token : String, key : String = "", algorithm : Algorithm = Algorithm::None, verify = true, validate = true, **opts) : Tuple
verify_data, dot, encoded_signature = token.rpartition('.')
verify_data, _, encoded_signature = token.rpartition('.')

count = verify_data.count('.')
if count != 1
Expand Down

0 comments on commit 4dd0e8b

Please sign in to comment.