This content is for SDK V4. For the latest version, see the V5 documentation.
This section contains an advanced discussion of Ditto’s underlying certificate, identity, and encryption implementation. Most readers can skip this section. However, if you are deploying an enterprise on-premises deployment of Ditto, you may be required to reference the following material.
| Capability | Type |
|---|---|
| Encryption | TLS 1.3 |
| Authentication | EC key-pairs with signed certificates |
| Trust infrastructure | X.509 with a developer-controlled certificate authority |
| Access Rules | Query patterns on Document _id’s describing read and or write access |
Identities
An identity is a bundle of the device and app-specific information:| Production | Development | ||
|---|---|---|---|
| Site ID | Allocated by central authority | Defaults to a random number; can be customized | |
| App ID | Set by central authority | For example, “5322afcd-5a70-43a3-bc2d-85d98ccf5ac0” | |
| Access Rules | Set by central authority | All devices may read/write all documents | |
| Private Key | Either generated on device or distributed by central authority | Hard-coded and shared by all devices | |
| Identity Certificate | Unique and signed by a central authority; contains this device’s public key | Hard-coded and shared by all devices | |
| CA Certificate | Shared by all users of the same app | Hard-coded and shared by all devices |
Certificates
Ditto identities and public keys are distributed in the standard X.509 certificate format. They do not directly contain potentially sensitive data such as access rules, but these can be defined by the app’s authentication webhook with the OnlineWithAuthentication identity, or by the developer through theManual identity.
When you are ready to use production identities, feel free to contact us through the Ditto Portal and we will help you set up the right CA tooling for your use case - or provide specifications so you can build your own.
Discovering peers
Devices need to have the same AppID to discover other peers on the network, as well as matching certificates to connect over TLS 1.3. Peer-to-peer connections use mTLS (client certificates) with TLS 1.3. Connections to Ditto Server use a TLS-secured WebSocket connection, with authentication by JWT. Once the certificates match, then the embedded authorization information inside each certificate is used to authorize any incoming requests by that peer. This ensures that those access control rules are enforced.Syncing with Ditto Server
This covers internal details of the Ditto Server implementation. Ditto’s authentication module handles it for you under the hood as part of the
OnlineWithAuthentication and OnlinePlayground identities.Rationale
Why does X.509 return both a key and a certificate instead of locally generating a key and sending a CSR? It would be possible to use a standard CSR flow. It was chosen to issue keys directly for a few reasons.- There is no security benefit as our certificate request is in a secured tunnel, and the identity service is presumed to be completely trustworthy.
- Validating and signing CSRs is more complex than simply creating one with the correct format and fields.
- This is a convenient workflow if using Hashicorp Vault or similar to manage your PKI and issue certificates on demand.