Module: PostgresPR::SaltedAuthenticationMixin

Included in:
AuthenticationCryptPassword, AuthenticationMD5Password
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.



171
172
173
# File 'lib/postgres-pr/message.rb', line 171

def salt
  @salt
end

Instance Method Details

#dumpObject

Raises:



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

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



173
174
175
# File 'lib/postgres-pr/message.rb', line 173

def initialize(salt)
  @salt = salt
end

#parse(buffer) ⇒ Object



186
187
188
189
190
# File 'lib/postgres-pr/message.rb', line 186

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