Class: JWE::Serialization::Compact
- Inherits:
-
Object
- Object
- JWE::Serialization::Compact
- Defined in:
- lib/jwe/serialization/compact.rb
Class Method Summary collapse
Class Method Details
.decode(payload) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/jwe/serialization/compact.rb', line 8 def self.decode(payload) parts = payload.split('.') raise JWE::DecodeError.new('Not enaugh or too many segments') unless parts.length == 5 parts.map do |part| JWE::Base64.jwe_decode(part) end end |
.encode(header, encrypted_cek, iv, ciphertext, tag) ⇒ Object
4 5 6 |
# File 'lib/jwe/serialization/compact.rb', line 4 def self.encode(header, encrypted_cek, iv, ciphertext, tag) [ header, encrypted_cek, iv, ciphertext, tag ].map { |piece| JWE::Base64::jwe_encode(piece) }.join '.' end |