diff --git a/core/ssb.js b/core/ssb.js index 9e626446f..34edc6f09 100644 --- a/core/ssb.js +++ b/core/ssb.js @@ -13,7 +13,6 @@ ssb.registerConnectionsChanged(function(change, connection) { var out_message = {}; out_message[id] = blob.byteLength; g_wants_requests[connection.id].send_json(out_message); - //connection.wants_request.send_json(out_message); } } else { debug_print("blobs.get", id); diff --git a/src/ssb.c b/src/ssb.c index 63576a714..c4155a7a0 100644 --- a/src/ssb.c +++ b/src/ssb.c @@ -582,6 +582,9 @@ static void _tf_ssb_connection_verify_identity(tf_ssb_connection_t* connection, char fullid[k_id_base64_len]; tf_ssb_id_bin_to_str(fullid, sizeof(fullid), connection->serverpub); + JSContext* context = connection->ssb->context; + JS_SetPropertyStr(context, connection->object, "id", JS_NewString(context, fullid)); + connection->state = k_tf_ssb_state_verified; for (int i = 0; i < connection->ssb->connections_changed_count; i++) { connection->ssb->connections_changed[i](connection->ssb, k_tf_ssb_change_connect, connection, connection->ssb->connections_changed_user_data[i]); @@ -767,6 +770,12 @@ static void _tf_ssb_connection_verify_client_identity(tf_ssb_connection_t* conne static_assert(sizeof(c) == 80, "server send size"); _tf_ssb_write(connection, c, sizeof(c)); + char fullid[k_id_base64_len]; + tf_ssb_id_bin_to_str(fullid, sizeof(fullid), connection->serverpub); + + JSContext* context = connection->ssb->context; + JS_SetPropertyStr(context, connection->object, "id", JS_NewString(context, fullid)); + connection->state = k_tf_ssb_state_server_verified; for (int i = 0; i < connection->ssb->connections_changed_count; i++) { connection->ssb->connections_changed[i](connection->ssb, k_tf_ssb_change_connect, connection, connection->ssb->connections_changed_user_data[i]);