Generate grpc api documentation

This commit is contained in:
ravi-signal 2026-06-11 11:35:20 -05:00 committed by GitHub
parent b6317a1b43
commit fcdc0bbd74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 49 additions and 16 deletions

View File

@ -17,17 +17,29 @@ jobs:
distribution: 'temurin'
java-version-file: .java-version
cache: 'maven'
- name: Compile and Build OpenAPI file
- name: Install gRPC documentation tooling
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
pip install sabledocs
- name: Generate OpenAPI documentation
run: ./mvnw compile
- name: Update Documentation
- name: Generate gRPC documentation
run: |
protoc -I service/src/main/proto service/src/main/proto/org/signal/chat/*.proto \
-o api-doc/grpc/descriptor.pb --include_source_info
cd api-doc/grpc && sabledocs
- name: Push documentation to gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cp -r api-doc/target/openapi/signal-server-openapi.yaml /tmp/
git config user.email "github@signal.org"
git config user.name "Documentation Updater"
git fetch origin gh-pages
git checkout gh-pages
cp /tmp/signal-server-openapi.yaml .
git diff --quiet || git commit -a -m "Updating documentation"
cp api-doc/target/openapi/signal-server-openapi.yaml .
rm -rf grpc
cp -r api-doc/grpc/sabledocs_output grpc
git add -A signal-server-openapi.yaml grpc
git diff --cached --quiet || git commit -m "Updating documentation"
git push origin gh-pages -q

4
.gitignore vendored
View File

@ -29,3 +29,7 @@ deployer.log
.classpath
.settings
.DS_Store
# Generated gRPC documentation build artifacts
/api-doc/grpc/descriptor.pb
/api-doc/grpc/sabledocs_output/

View File

@ -0,0 +1,2 @@
main-page-content-file = "../../service/src/main/proto/org/signal/chat/README.md"
markdown-extensions = ["fenced_code", "tables"]

View File

@ -1,11 +1,23 @@
# Chat gRPC API
Eventually, all chat protocol endpoints will be available via gRPC.
## Request metadata
Clients may provide headers for gRPC requests via [gRPC metadata](https://grpc.io/docs/guides/metadata/) which translates directly to HTTP/2 headers.
- Clients should provide a `User-Agent` header on all gRPC requests.
- Clients may provide an `Accept-Language` on any gRPC requests.
## Authentication
To authenticate for a specific signal account + device, clients may provide a [Basic authorization header](https://www.rfc-editor.org/info/rfc7617/)
on the request. The username must be the account identifier encoded in the 8-4-4-4-12 format followed by a '.'
character and then the device id serialized as a string.
All services either require or forbid providing authentication via an Authorization header. If the service is annotated
with the `require.auth` option `AUTH_ONLY_AUTHENTICATED`, all requests to the service must contain valid authentication
headers. If the service is annotated with the option `AUTH_ONLY_ANONYMOUS` the client must not provide an authorization
header. If provided, the request will fail with a `BAD_AUTHENTICATION` error.
## Errors
In the gRPC protocol all errors are at the request level. That is, errors are returned in response to individual requests and do not impact other H2 streams on the same connection nor terminate the connection.

View File

@ -132,6 +132,7 @@ message GetBackupAuthCredentialsResponse {
// to the account.
//
// To register an anonymous credential:
//
// 1. Set a backup-id on the authenticated channel via Backups::SetBackupId
// 2. Retrieve BackupAuthCredentials via Backups::GetBackupAuthCredentials
// 3. Generate a key pair and set the public key via
@ -139,6 +140,7 @@ message GetBackupAuthCredentialsResponse {
//
// Unless otherwise noted, requests for this service require a
// SignedPresentation, which includes:
//
// - a presentation generated from a BackupAuthCredential issued by
// GetBackupAuthCredentials
// - a signature of that presentation using the private key of a key pair

View File

@ -215,6 +215,7 @@ enum Auth {
}
// This is duplicated from common.proto because:
//
// 1. importing would be a circular dependency
// 2. the canonical declaration belongs there
enum IdentityType {