File: encrypt.rb

package info (click to toggle)
ruby-cose 1.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 272 kB
  • sloc: ruby: 993; sh: 5; makefile: 4
file content (21 lines) | stat: -rw-r--r-- 521 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

require "cose/security_message"
require "cose/recipient"

module COSE
  class Encrypt < SecurityMessage
    attr_reader :ciphertext, :recipients

    def self.keyword_arguments_for_initialize(decoded)
      { ciphertext: decoded[0], recipients: decoded[1].map { |s| COSE::Recipient.deserialize(s) } }
    end

    def initialize(ciphertext:, recipients:, **keyword_arguments)
      super(**keyword_arguments)

      @ciphertext = ciphertext
      @recipients = recipients
    end
  end
end