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

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

Overview

rbs_inline: enabled

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opaque) ⇒ HpkePublicKey

Returns a new instance of HpkePublicKey.

Parameters:

  • opaque (String)


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

def initialize(opaque)
  @opaque = opaque
end

Instance Attribute Details

#opaque ⇒ Object (readonly)

Returns the value of attribute opaque.

Returns:

  • (Object)


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) ⇒ ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkePublicKey

Parameters:

  • octet (String)

Returns:



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

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

Instance Method Details

#encode ⇒ String

Returns:

  • (String)


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

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