Sha256: 6a6267ffb45e3071a6cc20c99fea7b51ab18e414ae2113223b07d849ea28f9fa
Contents?: true
Size: 761 Bytes
Versions: 9
Compression:
Stored size: 761 Bytes
Contents
# frozen_string_literal: true require "cose/recipient" require "cose/mac0" module COSE class Mac < Mac0 CONTEXT = "MAC" attr_reader :recipients def self.keyword_arguments_for_initialize(decoded) super.merge(recipients: decoded.last.map { |r| COSE::Recipient.from_array(r) }) end def self.tag 97 end def initialize(recipients:, **keyword_arguments) super(**keyword_arguments) @recipients = recipients end def verify(key, external_aad = nil) recipient = recipients.detect { |r| r.headers.kid == key.kid } if recipient super else raise(COSE::Error, "No recipient match the key") end end private def context CONTEXT end end end
Version data entries
9 entries across 9 versions & 1 rubygems