Skip to content

Commit

Permalink
chore: run crystal tool format and fix ameba issues
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Aug 30, 2021
1 parent 5bbf114 commit 5a5091c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/libs/
/.crystal/
/.shards/

/bin/

# Libraries don't need dependency lock
# Dependencies will be locked in application that uses them
Expand Down
4 changes: 2 additions & 2 deletions spec/jwt_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe JWT do

it "decodes and verifies JWT with dynamic key" do
token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJrMSI6InYxIiwiazIiOiJ2MiJ9.spzfy63YQSKdoM3av9HHvLtWzFjPd1hbch2g3T1-nu4"
payload, header = JWT.decode(token, algorithm: JWT::Algorithm::HS256) do |header, payload|
payload, header = JWT.decode(token, algorithm: JWT::Algorithm::HS256) do |_header, _payload|
"SecretKey"
end
header.should eq({"typ" => "JWT", "alg" => "HS256"})
Expand All @@ -29,7 +29,7 @@ describe JWT do

it "decodes and verifies JWT with dynamic key and auto algorithm" do
token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJrMSI6InYxIiwiazIiOiJ2MiJ9.spzfy63YQSKdoM3av9HHvLtWzFjPd1hbch2g3T1-nu4"
payload, header = JWT.decode(token) do |header, payload|
payload, header = JWT.decode(token) do |_header, _payload|
"SecretKey"
end
header.should eq({"typ" => "JWT", "alg" => "HS256"})
Expand Down
2 changes: 1 addition & 1 deletion src/jwt.cr
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ module JWT
payload_json = Base64.decode_string(encoded_payload)
payload = JSON.parse(payload_json)

{ header, payload }
{header, payload}
rescue error : Base64::Error
raise DecodeError.new("Invalid Base64", error)
rescue error : JSON::ParseException
Expand Down

0 comments on commit 5a5091c

Please sign in to comment.