The protocol

Everything a CaLD Nexus client or relay sends and receives is defined as Protocol Buffers messages. The definitions below are copied from the project's source at build time, so they match the current development version; a deployed server may still run an earlier one. Any client or relay may implement them; terms of use, coming soon, will set out the details.

The protocol is pre-1.0: messages and endpoints may still change, without a compatibility period. To hear about changes, write to hello@cald.nexus.

Message definitions

File What it defines
Core.proto Shared types: phone numbers, validity periods, addresses, algorithms, certificate bundles
Ca.proto Registering a number and getting its certificates
Lookup.proto Looking a number up, checking that held certificates are current, the list of every intermediate certificate, and a holder deleting its own registration
RelaySender.proto Submitting a message to a relay, and the end-to-end message format: what a sender signs and encrypts (CaldMessage, SignedMessage, Signature)
RelayReceiver.proto Collecting messages from a relay, and reporting an unwanted one
RelayWakeUp.proto Telling a relay how to wake a device (a push) when a message arrives for it
RelayForgetNumber.proto Asking a relay to forget a number whose registration its holder has deleted
RelayCapabilities.proto What a relay supports (defined ahead of use: no endpoint serves it yet)
Call.proto Caller ID: the four cald.call messages two phones exchange about a call, carried as message content
SignIn.proto Signing in to a website as a number's holder: the site's unsigned cald.sign-in pointer, carried as message content, the sign-in document the app fetches from it over HTTPS, and the app's signed answer (defined ahead of use: no app answers yet)

Endpoints

Every endpoint is an HTTP POST whose body is the request message and whose answer is the response message, both in Protocol Buffers' standard JSON encoding (field names in lowerCamelCase, Content-Type: application/json). A request with fields the server doesn't know is still accepted, so a newer client can talk to an older server; a body that isn't valid JSON for the message is answered with status 400. Each response is the message named like its request, ending in Response instead of Request (ClientCertificateRequest is answered with ClientCertificateResponse, and AbuseReport with AbuseReportResponse), and every message is defined in the file for its service.

An endpoint's path follows from its .proto file: it is /<area>/<rpc>, where <area> is the name between cald. and .v1 in the file's package line and <rpc> is the name of an rpc in the file's service block, in kebab-case. Lookup.proto's package is cald.lookup.v1, so its listIntermediates is at /lookup/list-intermediates.

Every phone number is a PhoneNumber message holding the number in E.164 form, + then the country's dialing code and the national number, digits only: {"e164": "+16135550142"}. A number written any other way, or in a country the server doesn't support, is refused.

Endpoint Request message
/ca/start-registration ClientCertificateRequest
/ca/complete-registration VerificationRequest
/ca/reserve-reregistration ReregistrationReservationRequest
/ca/redeem-reregistration ReregistrationRedemptionRequest
/lookup/resolve CurrentCertificateRequest
/lookup/match-check MatchCheckRequest
/lookup/list-intermediates ListIntermediatesRequest
/lookup/ingest CertificateIngestionRequest
/lookup/delete-registration RegistrationDeletionRequest
/lookup/disavow DisavowalRequest
/relay/submit-message SubmitMessageRequest
/relay/establish-session EstablishSessionRequest
/relay/retrieve-messages RetrieveMessagesRequest
/relay/acknowledge-messages AcknowledgeMessagesRequest
/relay/report-abuse AbuseReport
/relay/register-wake-up RegisterWakeUpRequest
/relay/forget-number ForgetNumberRequest

RelaySender.proto also defines a submission agent, SubmitViaAgentRequest, where a sender hands its own relay a signed message to seal and forward for it. /relay/submit-via-agent is not served yet: it will open once a relay can hear about complaints against the senders it forwards for.

Addresses. A service's address is a base URL, and its path, if it has one, is a prefix for every endpoint: a relay at https://relay.example.com/cald takes submissions at https://relay.example.com/cald/relay/submit-message. A number's relay address is chosen when the number is registered (relayServerAddress) and written into its certificates; a relay can answer at more than one address (aliases) and serve certificates naming any of them. The address of CaLD Nexus's own public services will be published here when they open; a test deployment runs today, and access is available on request.

Signatures

Several messages carry content as bytes together with a signature over them: lookups, relay sessions, wake-up registrations, registration deletions, and messages handed to a relay to deliver. The signature covers those bytes exactly as sent, behind a signing context (below). A sender signs the exact bytes it sends; a receiver verifies the signature over the exact bytes it received, and acts on nothing in them until it has. Where the signer's identity is inside the signed content (lookups, sessions, wake-up registrations, registration deletions), the receiver decodes the received bytes to learn whose certificate to check, then verifies over those same bytes. Neither side ever re-encodes a message to sign or check it: two encoders can produce different bytes for the same message.

A signature is never over those bytes alone. It is over a signing context followed by them: the context's label length in bytes as two bytes, big-endian, then the label in ASCII, then the bytes as sent. The label says what kind of content the signature is for, so a signature made for one kind never verifies as another, whatever its bytes decode as. The label is never sent: each signature field in the definitions below names the one its verifier expects. A lookup's is cald/lookup/read/v1, so its signature covers 0x00 0x13, those 19 characters, then the lookup's bytes.

Lookups, relay sessions, wake-up registrations and registration deletions also carry the time they were signed, in timestampEpochMillis, and are refused if that is more than 5 minutes from the server's clock, in either direction. A device whose clock is further off than that can't use them.

Registration deletions, relay sessions, wake-up registrations and abuse reports also name their audience: the URL of the endpoint the request is posted to, the service's base URL followed by the endpoint's path (for a relay session, https://relay.example.com/cald/relay/establish-session; for an abuse report, https://relay.example.com/cald/relay/report-abuse). A server refuses one naming any endpoint but its own (an abuse report it ignores, with the same answer as any other), so a request signed for one server is worth nothing at another. Scheme and host are compared without regard to case and the scheme's default port may be written or left out; the path is compared exactly, and a URL with a query, a fragment or a trailing / is refused.

Certificates

A certificate field holds exactly one X.509 certificate in DER, with nothing before or after it; PEM, BER and trailing bytes are refused. A certificate's fingerprint is the SHA-256 of those DER bytes. A fingerprint carried as a Hash (a signature's signingCertificateFingerprint) names its algorithm beside the digest: compute with the algorithm it names, and treat one you can't compute, or one naming none, as naming no certificate you have. A CaLD certificate signed with ECDSA carries its signature in the low-s form (s at most half the order of the signer's curve), and implementations should refuse a certificate whose ECDSA signature has s above that, as they refuse one that doesn't verify: (r, n − s) is just as valid a signature, so accepting both forms would give one certificate two fingerprints. For the same reason, an RSA signature on a certificate must be exactly the issuer's modulus length, as RFC 8017 requires: a verifier that accepts the signature with its leading zero byte dropped (BouncyCastle's does) must have that checked separately.

CaLD Nexus is covered by U.S. Patent No. 12,457,207 B2.