Sha256: 25af18fb5bf1ba77d2ac221e89198e864d7ad57bf9bc5bc78c5a239e94109dc9

Contents?: true

Size: 342 Bytes

Versions: 2

Compression:

Stored size: 342 Bytes

Contents

# frozen_string_literal: true

require "cbor"

module COSE
  module Key
    class Base
      KTY_LABEL = 1

      def self.from_cbor(cbor)
        from_map(CBOR.decode(cbor))
      end

      def self.enforce_type(map, kty, error_message)
        if map[KTY_LABEL] != kty
          raise error_message
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cose-0.3.0 lib/cose/key/base.rb
cose-0.2.0 lib/cose/key/base.rb