Method: Sandal::Enc.token_parts
- Defined in:
- lib/sandal/enc.rb
.token_parts(token) ⇒ [Array, Array]
Gets the decoded parts of a JWE token.
12 13 14 15 16 17 18 19 |
# File 'lib/sandal/enc.rb', line 12 def self.token_parts(token) parts = token.is_a?(Array) ? token : token.split(".") raise ArgumentError unless parts.length == 5 decoded_parts = parts.map { |part| Sandal::Util.jwt_base64_decode(part) } return parts, decoded_parts rescue ArgumentError raise Sandal::InvalidTokenError, "Invalid token encoding." end |