Each node sends its information, like its name, public keys, etc via IPv6 link local multicast packets. I’ll call these packets advertisements. I choose IPv6 link local because no manual IP address configuration is required. The kernel automatically assigns IPv6 link local addresses for each network interface.
When another node (B) receives the multicast packets, it knows that it can receive packets from the former node (A), but what about the other way round? For that, node B then establishes a TCP connection to node A. If node B can connect to node A, we can conclude that a bidirectional communication is possible between node A and node B.
Let’s say that you have 3 nodes, A, B, and C.
What happens if Node C sends Node A an advertisement for Node B’s name with Node C’s public key?
When A tries to talk to to B’s name, it connects to C using C’s key. C connects to B using B’s public key, proxying the connection, and performing a man in the middle attack.
looks
https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest
Well, it can’t take a stream as input, so it’s not that an output can’t be provided because the input might not be fully known.
And it seems kind of odd if the aim is parallel execution.
pokes around a bit more
I don’t really code in Javascript much, but as I very vaguely recall, at least in browsers, Javascript doesn’t normally have the ability to do concurrent execution…there’s some sort of mechanism that isolates code running in parallel, Web Workers, as I recall.
One of the things that Mozilla’s docs on Promise mentions is this:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
So, one thing that you normally have to do in APIs that have cooperative multithreading going on is, if you want the system to stay responsive, is to make sure that if you’re gonna yield to other threads if you’re gonna be doing some work for an extended period of time. Like, say you’ve got something going on that’s CPU-bound and something that’s network-bound…you don’t want to have one blocking on the other. You want to slice up the tasks and switch back and forth between them to keep the network connection saturated.
I am thinking that it’s possible that the goal here is to do that. Like, you might want to be generating a hash of a big block of data, say a couple gigs. Maybe it takes Javascript a while to do that. So you generate a Promise for that computation, along for the other things you need to do, and then wait for any of them to complete.
If you don’t have anything else going on in your particular codebase, then you can just immediately block until the Promise is fulfilled.
That being said, that’s just my kneejerk reaction based on about a two-minute skim and some familiarity with past systems that have worked in kinda similar ways.