Class: ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite::HpkeAeadId

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_aead_id.rb

Overview

typed: false frozen_string_literal: true

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uint16) ⇒ HpkeAeadId

Returns a new instance of HpkeAeadId.



8
9
10
# File 'lib/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_aead_id.rb', line 8

def initialize(uint16)
  @uint16 = uint16
end

Instance Attribute Details

#uint16Object (readonly)

Returns the value of attribute uint16.



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

def uint16
  @uint16
end

Class Method Details

.decode(octet) ⇒ Object



23
24
25
26
27
# File 'lib/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_aead_id.rb', line 23

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

  new(octet.unpack1('n'))
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
# File 'lib/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_aead_id.rb', line 18

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

#encodeObject



13
14
15
# File 'lib/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_aead_id.rb', line 13

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