@Override
    public void handle(JsonObject msg) {
        String nonce = getStringOrThrow(msg, "nonce");
        String sessionId = getStringOrThrow(msg, "sessionId");
        String browser = msg.get("browser").getAsString();
        PublicKey remotePublicKey = SignatureAlgorithm.INSTANCE.parsePublicKey(msg.get("publicKey").getAsString());

        // check if the public keys are the same
        // (this allows the same editor to re-connect, but prevents new connections)
        if (this.socket.getRemotePublicKey() != null && !this.socket.getRemotePublicKey().equals(remotePublicKey)) {
            sendReply(nonce, STATE_REJECTED);
            return;
        }

        // check if session is valid
        RemoteSession session = this.socket.getPlugin().getWebEditorStore().sessions().getSession(sessionId);
        if (session == null || session.isCompleted()) {
            sendReply(nonce, STATE_INVALID);
            return;
        }

        // check if the public key is trusted
        if (!this.socket.getPlugin().getWebEditorStore().keystore().isTrusted(this.socket.getSender(), remotePublicKey.getEncoded())) {
            sendReply(nonce, STATE_UNTRUSTED);

            // ask the user if they want to trust the connection
            Message.EDITOR_SOCKET_UNTRUSTED.send(this.socket.getSender(), nonce, browser, this.socket.getSession().getCommandLabel(), this.socket.getSender().isConsole());
            this.attemptedConnections.put(nonce, remotePublicKey);
            return;
        }

        boolean reconnected = this.socket.getRemotePublicKey() != null;
        this.socket.setRemotePublicKey(remotePublicKey);

        sendReply(nonce, STATE_ACCEPTED);

        if (reconnected) {
            Message.EDITOR_SOCKET_RECONNECTED.send(this.socket.getSender());
        } else {
            Message.EDITOR_SOCKET_CONNECTED.send(this.socket.getSender());
        }
    }
A list of attempted connections (connections that have been attempted with an untrusted public key)
common/src/main/java/me/lucko/luckperms/common/webeditor/socket/listener/HandlerHello.java