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.



46
47
48
# File 'lib/protocol/websocket/headers.rb', line 46

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

.generate_keyObject

Valid for the ‘SEC_WEBSOCKET_KEY` header.



41
42
43
# File 'lib/protocol/websocket/headers.rb', line 41

def self.generate_key
	SecureRandom.base64(16)
end