Class: Noise::Protocol
- Inherits:
-
Object
- Object
- Noise::Protocol
- Defined in:
- lib/noise/protocol.rb
Constant Summary collapse
- CIPHER =
{ 'AESGCM' => Noise::Functions::Cipher::AesGcm, 'ChaChaPoly' => Noise::Functions::Cipher::ChaChaPoly }.freeze
- DH =
{ '25519' => Noise::Functions::DH::ED25519, '448' => Noise::Functions::DH::ED448, 'secp256k1' => Noise::Functions::DH::Secp256k1 }.freeze
- HASH =
{ 'BLAKE2b' => Noise::Functions::Hash::Blake2b, 'BLAKE2s' => Noise::Functions::Hash::Blake2s, 'SHA256' => Noise::Functions::Hash::Sha256, 'SHA512' => Noise::Functions::Hash::Sha512, 'BLAKE3' => Noise::Functions::Hash::Blake3 }.freeze
Instance Attribute Summary collapse
-
#cipher_fn ⇒ Object
Returns the value of attribute cipher_fn.
-
#dh_fn ⇒ Object
Returns the value of attribute dh_fn.
-
#hash_fn ⇒ Object
Returns the value of attribute hash_fn.
-
#hkdf_fn ⇒ Object
Returns the value of attribute hkdf_fn.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
-
#protocol_name ⇒ Object
readonly
Returns the value of attribute protocol_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(protocol_name) ⇒ Protocol
constructor
A new instance of Protocol.
- #psk? ⇒ Boolean
Constructor Details
#initialize(protocol_name) ⇒ Protocol
Returns a new instance of Protocol.
38 39 40 41 42 43 44 45 46 |
# File 'lib/noise/protocol.rb', line 38 def initialize(protocol_name) @protocol_name = protocol_name @name = protocol_name.name @pattern = Noise::Pattern.create(protocol_name.pattern_name, protocol_name.modifiers) @hkdf_fn = Noise::Functions::Hash.create_hkdf_fn(protocol_name.hash_name) @pattern.apply_pattern_modifiers initialize_fn! end |
Instance Attribute Details
#cipher_fn ⇒ Object
Returns the value of attribute cipher_fn.
5 6 7 |
# File 'lib/noise/protocol.rb', line 5 def cipher_fn @cipher_fn end |
#dh_fn ⇒ Object
Returns the value of attribute dh_fn.
5 6 7 |
# File 'lib/noise/protocol.rb', line 5 def dh_fn @dh_fn end |
#hash_fn ⇒ Object
Returns the value of attribute hash_fn.
5 6 7 |
# File 'lib/noise/protocol.rb', line 5 def hash_fn @hash_fn end |
#hkdf_fn ⇒ Object
Returns the value of attribute hkdf_fn.
5 6 7 |
# File 'lib/noise/protocol.rb', line 5 def hkdf_fn @hkdf_fn end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/noise/protocol.rb', line 6 def name @name end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
6 7 8 |
# File 'lib/noise/protocol.rb', line 6 def pattern @pattern end |
#protocol_name ⇒ Object (readonly)
Returns the value of attribute protocol_name.
6 7 8 |
# File 'lib/noise/protocol.rb', line 6 def protocol_name @protocol_name end |
Class Method Details
.create(name) ⇒ Noise::Protocol
33 34 35 |
# File 'lib/noise/protocol.rb', line 33 def self.create(name) new(Noise::ProtocolName.parse(name)) end |
Instance Method Details
#psk? ⇒ Boolean
48 49 50 |
# File 'lib/noise/protocol.rb', line 48 def psk? @pattern.psk? end |