Arcana::Signing
What a project's Key signs to prove an address is its own, and how
a signature is checked. Each thing signed is a JSON object, written
in Canonical form and tagged with what it is (v), so a signature
made for one purpose can't pass for another.
- Joining over the WebSocket: a client whose
joinframe carries its public key (key) gets back{"type":"challenge","challenge":C}and answers{"type":"prove","signature":S}, signingjoin_proof. That proof names the bus it was meant for (theHostthe client sent), so another bus can't pass it on. - REST: each request carries
Arcana-Key,Arcana-Time(Unix seconds),Arcana-NonceandArcana-Signature, signingrequest_proof. A bus refuses a time more thanWINDOWoff, or a nonce it has seen (Nonces). - Envelopes carry their sender's signature to the receiver
(
Envelope#signed), so it can check the sender itself, without trusting any bus in between (Envelope#signer).
Constants
How far a signed request's time may be from the bus's clock.
Class methods
What a sender signs for an envelope: everything a bus carries
unchanged. Not reply_to, which a bus sets for a request it waits
on, nor ordering, which it resolves. The time is in whole Unix
seconds, so it reads the same however a timestamp is written.
What a client signs to join as address: the bus's challenge,
and bus, the Host header it sent (host:port).
What a client signs for a REST request: its method, the bus (its
Host header), its path with any query, its time and nonce, and
its body's SHA-256 (hex).
The headers that sign a REST request with key. They include
Host, set to bus, so the header sent is the one signed.
A signed request's key, time and nonce, once its signature checks
and its time is within window of now; nil when it isn't signed,
and raises Error saying why when it's signed wrongly. The nonce
is the caller's to check (Nonces#fresh?).