Class: ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite::HpkeKdfId

Inherits:
Object
  • Object
show all
Defined in:
lib/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_kdf_id.rb,
sig/generated/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_kdf_id.rbs

Overview

rbs_inline: enabled

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uint16) ⇒ HpkeKdfId

Returns a new instance of HpkeKdfId.

Parameters:

  • uint16 (Integer)


10
11
12
# File 'lib/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_kdf_id.rb', line 10

def initialize(uint16)
  @uint16 = uint16
end

Instance Attribute Details

#uint16 ⇒ Object (readonly)

Returns the value of attribute uint16.

Returns:

  • (Object)


6
7
8
# File 'lib/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_kdf_id.rb', line 6

def uint16
  @uint16
end

Class Method Details

.decode(octet) ⇒ ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite::HpkeKdfId



27
28
29
30
31
32
# File 'lib/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_kdf_id.rb', line 27

def self.decode(octet)
  raise ::ECHConfig::DecodeError if octet.length != 2

  uint16 = octet.unpack1('n') # @type var uint16: Integer
  new(uint16)
end

Instance Method Details

#==(other) ⇒ Boolean



21
22
23
# File 'lib/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_kdf_id.rb', line 21

def ==(other)
  other.uint16 == @uint16
end

#encode ⇒ String

Returns:

  • (String)


15
16
17
# File 'lib/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_kdf_id.rb', line 15

def encode
  [@uint16].pack('n')
end