Class: ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkePublicKey

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

Overview

typed: true frozen_string_literal: true

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opaque) ⇒ HpkePublicKey

Returns a new instance of HpkePublicKey.



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

def initialize(opaque)
  @opaque = opaque
end

Instance Attribute Details

#opaqueObject (readonly)

Returns the value of attribute opaque.



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

def opaque
  @opaque
end

Class Method Details

.decode(octet) ⇒ Object



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

def self.decode(octet)
  new(octet)
end

Instance Method Details

#encodeObject



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

def encode
  @opaque.then { |s| [s.length].pack('n') + s }
end