From f39df1fdb4b58a99fecd472e0e5d02c18ffff047 Mon Sep 17 00:00:00 2001 From: Tim Rudat Date: Wed, 25 Feb 2015 18:46:30 +0100 Subject: [PATCH 1/2] Update README Change all double quotes (") to single quotes (') to keep syntax consistent. --- README.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index dde930d2..c1fa6fa8 100644 --- a/README.md +++ b/README.md @@ -7,15 +7,15 @@ A Ruby implementation of [JSON Web Token draft 06](http://self-issued.info/docs/ ## Usage - JWT.encode({"some" => "payload"}, "secret") + JWT.encode({'some' => 'payload'}, 'secret') Note the resulting JWT will not be encrypted, but verifiable with a secret key. - JWT.decode("someJWTstring", "secret") + JWT.decode('someJWTstring', 'secret') If the secret is wrong, it will raise a `JWT::DecodeError` telling you as such. You can still get at the payload by setting the verify argument to false. - JWT.decode("someJWTstring", nil, false) + JWT.decode('someJWTstring', nil, false) ## Algorithms @@ -35,21 +35,21 @@ The JWT spec supports several algorithms for cryptographic signing. This library Change the algorithm with by setting it in encode: - JWT.encode({"some" => "payload"}, "secret", "HS512") + JWT.encode({'some' => 'payload'}, 'secret', 'HS512') **Plaintext** We also support unsigned plaintext JWTs as introduced by draft 03 by explicitly specifying `nil` as the key and algorithm: - jwt = JWT.encode({"some" => "payload"}, nil, nil) + jwt = JWT.encode({'some' => 'payload'}, nil, nil) JWT.decode(jwt, nil, nil) ## Support for reserved claim names JSON Web Token defines some reserved claim names and defines how they should be used. JWT supports these reserved claim names: - - "exp" (Expiration Time) Claim - - "nbf" (Not Before Time) Claim + - 'exp' (Expiration Time) Claim + - 'nbf' (Not Before Time) Claim ### Expiration Time Claim @@ -65,15 +65,15 @@ From [draft 01 of the JWT spec](http://self-issued.info/docs/draft-jones-json-we You pass the expiration time as a UTC UNIX timestamp (an int). For example: - JWT.encode({"exp": 1371720939}, "secret") + JWT.encode({'exp': 1371720939}, 'secret') - JWT.encode({"exp": Time.now.to_i()}, "secret") + JWT.encode({'exp': Time.now.to_i()}, 'secret') Expiration time is automatically verified in `JWT.decode()` and raises `JWT::ExpiredSignature` if the expiration time is in the past: begin - JWT.decode("JWT_STRING", "secret") + JWT.decode('JWT_STRING', 'secret') rescue JWT::ExpiredSignature # Signature has expired end @@ -108,15 +108,15 @@ From [draft-ietf-oauth-json-web-token-32](http://self-issued.info/docs/draft-iet You pass the not before time as a UTC UNIX timestamp (an int). For example: - JWT.encode({"nbf": 1371720939}, "secret") + JWT.encode({'nbf': 1371720939}, 'secret') - JWT.encode({"nbf": Time.now.to_i()}, "secret") + JWT.encode({'nbf': Time.now.to_i()}, 'secret') Not before time is automatically verified in `JWT.decode()` and raises `JWT::ImmatureSignature` if the not before time is in the future: begin - JWT.decode("JWT_STRING", "secret") + JWT.decode('JWT_STRING', 'secret') rescue JWT::ImmatureSignature # Signature is immature end From 5dfa6a973fa3efbcaa58ef2819c586eba9d22257 Mon Sep 17 00:00:00 2001 From: Tim Rudat Date: Mon, 9 Mar 2015 12:40:37 +0100 Subject: [PATCH 2/2] Remove unused code --- spec/helper.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/spec/helper.rb b/spec/helper.rb index 58b2d599..6224bb41 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -1,5 +1,2 @@ require 'rspec' require "#{File.dirname(__FILE__)}/../lib/jwt.rb" - -RSpec.configure do |c| -end