Module: PostgresPR::SaltedAuthentificationMixin

Included in:
AuthentificationCryptPassword, AuthentificationMD5Password
Defined in:
lib/postgres-pr/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#saltObject

Returns the value of attribute salt


165
166
167
# File 'lib/postgres-pr/message.rb', line 165

def salt
  @salt
end

Instance Method Details

#dumpObject

Raises:


171
172
173
174
175
176
177
178
# File 'lib/postgres-pr/message.rb', line 171

def dump
  raise DumpError unless @salt.size == self.salt_size

  message__dump(4 + self.salt_size) do |buffer|
    buffer.write_int32_network(self.auth_type)
    buffer.write(@salt)
  end
end

#initialize(salt) ⇒ Object


167
168
169
# File 'lib/postgres-pr/message.rb', line 167

def initialize(salt)
  @salt = salt
end

#parse(buffer) ⇒ Object


180
181
182
183
184
# File 'lib/postgres-pr/message.rb', line 180

def parse(buffer)
  super do
    @salt = buffer.read(self.salt_size)
  end
end