Sha256: fa34b5ee5262e065d6bf9fa926ea9c8fe03226827518839cd5b8d1365ca47a2a

Contents?: true

Size: 606 Bytes

Versions: 9

Compression:

Stored size: 606 Bytes

Contents

# frozen_string_literal: true

module COSE
  class SecurityMessage
    class Headers
      HEADER_LABEL_ALG = 1
      HEADER_LABEL_KID = 4

      attr_reader :protected_bucket, :unprotected_bucket

      def initialize(protected_bucket, unprotected_bucket)
        @protected_bucket = protected_bucket
        @unprotected_bucket = unprotected_bucket
      end

      def alg
        header(HEADER_LABEL_ALG)
      end

      def kid
        header(HEADER_LABEL_KID)
      end

      private

      def header(label)
        protected_bucket[label] || unprotected_bucket[label]
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cose-1.3.1 lib/cose/security_message/headers.rb
cose-1.3.0 lib/cose/security_message/headers.rb
cose-1.2.1 lib/cose/security_message/headers.rb
cose-1.2.0 lib/cose/security_message/headers.rb
cose-1.1.0 lib/cose/security_message/headers.rb
cose-1.0.0 lib/cose/security_message/headers.rb
cose-0.11.0 lib/cose/security_message/headers.rb
cose-0.10.0 lib/cose/security_message/headers.rb
cose-0.9.0 lib/cose/security_message/headers.rb