Sha256: 8d325c0c9e141a0806438fc8581c7df97b226d4b891d659104396803381744c6

Contents?: true

Size: 423 Bytes

Versions: 2

Compression:

Stored size: 423 Bytes

Contents

require "base64"
require "json"
require "jose"

module JsonJws::Decode
  def decode(jws, validate = true)
    signatures = jws["signatures"].map do |signature|
      {
        protected: JSON.load(Base64.urlsafe_decode64(signature["protected"])),
        signature: signature["signature"],
      }
    end

    {
      "payload" => Base64.urlsafe_decode64(jws["payload"]),
      "signatures" => signatures,
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
json_jws-0.2.0 lib/json_jws/decode.rb
json_jws-0.1.0 lib/json_jws/decode.rb