Module: Sandal::Enc
- Defined in:
- lib/sandal/enc.rb,
lib/sandal/enc/alg.rb,
lib/sandal/enc/agcm.rb,
lib/sandal/enc/acbc_hs.rb,
lib/sandal/enc/alg/rsa.rb,
lib/sandal/enc/alg/direct.rb
Overview
Contains encryption (JWE) functionality.
Defined Under Namespace
Modules: Alg Classes: A128CBC_HS256, A128GCM, A256CBC_HS512, A256GCM, ACBC_HS, AGCM
Class Method Summary collapse
-
.token_parts(token) ⇒ [Array, Array]
Gets the decoded parts of a JWE token.
Class Method Details
.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 |