Sha256: 4b48a6f47cc28d4a03961f5d4eeb316c23bdf9216e98652aea4d4bf0436d9bdd

Contents?: true

Size: 550 Bytes

Versions: 6

Compression:

Stored size: 550 Bytes

Contents

require "cbor"
require "cose/security_message"

module COSE
  class Mac < SecurityMessage
    attr_reader :payload, :tag, :recipients

    def self.keyword_arguments_for_initialize(decoded)
      {
        payload: CBOR.decode(decoded[0]),
        tag: decoded[1],
        recipients: decoded[2].map { |s| COSE::Recipient.deserialize(s) }
      }
    end

    def initialize(payload:, tag:, recipients:, **keyword_arguments)
      super(**keyword_arguments)

      @payload = payload
      @tag = tag
      @recipients = recipients
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cose-0.6.1 lib/cose/mac.rb
cose-0.6.0 lib/cose/mac.rb
cose-0.5.0 lib/cose/mac.rb
cose-0.4.1 lib/cose/mac.rb
cose-0.4.0 lib/cose/mac.rb
cose-0.3.0 lib/cose/mac.rb