syntax = "proto3"; package cald.relay.v1; // If false, all generated code goes in a single java file option java_multiple_files = true; option java_package = "nexus.cald.api.relay"; // Peer capability discovery: one number's client asks another's "which of these peer-to-peer // message schemas would you accept from me?", and gets back a list the responder composed at // its own discretion for that specific asker. Defined ahead of use: no client sends or answers // these yet. // // This is NOT a Relay service call. CapabilityQuery / CapabilityResponse are the decoded form of // a MessageContent.messageBytes whose (schemaName, schemaVersion, messageTypeName) identifies // this first-party CaLD schema. They travel as ordinary CaldMessage content pieces over Tier 1 -- // encrypted to the recipient, signed by the sender -- and the Relay Service never sees, parses, // or produces them. Authenticity and the "for me" binding come entirely from the enclosing // SignedMessage / CaldMessage; these payloads carry no signature of their own. // // Intended MessageContent identifiers (the exact schemaName spelling isn't settled yet): // schemaName = a reserved CaLD builtin id (e.g. "cald.capabilities"), // schemaVersion = "1", messageTypeName one of "CapabilityQuery" / "CapabilityResponse". Until // that namespace lands, schema identifiers below are treated as opaque strings, matched // literally. // // One-directional by design: this asks only whether the responder would accept content *from // the asker*, never whether the responder might itself originate something toward the asker -- // nothing here gates an inbound send from the responder's own side, so there is no // decision for that direction to pre-clear. An asymmetric capability (e.g. a payments schema // with an "issue" message type and a separate "request payment" message type flowing the other // way) is expressed as distinct schemas or message types, each independently // supported/declined, not as a role tag on one entry. // // Discovery is a convenience, never a precondition or a contract: a sender MAY send // any schema without asking first, MAY send one the responder did not list or explicitly // declined, and a recipient MAY still make a best-effort attempt at content outside what it // advertised. // --------------------------------------------------------------------------- // The two content payloads // --------------------------------------------------------------------------- // Decoded messageBytes of a MessageContent whose messageTypeName is "CapabilityQuery". message CapabilityQuery { // Optional. Empty is the open question -- "what would you accept from me?" -- and the // responder returns whatever subset it chooses to disclose. Non-empty is a targeted probe: // the responder SHOULD speak to each listed schema (list it under supported, list it under // declined, or -- still its choice -- stay silent on it). repeated SchemaReference probedSchemas = 1; // Optional opaque correlation token, echoed back in CapabilityResponse.inReplyTo. A client // with a single outstanding query to a peer can correlate on the responder's number alone // and leave this empty. Not covered by any signature (the enclosing CaldMessage is); it is a // convenience handle, not an authenticated field. string queryId = 2; } // Decoded messageBytes of a MessageContent whose messageTypeName is "CapabilityResponse". message CapabilityResponse { // Echo of CapabilityQuery.queryId when one was supplied; empty otherwise. string inReplyTo = 1; // Schemas the responder will accept from this asker. The responder MAY return any subset of // what it can actually handle, including an empty list, and MAY answer differently to // different askers or at different times. repeated SchemaReference supported = 2; // Schemas the responder is explicitly telling this asker it will NOT accept. Distinct from // leaving a schema out of both lists: an omitted schema carries no information, an // explicitly declined one is a stated "no". A privacy-minded personal client // answering an unknown number may leave both lists empty and disclose nothing; a public // entity may list its IVVR schema under supported and video chat under declined. repeated SchemaReference declined = 3; } // --------------------------------------------------------------------------- // Shared types // --------------------------------------------------------------------------- // Names a schema without asserting anything about support. Fields line up with // MessageContent's schemaName / schemaVersion; the schema-name namespace isn't settled yet, so // these are opaque here. message SchemaReference { string schemaName = 1; // Optional. Empty means "any version of this schema" / the schema family as a whole. string schemaVersion = 2; }