For the complete documentation index, see llms.txt. This page is also available as Markdown.

Schema distribution

The .proto files in lib-derec/protobufs/ are the normative wire schema described in Messages. Every SDK package ships them, together with a compiled descriptor set, so an application can generate its own code — a gRPC client or server for the transport, a message decoder for tooling, a binding in a language DeRec does not ship — without a lib-derec checkout. The shipped schema always matches the package version it comes with.

What ships

The schema is 18 .proto files in the org.derecalliance.derec.protobuf package:

  • 17 message files from protobufs/protobufs/ — the protocol vocabulary (derecmessage.proto, contact.proto, pair.proto, prepair.proto, storeshare.proto, verify.proto, getshare.proto, secretidsversions.proto, unpair.proto, updatechannelinfo.proto, transportprotocol.proto, result.proto, error.proto, communicationinfo.proto, parameterrange.proto, committedderecshare.proto, derecsecret.proto).

  • 1 transport contract from protobufs/grpc/ — derectransport.proto, the DeRecTransport gRPC service. It describes how envelopes are delivered, not what the protocol says; an implementation that reaches its peers over HTTPS needs nothing from it.

Alongside them ships derec_descriptor.bin: a FileDescriptorSet holding the complete import closure — every schema file plus the well-known types it imports (google/protobuf/timestamp.proto, google/protobuf/empty.proto). It is compiled with source info, so code generated from it keeps the protocol's doc comments.

The replica-sync payload (ReplicaSecretPayload, ChannelShare) and the Secret data model (Secret, HelperInfo, UserSecret, Replicas, ReplicaInfo) are not part of this schema. They are prost messages defined in Rust under crate::protocol::types; their fields and tags are listed under Secret payload.

Where each SDK puts it

SDK
Package
Location

Rust

derec-proto

derec_proto::descriptor module, behind the descriptor feature. See Rust below.

Go

github.com/derecalliance/lib-derec/packages/go/derecpb/schema

schema.FileDescriptorSet ([]byte) and schema.Proto (an embed.FS with the files under proto/)

TypeScript

@derec-alliance/nodejs, @derec-alliance/web

proto/ and derec_descriptor.bin at the package root

React Native

@derec-alliance/react-native

schema/proto/ and schema/derec_descriptor.bin

.NET

DeRec.Library (NuGet)

schema/proto/ and schema/derec_descriptor.bin inside the .nupkg

The files are flattened into one directory, and every import in the schema is a bare filename, so a single include root resolves everything:

# npm packages
protoc -I node_modules/@derec-alliance/nodejs/proto \
  --python_out=gen \
  node_modules/@derec-alliance/nodejs/proto/*.proto

For the React Native and .NET layouts the include root is schema/proto. A generator that accepts a descriptor set can consume derec_descriptor.bin directly and needs no include path at all.

Rust

derec-proto already exports every message type (derec_proto::DeRecMessage, …). It generates no service stubs: prost emits messages and ignores services. To build a DeRecTransport client or server, generate it from the descriptor set the crate carries.

The descriptor feature exposes:

  • derec_proto::descriptor::FILE_DESCRIPTOR_SET — &[u8], the complete import closure, generated by the crate's build script from the crate's own sources.

  • derec_proto::descriptor::transport_descriptor() — a prost_types::FileDescriptorSet reduced to derectransport.proto alone.

The schema is exposed as bytes rather than file paths, so it works under cargo vendor, a relocated CARGO_HOME, registry mirrors, and --offline.

The extern_path makes the generated service bind to the DeRecMessage type derec-proto already exports. Passing FILE_DESCRIPTOR_SET instead would emit a second, structurally identical set of message types that does not unify with the first; use it only when you want a standalone type set.

Enable descriptor on the build-dependency only. The feature is off by default because the descriptor set is about 122 KB, and derec-library also compiles to WebAssembly for the Node.js and web SDKs. With Cargo's feature resolver v2 or later, build-dependency features are not unified with normal-dependency features, so enabling it as above keeps the bytes in your build script and out of your binary.

Other languages

Point the language's protobuf or gRPC generator at the shipped files. To produce a transport client or server, compile derectransport.proto; it imports derecmessage.proto, which pulls in every message it carries. The service and the messages share one package, so the full method name on the wire is org.derecalliance.derec.protobuf.DeRecTransport/Send regardless of where the file sits.

The library itself opens no socket. Whatever transport the application builds — gRPC from this schema, HTTPS, or anything else — plugs in through the SDK's transport interface; see TransportProtocol.

Last updated