A contract protocol is one version of the OneSay API contract: its operations, Actions, fields and errors. Each contract protocol has an
identity, its registry digest: a 64-character hexadecimal value that the SDKs carry as SPEC_SHA256. A client declares the contract
protocol it was built for, and the service answers in that contract protocol, as a LiveKit client declares its protocol version when it
connects.
Served contract protocols
| Contract protocol | Used by |
|---|---|
| 5 | The JavaScript SDK from v0.2.0 and the ESP32 SDK from v0.1.11, and every caller that declares none |
| Each later one | Clients built for that contract protocol |
The service serves every contract protocol in its range at the same time, from 5 upward. A client learns whether the service serves its
contract protocol by declaring it. If the service does not serve it, the declaration is refused with
capability_registry_mismatch. Opening a new contract protocol keeps every served contract protocol working unchanged, without a code
change or a new SDK; clients built for retired contract protocols receive capability_registry_mismatch until upgraded to a served SDK.
How a client declares its contract protocol
- An AppSession declares it in
registry_digestwhen it is created (app.session.create). Every request of that AppSession uses it. - A Device declares it in its capability report, and its access token then carries it. A report of a contract protocol that is not
served is refused with
capability_registry_mismatch. - A Human or Service caller can send the
OneSay-Registry-Digestheader on the operations that accept it. Any other operation answersmessage_invalid. - A caller that declares nothing is treated as the lowest served contract protocol, contract protocol 5. On the task connection (WebSocket), a value that is not served is treated the same way and is not refused.
What the declared contract protocol decides
- The view of each response that the caller receives.
- The newer behaviour the caller can reach. An operation whose Action is defined in a later contract protocol than the caller's is refused
with
capability_registry_mismatch. - A declared value that is not the identity of a served contract protocol is refused with
capability_registry_mismatchbefore any authority is read.
The declared contract protocol grants nothing. Authorization still comes from the caller's credentials, Grants and Consent.
Consent across contract protocols
A Consent policy and its receipts bind the identity of the contract protocol that defines their Action, whoever starts the Action. Opening a new contract protocol therefore changes no stored Consent policy and does not interrupt a call in progress.
Errors
| Code | HTTP status | Meaning |
|---|---|---|
capability_registry_mismatch | 409 | The declared identity is not a served contract protocol, or the caller's contract protocol does not define the operation's Action. |