| 505 | } |
| 506 | |
| 507 | void WebSocket::generateHandshakeSecKey() |
| 508 | { |
| 509 | char rand_key[16] = {0}; |
| 510 | int* p = reinterpret_cast<int*>(rand_key); |
| 511 | for (int i = 0; i < 4; ++i, ++p) |
| 512 | *p = ax::random(); |
| 513 | _handshakeSecKey = utils::base64Encode(std::span{rand_key}); |
| 514 | |
| 515 | auto signContent = _handshakeSecKey; |
| 516 | signContent += "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"sv; |
| 517 | _verifySecKey = utils::computeDigest(signContent, "sha1"sv, utils::DigestPresent::Base64); |
| 518 | } |
| 519 | |
| 520 | void WebSocket::handleNetworkEvent(yasio::io_event* event) |
| 521 | { |
nothing calls this directly
no test coverage detected