class CQL::Postgres::Auth::ScramSha256

Overview

SCRAM-SHA-256 (RFC 5802 / RFC 7677) without channel binding. The user name in the exchange is empty because the server takes it from the startup packet. The password is NFKC-normalised, which is what SASLprep (RFC 4013) comes to for the text people actually type; servers store the normalised form.

Defined in:

postgres/auth/scram_sha256.cr

Constant Summary

MAX_ITERATIONS = 1000000

PBKDF2 blocks the thread while it runs (about 0.4 s per million rounds); servers default to 4096.

MECHANISM = "SCRAM-SHA-256"

Constructors

Instance Method Summary

Constructor Detail

def self.new(password : String, nonce : String = Random::Secure.base64(18), username : String = "") #

[View source]

Instance Method Detail

def continue(server_first : Bytes) : Bytes #

Answers the server-first message with the client proof.


[View source]
def initial_response : Bytes #

[View source]
def inspect(io : IO) : Nil #
Description copied from class Reference

Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).inspect # => #<Person:0x10fd31f20 @name="John", @age=32>

[View source]
def verified? : Bool #

[View source]
def verify(server_final : Bytes) : Nil #

Checks the server-final message proves the server knows the password too.


[View source]