Sha256: a4785a557d7f655b01b0a15883d233bf02a53f675de76293d473e5b60e0cd32e
Contents?: true
Size: 600 Bytes
Versions: 2
Compression:
Stored size: 600 Bytes
Contents
module JWE # Serialization namespace. module Serialization # The default and suggested way of serializing JWE messages. class Compact def self.encode(header, encrypted_cek, iv, ciphertext, tag) [header, encrypted_cek, iv, ciphertext, tag].map { |piece| JWE::Base64.jwe_encode(piece) }.join '.' end def self.decode(payload) parts = payload.split('.') raise JWE::DecodeError.new('Not enough or too many segments') unless parts.length == 5 parts.map do |part| JWE::Base64.jwe_decode(part) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jwe-0.4.0 | lib/jwe/serialization/compact.rb |
jwe-0.3.1 | lib/jwe/serialization/compact.rb |