mirror of
https://github.com/Yonle/bostr.git
synced 2025-07-23 18:25:39 +02:00
bouncer: absurd harmless bug that does not harm anyone but technically annoying
As it turns out, private_keys !== {} is not enough. When i do some experiment in Node.js REPL to find out the cause why the heck bouncer.js still sends AUTH to user even with private_keys being empty ({}), This absurd result happens: Welcome to Node.js v20.11.1. Type ".help" for more information. > {} === {} false > {} !== {} true > {} != {} true > {} == {} false What the fuck.. Signed-off-by: Yonle <yonle@lecturify.net>
This commit is contained in:
@@ -45,7 +45,7 @@ module.exports = (ws, req, onClose) => {
|
|||||||
authKey = Date.now() + Math.random().toString(36);
|
authKey = Date.now() + Math.random().toString(36);
|
||||||
authorized = false;
|
authorized = false;
|
||||||
ws.send(JSON.stringify(["AUTH", authKey]));
|
ws.send(JSON.stringify(["AUTH", authKey]));
|
||||||
} else if (private_keys !== {}) {
|
} else if (Object.keys(private_keys).length) {
|
||||||
// If there is no whitelist, Then we ask to client what is their public key.
|
// If there is no whitelist, Then we ask to client what is their public key.
|
||||||
// We will enable NIP-42 function for this session if user pubkey was available & valid in <private_keys>.
|
// We will enable NIP-42 function for this session if user pubkey was available & valid in <private_keys>.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user