lib/solidus_jwt/concerns/decodeable.rb in solidus_jwt-1.0.0 vs lib/solidus_jwt/concerns/decodeable.rb in solidus_jwt-1.1.0
- old
+ new
@@ -2,14 +2,18 @@
module Decodeable
##
# Decode a token generated by SolidusJwt
# @see https://github.com/jwt/ruby-jwt
#
+ # @example decode a token.
+ # SolidusJwt.decode('abc.123.efg')
+ # #=> [{"sub"=>"1234567890", "name"=>"John Doe", "iat"=>1516239022}, {"alg"=>"HS256", "typ"=>"JWT"}]
+ #
# @param token [String] The token to decode
# @return [Array<Hash>]
#
def decode(token)
JWT.decode(token, SolidusJwt::Config.jwt_secret, true,
- algorithm: SolidusJwt::Config.jwt_algorithm)
+ algorithm: SolidusJwt::Config.jwt_algorithm)
end
end
end