Module: Protocol::WebSocket::Headers::Nounce

Defined in:
lib/protocol/websocket/headers.rb

Constant Summary collapse

GUID =
"258EAFA5-E914-47DA-95CA-C5AB0DC85B11"

Class Method Summary collapse

Class Method Details

.accept_digest(key) ⇒ Object

Valid for the ‘SEC_WEBSOCKET_ACCEPT` header.



35
36
37
# File 'lib/protocol/websocket/headers.rb', line 35

def self.accept_digest(key)
	Digest::SHA1.base64digest(key + GUID)
end

.generate_keyObject

Valid for the ‘SEC_WEBSOCKET_KEY` header.



30
31
32
# File 'lib/protocol/websocket/headers.rb', line 30

def self.generate_key
	SecureRandom.base64(16)
end