zeta-sdk
1.2.0indexedLayered architecture delivering unified API, network module with HTTP client and type-safe JSON serialization, reusable common utilities and modular design reducing duplicated code.
Layered architecture delivering unified API, network module with HTTP client and type-safe JSON serialization, reusable common utilities and modular design reducing duplicated code.
This document describes how to use the ZETA SDK, and how to build and run the provided test- and demo-clients.
The ZETA Client SDK is designed to be integrated into existing and new client applications that need to access a TI service based on the new Zerotrust (or ZETA) architecture.
The SDK aims to encapsulate the ZETA requirements and shield the application from it, while at the same time allowing the client to reuse existing functionality that may already be implemented, like the specific storage, configuration, or getting an SM(C)-B token. While implementations for those topics are provided, due to the modular nature and the configuration parameters when instantiating the ZETA SDK, client-specific implementations can be injected into the SDK.
The client is written in kotlin multiplatform, to provide a single implementation of the ZETA functionality, but providing examples on how the client can be integrated into a Java application and as a C++ library.
The following sections give an overview on the repository content, as well as how to build the different clients and how to use them.
[[TOC]]
The Zeta Client SDK is built with Kotlin Multiplatform (KMP) to target multiple platforms (iOS, Android and JVM), while reducing the duplicated code. By sharing core logic across platforms, minimizing the maintenance overhead and ensure consistent behaviour for all clients.

Folders for core SDK functionality and clients.
The different clients serve different purposes:
The clients, how to build and how to use them are described in more detail below.
Here are the folders for the different modules:
| Folder | Description |
|---|---|
| gradle | Gradle installation |
| build-logic | Gradle/Kotlin build logic |
| build | build output |
The different modules contain, depending on the respective setup, platform-specific subfolders.
Here an example from the network module:

The different subfolders contain either commonly used code, which is at least the API of the module, or the platform specific implementations
| Folder | Description |
|---|
If you want to include the SDK into your own kotlin projects, you can get it from a maven repository already.
To do this, add this dependency to your maven pom file:
<!-- https://mvnrepository.com/artifact/de.gematik.zeta/zeta-sdk-jvm -->
<dependency>
<groupId>de.gematik.zeta</groupId>
<artifactId>zeta-sdk</artifactId>
<version>x.y.z</version>
</dependency>
Here is The Maven repository homepage.
If you want to include the SDK into your own Java projects, you can get it from a maven repository already.
To do this, add this dependency to your maven pom file:
<!-- https://mvnrepository.com/artifact/de.gematik.zeta/zeta-sdk-jvm -->
<dependency>
<groupId>de.gematik.zeta</groupId>
<artifactId>zeta-sdk-jvm</artifactId>
<version>x.y.z</version>
</dependency>
Note that the artifactId has an additional -jvm compared to the kotlin version.
Here is The Maven repository homepage.
The build process for the C++ SDK creates a number of DLL files, that need to be linked to your C++ application. This highly depends on your own build process.
The C++ API is defined in a single generated header file:
libzeta_sdk_api.h (Linux / macOS)zeta_sdk_api.h (Windows)This header is automatically generated and enriched with the SDK type definitions during the SDK build process.
The C# SDK is published on NuGet. There is one package per platform, and each package ships only the native SDK library for that platform:
| Package | Platform |
|---|---|
Zeta.Sdk.Linux | Linux |
Zeta.Sdk.Windows | Windows |
The packages target .NET. The .NET runtime is not part of the packages: it is provided by your application or the system, like the JVM for Java. Keep it updated to the latest .NET patch release, which includes the current security fixes.
Add the package for your target platform:
dotnet add package Zeta.Sdk.Windows --version 2.0.0
The C# API, configuration and examples are described in the C# README.
The next sections contain information about the clients.
All clients implement at least the "hellozeta" call to show how the integration of the kotlin code/library is done. The Java client is a proof-of-technology client that implements the hellozeta call and WebSocket STOMP communication. The C++ native client additionally implements full HTTP CRUD operations (GET, POST, PUT, DELETE, HEAD, OPTIONS).
The demo-client can use the functional interface of the Test Fachdienst (test resource server), and can thus create prescriptions, show them, modify them, and delete them.
The testdriver is a proxy client that just forwards the HTTP(S) requests it receives to the given resource server, but using the PEP endpoint and the necessary ZETA and ASL protocols. In addition, it also provides the websockets interface. It can be run in a container, allowing for easy proxying of functional test clients through ZETA SDK and ZETA Guard to an actual resource server. A ready to use container image is provided.
The Java and C++ clients are proof-of-technology clients that implement the "hellozeta" call, to show how the SDK can be integrated into clients with this technology. In addition, they use the websockets functionality to connect to the test resource server.
The build process is using the gradle tool. It can be customized using some values in the "gradle.properties" and the "local.properties" file.
Before building any client that depends on the SDK via Maven, publish it to the local Maven repository:
./gradlew publishJvmPublicationToMavenLocal
The gradle.properties file contains switches that enable or disable building some of the platforms. These can be used to improve the build speed.
de.gematik.zeta.sdk.build-logic.enableAndroid=true
de.gematik.zeta.sdk.build-logic.enableIOS=true
de.gematik.zeta.sdk.build-logic.enableNative=true
Here the "enableNative" switch enables the C++ build components.
The optional Android push-notification feature is not configured in gradle.properties; it
is enabled through a ZETA_GOOGLE_SERVICES_JSON= line in the runtime config file
zeta-client/src/androidMain/assets/zeta.env. See
Push notifications (optional, Android) for what
this enables and the additional setup it requires.
In the local.properties file the location of the Android Sdk can be set, for example like so on a windows machine:
sdk.dir=C\:\\Users\\ABCDE\\AppData\\Local\\Android\\Sdk
All clients use the same set of configuration values, which are described here. These are either configured as environment variables, or in a configuration file.
Note that these items only concern the provided demo- and test-clients. In a real client (like a practice management system) these should be provided by the "surrounding" client application.
Here are the items you need to adapt:
The demo client shows the use of the SDK in a kotlin multiplatform environment. It implements the functionality that is exposed by the Test-Fachdienst.
Note: the SDK and the test client can be built without Android SDK.
The Android demo client can receive push notifications via Firebase Cloud Messaging (FCM).
This feature is optional and disabled by default — the default build has no dependency on
Firebase and needs no Firebase configuration. It is enabled by setting a
ZETA_GOOGLE_SERVICES_JSON= line in zeta-client/src/androidMain/assets/zeta.env (the same
runtime config file the app reads) that points at a valid google-services.json; enabling
it applies the com.google.gms.google-services Gradle plugin.
What the feature adds when enabled
com.google.gms.google-services plugin,ZetaFirebaseMessagingService (receives messages and posts a system notification),POST_NOTIFICATIONS runtime-permission prompt (Android 13+) and the notification
channel / resources.When the feature is disabled, none of the above is compiled in: the Firebase code lives in the
separate zeta-client/src/androidNotifications source set, and the build script compiles in
exactly one variant of the integration provider — the Firebase-backed one when enabled, a no-op
one from zeta-client/src/androidNoNotifications otherwise. The selection happens entirely at
compile time (no reflection), and de.gematik.zeta.client.notification.ZetaNotifications
exposes the result.
How to enable it
The iOS demo app receives pushes straight from APNs; Firebase is not involved. The push gateway
routes on the app_id <bundle id>.apns (here de.gematik.zeta.testclient.iosApp.apns, derived
from the app's bundle identifier) and uses the bundle id as APNs topic. The pushkey is the APNs
device token as 64 hex characters.
iosApp/iosApp/AppDelegate.swift asks for notification permission, registers for remote
notifications and hands the device token to IosPushBridge (Kotlin, iosMain).How to set it up
| Platform | Requirements |
|---|---|
| Android | API 28+ (Android 9.0+) |
| JVM | JDK 17+ |
Certificates point to their OCSP responder and CRL distribution points over plain http://:
the responses are CA-signed, and fetching them over HTTPS would be circular. Android blocks
cleartext by default from API 28 - the SDK's minimum - so revocation fails with
CLEARTEXT communication to <host> not permitted by network security policy unless the app
allows those hosts:
<!-- res/xml/network_security_config.xml, referenced from the manifest as
<application android:networkSecurityConfig="@xml/network_security_config"> -->
<network-security-config>
< =>
ocsp.example-ca.de
crl.example-ca.de
The demo client permits cleartext for all domains
The main configuration of the test client are the
Those are being provided using a configuration file or environment variables.
After creating the configuration file the test client can be started like so:
./gradlew :zeta-client:jvmRun -DmainClass="de.gematik.zeta.client.ZetaClientAppKt" --args='--ZETA_ENV_FILE=<Name-der-Parameter-Datei>
The parameter file contains the configuration parameters as described above:
ENVIRONMENTS=<resource_server_1_api_endpoint> <resource_server_2_api_endpoint> ...
SMB_KEYSTORE_FILE=<sm-b-keystore-file>.p12
SMB_KEYSTORE_ALIAS=<key-alias-im-keystore-file>
SMB_KEYSTORE_PASSWORD=<keystore-password>
POPP_TOKEN=eyJhbGciOiJ......
...
Note: the resource server URL is here named differently as 'ENVIRONMENTS', as there are multiple resource servers possible, not just a single 'FACHDIENST_URL'
The variable 'ENVIRONMENTS' thus contains multiple resource server endpoints, separate by a space. These can be selected in the UI of the demo client.
This step does not need an Android SDK.
./gradlew publishJvmPublicationToMavenLocal
./gradlew publishKotlinMultiplatformToMavenLocal
Note: if you want to publish the ZETA SDK to your own remote repository, you need to adjust the following configuration in the build-logic:
| Folder | File | Variable | Description | Example |
|---|---|---|---|---|
| build-logic/build-logic/src/main/kotlin/com/ey/buildlogic | BuildLogicPlugin.kt | URL des Maven Repositories |
The full tests and setups need an Android SDK:
./gradlew build
./gradlew testAll
In this section we describe how you can create a container with a proxy client containing the SDK and exposing the SDK APIs and other test-related actions as HTTP endpoints. This proxy client is used in various test situations.
Here is an overview on how the proxy client sits between a test driver and the zeta guard. The purpose of the proxy client is to encapsulate the ZETA protocol and make testing of the zeta guard setup easier.
Requests to the Fachdienst enter the proxy client as normal HTTP requests, get forwarded to the ZETA guard using the ZETA and optionally ASL protocol, the ZETA guard validates them and forwards them to the Fachdienst backend. This facilitates end-to-end testing and testing whether the ZETA guard setup is correct.
The proxy client exposes a number of HTTP endpoints that allow on one side forwarding requests to the Fachdienst, but also control the client and extract information necessary for testing.
The client-management routes require OIDC login (AUTH_MODE=OIDC).
Errors from the guard are passed through unchanged. Errors inside the SDK return 400 or 500 with {"message": ...}.
Note: in coming project milestones the paths may change or be extended to accomodate for multiple client instance running in parallel
Note that building the container image in an automated CI/CD process is preferred over these manual steps. The file .gitlab-ci.yml shows how this can be done.
In general the requisites are required for building the test driver as are for the demo client.
Also this tools is required to create the container image:
The necessary libraries can be built with
./gradlew clean jar copyRuntimeLibs
The artifacts are then in
**/build/libs/*.jar
**/build/runtime-libs/*.jar
The container can then be built using the dockerfile:
docker build -f zeta-testdriver/Dockerfile .
The container can be built using the deployment.yml described here.
The configuration items in the deployment.yml file that need to be set are described above in the Configuration section.
In the example below these configuration items are set via helm variables, so they can be used depending on the environment.
The SMB keystore file is being mounted as kubernetes secret.
An additional configuration can be set as described here
| Value | Description | Example |
|---|---|---|
| FILTER_HOST_HEADERS | Boolean if the Host, XFowarded, and ForwardedHost/ForwardedPort headers should be filtered from the request. The testsuite requires false, but some setups seem to require that these headers be filtered | true, false |
Other values are also set by helm variables, like the used image repository, version, etc.
A helm chart template for the Deployment descriptor can be found in the gematik ZETA github repository This folder includes examples for the ingress and the service definitions.
The continuous integration pipeline can be set up with the included .gitlab-ci.yml file, that you need to adapt to your development process. See CI pipeline for which jobs run when and how they depend on each other.
.gitlab-ci.yml
This load driver extends the test driver functionality to support concurrent testing scenarios with independent SDK instances.
The load driver exposes endpoints:
Instances can be configured by passing configuration in the POST body to /load/create_instances
curl -X POST http://0.0.0.0:8080/load/create_instances \
-H "Content-Type: application/json" \
-d '{
"count": 3,
"autoInit": true,
"instances": [
{
"id": 1,
"fachdienstUrl": "https://example/pep/resource1/",
"smbKeystoreFile": "/keystores/keystore1.p12",
"smbKeystoreAlias": "cert1",
"smbKeystorePassword": "secret1",
"poppTokenGeneratorUrl": "https://example/popp-token-generator/token",
"proofMethod": "ehc-practitioner-user-x509",
"patientId": "X110639491",
"insurerId": "109500969"
},
{
"id": 2,
"fachdienstUrl": "https://example/pep/resource2/",
"smbKeystoreFile": "/keystores/keystore2.p12",
"smbKeystoreAlias": "cert2",
"smbKeystorePassword": "secret2"
}
]
}'
Response:
{
"created": 2,
"ids": [1, 2],
"autoInit": true
}
You can then access instances using their IDs:
http://0.0.0.0:8080/load/1/hellozeta (uses instance 1)http://0.0.0.0:8080/loaddriver-api/2/reset (resets instance 2)NOTE: Custom instance IDs can be specified (optional)
If poppTokenGeneratorUrl is set, the PoPP token is requested when the instance is created, using the instance's SM(C)-B, with one generator call per unique card and parameters. The generated token is used when generation succeeds, otherwise the instance's static poppToken. The token is fetched once at creation and never refreshed; recreate the instances after the quarter boundary. The generator call honours DISABLE_SERVER_VALIDATION.
The location of the config file can be configured via the CONFIG_FILE environment variable.
Instances can be configured individually via the CONFIG_FILE file with instance-specific properties:
# Instance 1 configuration
FACHDIENST_URL_1=https://example/pep/resource1/
SMB_FILE_1=/keystores/keystore1.p12
SMB_ALIAS_1=cert1
SMB_PASSWORD_1=secret1
POPP_TOKEN_GENERATOR_URL_1=https://example/popp-token-generator/token
POPP_PROOF_METHOD_1=ehc-practitioner-user-x509
POPP_PATIENT_ID_1=X110639491
POPP_INSURER_ID_1=109500969
# Instance 2 configuration
FACHDIENST_URL_2=https://example/pep/resource1/
SMB_FILE_2=keystores/keystore2.p12
=cert2
=secret2
Note: If the CONFIG_FILE file contains instance 1 configuration, the test driver (non-load) will use those values instead of environment variables.
Configuration is resolved in this order:
The Android test driver is an Android app that runs the test driver on Android. It embeds a Ktor server that exposes endpoints. The difference is that the SDK runs on a real Android runtime instead of the JVM.
With the Android test driver, test suites can use the same API to exercise Android-specific SDK functionality:
/testdriver-api/notifications/* endpoints can be tested end-to-end.The Android test driver can be deployed in the cluster and driven from the CI pipeline.
The Java client shows how the ZETA SDK can be integrated into a Java-based application. It implements only the "hellozeta" call of the Test Fachdienst.
The Java class "Main" in zeta-client-java/main/java/de/gematik/zeta shows how the integration can be done.
The Java client can be built with
./gradlew zeta-client-java:build
and it can be run with
./gradlew zeta-client-java:run
Without any command line parameters, the configuration (as described above) needs to be provided with environment variables.
It if is run with a command line argument of a configuration file like so:
./gradlew zeta-client-java:run --args='config.file'
Then it will read the configuration from the given filename.
Note: when run from gradle, the filename is relative to the build directory, use an absolute path, or relative to
the build directory, like ../config.file
The C++ client shows how the ZETA SDK can be integrated into a C++ application. It implements HTTP CRUD operations and WebSocket STOMP communication with a resource server.
The client is located in zeta-nativeclient-cpp/ and consists of:
hello-http.cpp — HTTP client sample (GET, POST, PUT, DELETE, HEAD, OPTIONS)hello-ws.cpp — WebSocket client sample (STOMP connect, subscribe, create, read)Makefile — cross-platform build and runThe Makefile assumes the following folder structure:
zeta-sdk/
├── zeta-sdk/ <- SDK module
│ └── build/bin/
│ ├── macosArm64/debugShared/
│ ├── linuxX64/debugShared/
│ └── mingwX64/debugShared/
└── zeta-nativeclient-cpp/ <- C++ client
├── hello-http.cpp
├── hello-ws.cpp
├── Makefile
└── .env
The Makefile automatically detects the OS and points to the correct SDK build output:
macosArm64/debugSharedlinuxX64/debugSharedmingwX64/debugSharedIf your folder structure is different, update the LIB_DIR variable in the Makefile accordingly.
clang++ or g++, makeg++), mingw32-makeCreate a .env file in the zeta-nativeclient-cpp/ folder (add to .gitignore):
FACHDIENST_URL=https://...
SMB_KEYSTORE_FILE=/path/to/keystore.p12
SMB_KEYSTORE_ALIAS=alias
SMB_KEYSTORE_PASSWORD=password
POPP_TOKEN=
ASL_PROD=false
WS_BASE_URL=wss://...
WS_SERVER_CONTEXT_PATH=/context
First build the SDK shared library:
./gradlew :zeta-sdk:linkDebugSharedMacosArm64 # macOS
./gradlew :zeta-sdk:linkDebugSharedLinuxX64 # Linux
./gradlew :zeta-sdk:linkDebugSharedMingwX64 # Windows
After building the SDK shared library, the output will be located at:
Then build and run the C++ client:
#macOs Linux
make run-http
make run-ws
# Windows
mingw32-make run-http
mingw32-make run-ws
On macOS and Linux, the library path is set automatically via RPATH at compile time.
On Windows, make run-http will also copy zeta_sdk.dll next to the .exe automatically.
Here are the steps to build the C++ client
docker build --platform linux/amd64 \
-t zeta-cpp-dev \
-f Dockerfile.cpp-dev .
docker run -it \
--platform linux/amd64 \
--ulimit nofile=65536:65536 \
-v $(pwd):/workspace \
zeta-cpp-dev
./gradlew :zeta-client-cpp:linkDebugSharedLinuxX64 // <— compile
./gradlew :zeta-client-cpp:runDebug // <— run
Notes:
--platform linux/amd64 is only used when using a Mac with Apple Silicon--ulimit is required to avoid the error "Too many open files"The C# SDK is distributed via NuGet. The C# API, configuration and examples are described in its own README file.
NOTE: this will only be relevant in a later version of the specification! It is currently not used or required.
The attestation service is a service that runs locally alongside the Zeta SDK client. It provides TPM-based attestation capabilities for Windows and Linux, allowing the SDK to perform platform attestation as part of the ZETA protocol.
The SDK communicates with the attestation service locally to perform TPM operations, such as quote generation and PCR-based attestation. The endpoint of the attestation must be configured in the SDK configuration so the SDK can connect to it.
The TSS2 libraries (tpm2-tss) are bundled as static libraries within the project and do not need to be installed separately. At runtime, the attestation service requires access to a TPM 2.0 device.
The attestation service uses its own configuration file, and can also be configured via command line arguments.
| Argument | Description |
|---|---|
| --config-file | Path to the configuration file (required) |
| --reset-file-integrity | If present, resets the file integrity state on startup |
FILES=/path/to/file1,=/path/to/file1
SERVER_PORT=8081
PCR_ID=23
ALLOWED_EXECUTABLES=/usr/bin/app1
./gradlew :attestation-service:linkReleaseExecutableLinux64
The attestation serivice exposes the following HTTP and Websocket endpoints:
The ZETA SDK consists of a number of modules as described above. The entry into the ZETA-SDK is the class ZetaSdk. It provides a builder interface that can be used to configure the SDK.
The build interface includes the URL of the resource server. Using different URLs, a client can create multiple instances of the SDK, one per resource server.
The following example shows in the kotlin version how a resource can be called.
The configuration includes config objects that allow reusing existing functionality where available. For example, we assume that a client implementation in the context of the TI already has ways to store items securely, or how to create an SM(C)-B token. So these functions can be injected.
The exact configuration items are described in the sourcecode.
When consuming the SDK from C++, C#, or any other native binding, all exported functions follow a consistent error-handling contract:
NULL/IntPtr.Zero on failure instead
of throwing across the language boundary.-1 on failure (see individual function
documentation for any additional negative codes).void functions simply no-op internally on failure; they never crash the
host process.Whenever a function returns a failure value, call ZetaSdk_getLastError() to
retrieve a human-readable description of what went wrong:
ZetaSdk_Client* client = ZetaSdk_buildZetaClient(&buildConfig);
if (client == NULL) {
char* err = ZetaSdk_getLastError();
fprintf(stderr, "Build failed: %s\n", err ? err : "unknown error");
ZetaSdk_freeLastError(err);
return 1;
}
This section gives an overview on how to use the API. More details can be found in the source code.
Note: this API is an intermediary target API and can deviate from the API in tne source code, depending on the state of the implementation according to the project milestones.
The ZETA API offers the following public API:
Inside the HTTP operations as provided by the HttpClient, the discovery, client registration and authentication are performed automatically. The methods discover(), register(), and authenticate() are idempotent. Providing them separately allows the client to implement flexible UI flows in case there is any client interaction needed. For example the authentication could be done at start without an actual call to the Fachdienst, so that any later Fachdienst call is then uninterrupted by manual interaction.
The status() method returns one of the following values:
| Value | Description |
|---|---|
| NOT_REGISTERED | Client has never registered: discover/register required |
The configuration is done by passing the BuildConfig object to the ZetaSdkClient. This object contains the following attributes and sub-objects.
Note: user interaction during authentication is not configured in BuildConfig.
For the OIDC flow (ZETA 2.0, preview), the browser login is handled by the authorizationLauncher and the email/OTP prompts by the otpCallback, both part of
OidcConfig (see OIDC Authentication). The SM(C)-B flow requires no user interaction.
The AuthConfig object configures the authentication process:
The SDK uses two kinds of attestation, depending on the platform:
AttestationConfig for it. See Hardware attestation (Android and iOS).AttestationConfig. It's also used on Android and iOS when the device doesn't support hardware attestation.AttestationConfig has three modes:
tpmHttp() and tpmCustom() accept an optional AttestationStatusCallback. It reports OK, Degraded(reason) or KO(reason).
On Android and Apple platforms, the SDK attests the client with a hardware-backed key that is bound to the client instance key (PuK.Client.Sig). This happens in two places:
hash_puk_client_sig = SHA-256(PuK.Client.Sig).android or apple.For both platforms, clientDataHash = SHA-256(nonce || posture || PuK.Client.Sig). On Android, the posture is canonicalised before hashing. JVM, Linux and Windows have no hardware attestation and always use AttestationConfig.
If the device doesn't support hardware attestation, the SDK falls back to the configured AttestationConfig (software by default). This covers emulators, the iOS Simulator, devices without a hardware-backed keystore, and devices where App Attest is unavailable. The client is then registered with a software posture.
forget() clears the attestation state. On Android, it also deletes Alias_AK. Apple App Attest keys can't be deleted, so on iOS they are only discarded.clearRegistration() keeps the attestation state.com.apple.developer.devicecheck.appattest-environment entitlement:
development during developmentproduction for App Store and TestFlight buildsConfigures how the SDK stores session data. There are two mutually exclusive options:
StorageConfig.DefaultUses the SDK's built-in encrypted storage. This is the recommended option for production.
| Parameter | Type | Required | Description |
|---|---|---|---|
aesB64Key | String | Yes |
aesB64KeyIf the decoded key is not exactly 32 bytes, the SDK will throw:
IllegalArgumentException: Key must be 32 bytes
Security notice: Keep this key secret. Store it in a secure vault or environment variable, do not hardcode it in source code.
StorageConfig.CustomDelegates storage entirely to your own implementation of SdkStorage. When using this option, encryption is the responsibility of the provided implementation.
| Parameter | Type | Required | Description |
|---|---|---|---|
provider | SdkStorage | Yes | Custom storage implementation. |
This is useful for testing or environments where you manage persistence yourself:
val config = StorageConfig.Custom(provider = MemoryStorage())
By default, the SDK uses platform-specific encrypted storage. You can replace this with your own storage implementation.
When using a custom storage provider, encryption is the responsibility of the implementation - the aesB64Key is ignored.
All pointers must remain valid for the lifetime of the SDK instance.
Interface:
| Method | Description |
|---|---|
Thread safety
Custom SdkStorage implementations must be thread-safe, as the SDK may invoke storage operations concurrently from multiple coroutines. See InMemoryStorage.kt for a reference implementation using a coroutine Mutex.
You can provide your own implementation by injecting a custom connector via the AuthConfig.
This is useful when you already have an existing SMC-B connector implementation, or when you
want to control how the certificate and signing operations are performed.
Interface:
| Method | Description |
|---|---|
readCertificate() | Return the SMC-B X.509 certificate as raw DER bytes (not PEM) |
externalAuthenticate(base64Challenge) | Sign the Base64url-encoded challenge and return raw DER-encoded ECDSA signature bytes |
Example:
sdk = ZetaSdk.build(
,
BuildConfig(
...
authConfig = AuthConfig(
...
subjectTokenProvider = CustomSmcbTokenProvider(
connector = : CustomConnectorApi {
: ByteArray {
response = konnektor.readCardCertificate(cardHandle, ...)
Base64.decode(response.x509Certificate)
}
: ByteArray {
response = konnektor.externalAuthenticate(cardHandle, base64Challenge)
Base64.decode(response.base64Signature)
}
}
),
),
),
)
Note: The SDK converts the DER-encoded ECDSA signature to compact JOSE format internally. Do not perform this conversion in your implementation.
Preview: OIDC authentication (including email binding) is part of the ZETA 2.0 specification and still in preview — APIs and flows may change.
You can authenticate via the OIDC Authorization Code Flow by providing an OidcTokenProvider as the subjectTokenProvider in AuthConfig.
This is used when the subject token is obtained through an OIDC broker flow rather than an SMC-B/SM-B connector, and requires a browser-based authentication step plus OTP email verification.
Interface (OidcConfig):
The SDK drives the OIDC flow: it creates PKCE and state, sends the pushed authorization request (PAR),
builds the authorization URL, validates the result and exchanges the code for tokens.
The AuthorizationLauncher only handles the part that needs the app: showing the login in a browser
and catching the redirects that come back to the app.
open(request: AuthorizationRequest) must complete two browser steps:
Return the complete redirect URL received at redirectUri, unchanged and including its query
(e.g. de.gematik.zeta://app?code=…&state=…). The SDK reads code, state and error from it and validates state itself.
Error handling:
error in step 1, or the user cancels the login, throw AuthorizationFailedException(error, description).Both redirectUri and oidcRedirectUri must be registered as redirect URIs during client registration,
and the app must be able to receive both (e.g. via a custom URL scheme or app links).
Email binding and OTP verification
On the first authentication the email address is bound to the client (trust on first use).
The SDK drives the interaction through the otpCallback:
| Method | Description |
|---|---|
awaitEmail() |
Client management (A_25733): e-mail change and registered clients
Clients with OIDC login can change the identity's e-mail address and list / de-register the identity's clients.
The SDK calls the guard API zeta-guard-client-management 2.0.0 at the PEP (https://{guardHost}/zeta/...)
with a DPoP-bound access token carrying the scope zeta:client-management. All calls need a registered client.
// 1. start the change: the guard sends a one-time code to the new address
when (val change = sdk.changeEmail("new@example.com").getOrThrow()) {
is ChangeEmailResponse.Pending -> {
// code sent to change.emailHint; sdk.resendEmailChangeCode() sends it again
sdk.verifyEmailChange(code).getOrThrow() // 2. submit the code
}
ChangeEmailResponse.Verified -> Unit // address was already verified, nothing changed
}
val clients = sdk.listClients().getOrThrow() // [RegisteredClient(id, name), ...]
sdk.deleteClient(clients.first().id).getOrThrow()
Failures are subclasses by HTTP status: (400), (401), (403), (404), (409), (other). The reason is when the PEP rejected the request (e.g. invalid token or missing scope), otherwise (, e.g. , , , ).
The Java wrapper ZetaSdkClientExtension offers the same operations as blocking calls.
See authentication/README.md for the full OIDC and email-binding flow.
Preview: push notifications are part of the ZETA 2.0 specification and still in preview — APIs and flows may change.
The SDK can manage push registrations (pushers) and notification channels at the guard's
Notification Service, and read the notification history of the device (getNotifications,
getNotification) where the operator has enabled it. The feature is opt-in via
BuildConfig.notificationConfig:
val sdk = ZetaSdk.build(
resource,
BuildConfig(
// ...
notificationConfig = NotificationConfig(),
),
)
val notifications = sdk.notifications() // Android/iOS only
notifications.registerPusher(PusherConfig(pushkey = fcmToken, appId = "de.example.app"))
Interface (NotificationConfig):
The notifications() accessor exists on Android and iOS only. Receiving the actual push
messages (FCM/APNs) is the responsibility of the embedding app — see
Push notifications (optional, Android) for the demo
client's FCM setup, Push notifications (iOS, APNs) for its APNs
setup and notifications/README.md for details.
By default, the SDK logs to stdout. You can redirect log output to your own logging system.
The default log level is ERROR. The callback is invoked synchronously from SDK internal threads - implementations must be thread-safe. When a custom logger is set, stdout output is suppressed.
Interface:
| Method | Description |
|---|---|
Log levels:
Opaque handles:
Configuration structs:
Callback vtables:
| Type | Required functions |
|---|---|
ZetaSdk_StorageVTable | put, get, remove, clear |
ZetaSdk_SmcbVTable | readCertificate, externalAuthenticate |
Field order in these structs must exactly match the generated header (zeta_sdk_api.h / libzeta_sdk_api.h).
Note: A mismatched order silently misreads fields instead of failing.
Lifecycle:
Status codes: 0 NOT_REGISTERED · 1 REGISTERED_NO_VALID_TOKENS · 2 HAS_REFRESH_TOKEN · 3 HAS_ACCESS_AND_REFRESH_TOKEN · -1 boundary error (check ZetaSdk_getLastError) · -2 status undetermined
Auth & registration:
HTTP (sync):
| Function | Description |
|---|---|
Failure: response error field is set, not NULL.
HTTP (async):
| Function | Description |
|---|---|
ZetaHttpClient_getAsync/postAsync/putAsync/patchAsync/deleteAsync/headAsync/optionsAsync | Performs the async HTTP call |
Failure: onError(message) is invoked instead of onSuccess.
WebSocket:
Message types: WS_TEXT, WS_BINARY, WS_CLOSE.
This object configures the HTTP client. It contains three sub-objects:
This object contains configuration for e.g. retries and timeouts.
The HTTP client automatically accepts and stores cookies in memory for the duration of the session (AcceptAllCookiesStorage). Cookies are cleared when close() is called.
This object allows adding additional CAs that are validated against for the TLS certificate.
On Windows, the SDK additionally injects CAs from the Windows Certificate Store automatically.
This object determines the log level for backend requests.
The pipeline is defined in .gitlab-ci.yml. A job with needs starts as soon as the jobs listed there have finished.
A job without needs waits for all jobs of the earlier stages.
A merge request pipeline uses the .gitlab-ci.yml of the MR's source branch. For example, an MR from develop to
staging follows the rules as they are in develop.
A name ending in -* means one job per platform. For example, unit-test-csharp-* stands for
unit-test-csharp-linux, unit-test-csharp-macos and unit-test-csharp-windows.
Pipelines started manually (Build → Pipelines → Run pipeline) take the inputs defined in spec:inputs at the top of
.gitlab-ci.yml. The fast lanes do_nuget_only, do_client_tests_only, do_sbom_csharp_only, android and
browserstack run only their own jobs.
An arrow points from a job to the jobs that wait for it. A dashed arrow is an optional dependency: it applies only if that job is part of the pipeline. Jobs without an incoming arrow start as soon as the pipeline starts.
develop and push to developflowchart LR
copyright["check-copyright"]
csunit["unit-test-csharp-*"]
test --> sonar
lint --> sonar
detekt --> sonar
build --> pkg["build-package-testdriver<br/>build-package-nativetestdriver"]
test --> pkg
sonar --> pkg
pkg --> img["build-image-testdriver<br/>build-image-nativetestdriver"]
img -.-> helm["trigger_helm"]
staging, release and tagsJobs marked "staging/release only" do not run on tags. The groups marked "tags only" run only on tags.
publish_artifacts runs on pushes to staging / release and on tags, not in MR pipelines.
flowchart LR
subgraph kotlin["Kotlin SDK and analysis"]
test
lint
detekt
depcheck["dependency-check-gradle<br/>(staging/release only)"]
sonar
build
copyright["check-copyright"]
updates["dependency-updates"]
dokka["build_dokka"]
sbom
end
subgraph images["Test driver images"]
pkg["build-package-testdriver<br/>build-package-nativetestdriver"]
img["build-image-testdriver<br/>build-image-nativetestdriver"]
scan["container_scan"]
end
subgraph native["Native SDK and C# tests"]
sdk["build-sdk-linux<br/>build-sdk-macos<br/>build-sdk-windows"]
csunit["unit-test-csharp-*"]
cstest["client-test-csharp-*<br/>(staging/release only)"]
javatest["client-test-java<br/>(staging/release only)"]
end
subgraph nugetgroup["NuGet (tags only)"]
pack["pack-nuget-*"]
testnuget["test-nuget-*"]
nuget["publish-nuget"]
sbomcs["sbom-csharp"]
pubsbomcs["publish-sbom-csharp"]
end
subgraph android["Android test driver (tags only)"]
apk["android-testdriver-apk"]
androidimg["build-android-testdriver-image"]
hello["hellozeta-android"]
end
subgraph publishing["Publishing and reports"]
dtrack["publish_to_dependencytrack"]
report["publish_artifacts<br/>(not in MR pipelines)"]
end
test --> sonar
lint --> sonar
detekt --> sonar
depcheck -.-> sonar
build --> pkg
test --> pkg
sonar --> pkg
pkg --> img
img --> scan
sdk --> cstest
sdk --> pack
pack --> testnuget
pack --> nuget
testnuget --> nuget
csunit --> nuget
test -.-> nuget
sonar -.-> nuget
sbomcs --> pubsbomcs
apk --> androidimg
androidimg -.-> hello
sbom --> dtrack
test --> dtrack
sonar --> dtrack
test --> report
lint --> report
detekt --> report
depcheck -.-> report
sbom --> report
scan --> report
Per-platform jobs depend only on their own platform: client-test-csharp-linux waits for build-sdk-linux,
build-image-testdriver waits for build-package-testdriver, and so on.
publish (Maven publication) is not in the diagrams: it has no needs and starts only after every job of the stages
testAndAnalysis, build, native_build, client_tests and nuget has finished.
sonar waits for test, and because it imports their reports (coverage, ktlint, detekt).(C) EY Strategy and Transactions GmbH, 2025, licensed for gematik GmbH
Apache License, Version 2.0
See the LICENSE for the specific language governing permissions and limitations under the License
| Verzeichnis | Beschreibung |
|---|
| zeta-sdk | Core SDK Module |
| zeta-client | Code for the demo client |
| zeta-client-java | Code for the Java client |
| zeta-client-cpp | Code for the C++ client (HTTP CRUD and WebSocket demo) |
| zeta-nativeclient-cpp | Standalone C++ client using the SDK shared library directly. Samples can be run using a Makefile for (macOS, Linux, Windows) |
| zeta-testdriver | Code for the test proxy client and load test driver |
| zeta-android-testdriver | Code for the android test driver |
| zeta-csharp-nuget | C# SDK and the per-platform NuGet packages (Zeta.Sdk.Linux, Zeta.Sdk.Windows, Zeta.Sdk.MacOs) |
| attestation-service | Code for the attestation service for Windows and Linux |
| docs | Further code-related documentation |
| Folder | Description |
|---|
| common | commonly used code like logging and platform configuration |
| asl | ASL implementation |
| attestation | Attestation module |
| authentication | authentication module |
| client-registration | Modul for the client registration |
| configuration | Service discovery: reading the .well-known files |
| crypto | Crypto functionality |
| flow-controller | Core SDK controller logic |
| network | Network module (e.g. HttpClient) |
| storage | Storage module |
| tpm | Access to the TPM or alternate implementations |
| notifications | Push notification module |
| common | common API |
| jvm | Code specific for the JVM-implementation |
| desktop | Code specific for the desktop implementations (windows, linux, mac) |
| android | Code specific for the Android-implementation |
| ios | Code specific for the iOS-implementation |
Zeta.Sdk.MacOS | MacOS |
| Value | Description | Example |
|---|
| FACHDIENST_URL | URL of the resource server as reachable via the PEP | https://fachdienst.host.example.com/pep/fachdienst_url/api |
| SMB_KEYSTORE_FILE | Path to the SM-B Certificate-File (in .p12 format) | /smcb-certificates.p12 |
| SMB_KEYSTORE_ALIAS | Alias of the key in the SM-B Certificate file | |
| SMB_KEYSTORE_PASSWORD | Password for the private key | |
| SMB_KEYSTORE_B64 | base64-encoded Keystore being used in the load driver; must be present, empty string if not used. | |
| POPP_TOKEN | Value of a PoPP Token, which is given to the PEP (optional). Fallback if the generator is not configured or fails | eyJhbGciOiJFUzI1NiI...... |
| POPP_TOKEN_GENERATOR_URL | URL of the PoPP test token generator (optional). If set, the driver requests a PoPP token at startup; actorId and actorProfessionOid are read from the SM(C)-B certificate. Priority: incoming PoPP header (HTTP proxy only; the WebSocket proxy always uses the configured/generated token) > generated token > POPP_TOKEN. Not called with AUTH_MODE=OIDC. Fetched once at startup and never refreshed: restart the driver after the quarter boundary. Honours DISABLE_SERVER_VALIDATION | https://zeta-staging.spree.de/popp-token-generator/popp/test/api/v1/token-generator |
| POPP_PROOF_METHOD | proofMethod sent to the PoPP token generator. Default ehc-practitioner-user-x509 | ehc-practitioner-user-x509 |
| POPP_PATIENT_ID | patientId sent to the PoPP token generator. Default X110639491 | X110639491 |
| POPP_INSURER_ID | insurerId sent to the PoPP token generator. Default 109500969 | 109500969 |
| DISABLE_SERVER_VALIDATION | If set to "true", TLS server TLS certificate checks are disabled (for testing only!) | |
| WS_SERVER_CONTEXT_PATH | Specifies the base context to target the resource server. It is used in the Java client to prefix STOMP Websockets destinations | /testfachdienst |
| WS_BASE_URL | Defines the Websocket base URL (including protocol: ws/wss) | wss://host/resource/ws |
| ASL_PROD | Defines whether the client runs in Productive or Non Productive mode. If set to "false" exposes the ASL symmetric keys: K2_c2s_app_data and K2_s2c_app_data | by default is set to "true" (productive environment) |
| STORAGE_AES_KEY | Base64-encoded AES-256 key used to encrypt session data at rest | 7aae7xXr8rnzVqjpYbosS0CFMrlprkD7jbVotm0fd |
| REQUIRED_ROLE_OID | Role-OID that the TI certificate must contain. Required for ASL handshake validation | 1.2.276.0.76.4.156 |
| OIDC_IDP_ISS | Issuer identifier of the OIDC IDP used for the email-binding authentication flow | https://fachdienst.host.example.com/sekidp |
| OIDC_BASE_URI | Base URI the client's system browser flow redirects back to (callback endpoint) | http://localhost:8090/cb/demo |
| OIDC_IDP_ALIAS | Alias of the IDP as configured in the Keycloak broker chain | zeta-sekidp-oidc |
| AUTH_MODE | Selects the authentication mode the client uses to obtain the subject token: SMB for SM-B/SMC-B or OIDC for the OIDC | SMB |
| PUSH_GATEWAY_URL | Push gateway URL used when registering a pusher. Must be exactly one of the notification service’s allowed push gateway URLs (Android/iOS) | https://push.example.com/_matrix/push/v1/notify |
| PLAY_INTEGRITY_CLOUD_PROJECT_NUMBER | Google Cloud project number for Play Integrity (Android, optional). If empty, Play Integrity is disabled and only Key Attestation is used | 123456789012 |
| ZETA_GOOGLE_SERVICES_JSON | Path to a google-services.json. Enables Firebase push notifications in the Android demo client (read at build time, optional) | /path/to/google-services.json |
| APNS_MOCK | If set to “true”, the iOS app registers a fake APNs token instead of a real one (Simulator only) | false |
Create a Firebase project and register an Android app with the applicationId
de.gematik.zeta.client (see the Firebase console).
Download the generated google-services.json and store it somewhere outside the
repository (it is environment specific and contains project credentials — do not commit
it).
Add a ZETA_GOOGLE_SERVICES_JSON= line pointing at that file to
zeta-client/src/androidMain/assets/zeta.env:
ZETA_GOOGLE_SERVICES_JSON=/path/to/google-services.json
Android must also be enabled (de.gematik.zeta.sdk.build-logic.enableAndroid=true).
When the line is absent or empty (or the zeta.env file is missing entirely), the
feature is disabled and the build needs no Firebase configuration; when it points to a
non-existent file, the build prints a warning and keeps the feature disabled. The build
copies the file to zeta-client/google-services.json (where the
com.google.gms.google-services plugin expects it) — that copy is git-ignored.
Build and install the Android app as usual. The FCM push key is deliberately not logged;
to obtain it during development, set a breakpoint in
ZetaFirebaseMessagingService.onNewToken (fires on first start after install and on token
rotation) or evaluate FirebaseMessaging.getInstance().token in the debugger. Use the key
as the target when sending a test message from the Firebase console or the notification
service.
zeta-clientmessage text. In the background, iOS shows the push gateway's placeholder texts
("title / subtitle / body"): decrypting there needs a Notification Service Extension and
persistent iOS SDK storage, neither of which exists yet.iosApp/iosApp/zeta.env.template to zeta.env in the same folder, fill it in and
set PUSH_GATEWAY_URL (exactly one of the notification service's allowed push gateway URLs).
The iOS app logs in via OIDC by default, so also add OIDC_IDP_ISS, OIDC_BASE_URI and
OIDC_IDP_ALIAS, which the template does not list (see Client Configuration).apns entry in its push config whose
bundleId is the app's bundle id, server api.sandbox.push.apple.com for Xcode builds.APNS_MOCK=true. The app then registers a fake token instead
of waiting for APNs; it persists until the app is reinstalled or the simulator is reset, and each
new one adds a pusher that stays registered. Point the push gateway's apns entry at a mock
APNs server and hand the pushes it receives to the simulator with xcrun simctl push.
Simulator only.| iOS | iOS 15+ |
| .NET | .NET 10 (latest patch recommended) |
| URL des remote Maven Repositories |
| "https:///api/v4/projects/3/packages/maven" |
| endpoint | access type | purpose |
|---|
| /proxy/* | all HTTP methods | Forward any requests path after the "/proxy/" part to the Fachdienst. According to the SDK API, includes discovery, client registration and authentication if not already done. Note this also includes the websocket protocol. |
| /testdriver-api/discover | GET | Just the discovery part of the protocol, i.e. reading the .well-known files |
| /testdriver-api/register | GET | Perform client registration (includes discovery if not already done) |
| /testdriver-api/authenticate | GET | Retrieve and store an access token (includes client registration and discovery if not already done) |
| /testdriver-api/storage | GET | Retrieve the stored data (like client instance key, access token etc) |
| /testdriver-api/reset | GET | Forget all the stored information, so any call will start triggering a discovery, client registration and authentication again |
| /testdriver-api/configure | POST | Configures the test driver with the provided settings, including TLS validation, resource URL, and custom CA certificate |
| /testdriver-api/notifications/pushers | GET | List the pushers registered for the authenticated user |
| /testdriver-api/notifications/pushers | POST | Register a pusher (JSON PusherConfigRequest body); the ISS encryption key material is derived inside the SDK |
| /testdriver-api/notifications/pushers | PUT | Update the pusher identified by appId/pushkey (JSON PusherConfigRequest body) |
| /testdriver-api/notifications/pushers | DELETE | Deregister the pusher identified by the pushkey and appId query parameters |
| /testdriver-api/notifications/channels | GET | List the channels available to the authenticated user and their default status |
| /testdriver-api/notifications/channels/local | GET | Get the channel configuration of the locally registered pusher |
| /testdriver-api/notifications/channels/local | POST | Set channels for the locally registered pusher (JSON SetChannelsRequest body) |
| /testdriver-api/client-management/identity/email | POST | Start an e-mail change (JSON {"new_email": ...}); 202 with {"status":"pending","challenge_type":"email_otp","email_hint":...} or {"status":"verified"} |
| /testdriver-api/client-management/identity/email/resend | POST | Re-send the one-time code of the pending e-mail change; 202 {"challenge_type":"email_otp","email_hint":...} |
| /testdriver-api/client-management/identity/email/verify | POST | Submit the one-time code (JSON {"code": "123456"}); 200 {"status":"verified"} |
| /testdriver-api/client-management/clients | GET | List the registered clients of the identity; 200 [{"client_id":...,"name":...}] |
| /testdriver-api/client-management/clients/{client_id} | DELETE | De-register a client of the identity; 204 |
| /oidc/collect-email | POST | Submit the email address for the email-binding OIDC flow |
| /oidc/resend-otp | POST | Trigger a resend of the OTP code for email-binding verification |
| /oidc/verify-otp | POST | Submit the OTP code to complete email-binding verification |
| /oidc/status | GET | Check the current status of the OIDC email-binding flow |
| /oidc/kvnr-email | POST | Sets the test KVNR and binding email for the next OIDC login (kvnr, email in body) |
| /health | GET | health API for kubernetes |
| endpoint | access type | purpose |
|---|
| /load/create_instances?count=N&autoInit=true | POST | Create N SDK instances. With autoInit=true, instances are automatically discovered, registered, and authenticated in parallel. |
| /load/list_instances | GET | List all SDK instances with their current state (CREATED, INITIALIZING, READY, FAILED) and any error messages |
| /load/delete_instances | DELETE | Clean up SDK instances. Optionally specify ?id=1&id=2 to delete specific instances, or omit parameters to delete all instances. |
| /load/{instanceIndex}/* | all HTTP methods | HTTP methodsForward requests through a specific SDK instance. The instanceIndex identifies which instance to use (e.g., /load/1/endpoint uses instance 1). Includes WebSocket support. |
| /loaddriver-api/{instanceIndex}/discover | GET | see: /testdriver-api/discover |
| /loaddriver-api/{instanceIndex}/register | GET | see: /testdriver-api/register |
| /loaddriver-api/{instanceIndex}/authenticate | GET | see: /testdriver-api/authenticate |
| /loaddriver-api/{instanceIndex}/reset | GET | see: /testdriver-api/reset |
| Platform | Path | File |
|---|
| MacOS | zeta-sdk/zeta-sdk/build/bin/macosArm64/debugShared/ | libzeta_sdk.dylib |
| Linux | zeta-sdk/zeta-sdk/build/bin/linuxX64/debugShared/ | libzeta_sdk.so |
| Windows | zeta-sdk/zeta-sdk/build/bin/mingwX64/debugShared/ | zeta_sdk.dll |
| Property | Description | Required | Default |
|---|
| FILES | Comma-separated list of files to monitor for integrity | Yes | - |
| SERVER_PORT | Port on which the attestation service listen | No | 8081 |
| PCR_ID | TPM PCR register ID used for file integrity measurements (existing data will be overwritten!) | No | 23 |
| ALLOWED_EXECUTABLES | Comma-separated list of allowed executable paths for process monitoring | Yes | - |
| endpoint | method | purpose |
|---|
| /attest | POST | Performs a TMP attestation. Accepts AttestationRequest JSON body and returns the TPM quote, signature and attestation key. |
| /verify-integrity | POST | Verifies the integrity of the monitored files. Returns the integrity verification result. |
| /integrity | Websocket | Provides real-time file integrity monitoring. On connection, sends current state. Subsequently pushes updates whenever the integrity state changes. |
| /health | GET | Health check endpoint. Return current status of the attestation service. |
class ZetaSdkTest {
fun sdk_halloZetaTest() = runTest {
// Arrange
val sdk = ZetaSdk.build(
"https://<resource-url>",
BuildConfig(
"demo-client",
"0.2.0",
"client-sdk",
StorageConfig(aesB64Key = "7aae7xXr8rnzVqjpYbosS0CFMrlprkD7jbVotm0fd"),
object : TpmConfig {},
AuthConfig(
listOf(
"zero:audience",
),
30,
true,
SmbTokenProvider(SmbTokenProvider.Credentials("", "", "")),
AttestationConfig.software(),
requiredRoleOid = "1.2.276.0.76.4.156",
),
),
)
// Act
val client = sdk.httpClient {
logging(
LogLevel.ALL,
object : Logger {
override fun log(message: String) {
println("log:" + message)
}
},
)
}
val helloResult = client.get("/hellozeta")
.bodyAsText()
}
}
| Operation | Description | Return value | Errors |
|---|
| getVersion() | static method that returns the ZETA SDK version string | String | |
| build(resource, BuildConfig) | static method to create a new SDK client instance | ||
| forget() | static method to clear all cached information for the FQDN, like instance key, well-known files, or access tokens. This method is mostly used for testing and unregistration scenarios | ||
| discover() | Perform discovery and configuration, i.e. mainly reading the well-known files | ||
| register() | Perform client registration; includes discovery and configuration if not already done | ||
| authenticate() | perform the authentication; includes client registration and discovery and configuration if not alreaady done | ||
| httpClient() | Returns an HttpClient with overloaded method that implement the ZETA specific protocol; this includes authentication etc if not already done | ||
| status() | Returns the current state of the client instance | SdkStatus enum | |
| logout() | Clears the stored authentication tokens, the ASL session and deletes the DPoP keys | ||
| changeEmail(newEmail) | Starts an e-mail change: the guard sends a one-time code to the new address. Returns Pending (code sent) or Verified (address already verified) | ChangeEmailResponse | |
| resendEmailChangeCode() | Re-sends the one-time code of the pending e-mail change | EmailChallenge | |
| verifyEmailChange(code) | Submits the one-time code; the new address then applies to all clients of the identity | - | |
| listClients() | Lists all registered clients (devices) of the identity at this guard, including this one | List | |
| deleteClient(id) | De-registers a client of the identity; deleting this client also clears its local registration | - | |
| clearRegistration() | Clear the client registration without clearing the client instance key | ||
| close() | Closing the ZETA SDK client without forgetting the cached information and cookies | - | error codes |
| REGISTERED_NO_VALID_TOKENS | Client is registered but all tokens are missing or expired |
| HAS_REFRESH_TOKEN | Client has a valid refresh token but no access token |
| HAS_ACCESS_AND_REFRESH_TOKEN | Client has both a valid access token and a refresh token |
| BuildConfig Attribute | Description |
|---|
| productId | The gematik Product-ID |
| productVersion | The version of the product |
| clientName | The name of the client |
| storageConfig | An object providing configuration for secure storage (e.g. of the auth token) |
| tpmConfig | Information about the client's TPM |
| authConfig | Configuration for Authentication Process, e.g: Token scopes, Expiry etc. |
| platformProductId | Platform-specific product id (MacOS, Win, Linux Android, Apple), used for attestation |
| httpClientBuilder | Configuration for the HTTP Client, e.g.: timeouts, retries etc. |
| notificationConfig | Optional NotificationConfig enabling the Notification Service integration; null (default) disables it (see Notifications) |
| Attribute | Description |
|---|
| scopes | Scope-values for the Access Tokens |
| exp | The expiration time of the JWT as lifetime duration in seconds |
| aslProdEnvironment | Determines if the client runs non/production environment. The ASL keys can be accessed if it is set to false |
| subjectTokenProvider | An AuthTokenProvider that supplies the subject token. Either a SubjectTokenProvider (functional interface for SM-B/SMC-B), or an OidcTokenProvider configured with an OidcConfig for the OIDC email-binding authentication flow |
| attestation | Configures software or TPM attestation (see AttestationConfig). Defaults to AttestationConfig.software(). On Android and iOS, hardware attestation is used automatically |
| requiredRoleOid | Role-OID the TI certificate must contain (e.g. 1.2.276.0.76.4.156 for oid_epa_vau) |
| Mode | Factory method | Description |
|---|
| Software | AttestationConfig.software() | Software-based attestation without TPM (default if no other mode is specified) |
| TpmHttp | AttestationConfig.tpmHttp() | TPM-based attestation via an HTTP connection to the attestation service. The SDK connects to the service using the configured endpoint |
| TpmCustom | AttestationConfig.tpmCustom() | TPM-based attestation using a custom AttestationService implementation provided by the client application |
| Platform | Mechanism | Registration evidence | Runtime evidence (client statement) |
|---|
| Android | Android Key Attestation (StrongBox, falling back to TEE), plus optional Google Play Integrity | Key attestation certificate chain of Alias_AK, plus an optional Play Integrity token (classic request, nonce = hash_puk_client_sig) | Device posture, signed_client_data_hash signed with Alias_AK, plus an optional Play Integrity token (standard request, requestHash = clientDataHash) |
| iOS | Apple App Attest (DeviceCheck) | keyId and the App Attest attestation object | Device posture and an App Attest assertion (signature, authenticatorData) over clientDataHash |
Android API 28+. On API 28+ devices with Google services, Key Attestation works without any configuration.
Play Integrity (optional, recommended): pass the Google Cloud project number of your app when initialising the SDK:
ZetaInit.initAndroid(applicationContext, playIntegrityCloudProjectNumber = 123456789012L)
Without it, Play Integrity is disabled and only Key Attestation is used. A warning is logged in that case. The app must be linked to that Cloud project in the Google Play Console.
Play Integrity requests time out after 10 seconds. If a request times out or fails, the SDK sends the request without play_integrity_token instead of failing.
Play Integrity quotas apply. Classic requests (registration only) are limited to 10,000 per day per app and 5 per minute per device.
The SDK manifest contributes the following entries, which are merged into the app manifest and used to collect the device posture:
REQUEST_PASSWORD_COMPLEXITYUSE_BIOMETRIC<queries> entry for com.google.android.modulemetadataThe platformProductId must be an Android product id.
platformProductId must be an Apple product id.| Base64-encoded AES-256 key used to encrypt session data at rest. |
put(key, value)| Store a value for the given key |
get(key) | Retrieve the value for the given key |
remove(key) | Delete the entry for the given key |
clear() | Delete all stored entries |
| Attribute | Description |
|---|
redirectUri | Final redirect URI of the app, where Keycloak returns the authorization code at the end of the login. Must match a redirect_uri registered during client registration (DCR) |
oidcRedirectUri | Intermediate redirect URI where the SekIDP returns its code and state, which are then relayed to the Keycloak broker. Must also be registered during DCR |
idpIss | Issuer URL of the SekIDP to authenticate against, sent as idp_iss in the PAR request |
idpAlias | Alias of the SekIDP identity provider in the Keycloak broker, used to build the broker relay endpoint (/broker/{idpAlias}/endpoint) |
authorizationLauncher | Required. Opens the login in the system browser and returns the final redirect to redirectUri (see AuthorizationLauncher) |
otpCallback | Prompts for the user's email address and OTP code during the email-binding flow (awaitEmail(), awaitOtp(); OtpSubmission.Resend requests a new code) |
request.authorizationUrl and wait for the redirect to request.oidcRedirectUri.
This redirect carries the identity provider's code and state, or error and error_description if the login failed.request.brokerEndpoint with that code and state appended as query
parameters, and wait for the redirect to request.redirectUri.| Return the user's email address (only called when the server requests email collection) |
awaitOtp(emailHint, rejected) | Return OtpSubmission.Otp(code) with the OTP the user received, or OtpSubmission.Resend to request a new one. rejected = true means the previous OTP was wrong |
ClientManagementExceptionInvalidClientManagementRequestExceptionClientManagementUnauthorizedExceptionClientManagementForbiddenExceptionClientNotFoundExceptionClientManagementConflictExceptionUnexpectedClientManagementExceptionpepErrorproblem?.codeProblemCodeINVALID_CODENO_PENDING_CHALLENGENOT_FOUNDUNAUTHORIZED| Attribute | Default | Description |
|---|
wellKnownSubpath | notification-service | Subpath of the Notification Service well-known metadata on the resource host, resulting in https://{resource-host}/.well-known/oauth-protected-resource/{wellKnownSubpath} |
apiBasePath | /push/v1 | API prefix of the Notification Service at the PEP |
rateLimitRetryPolicy | RateLimitRetryPolicy() | Retry behaviour for rate-limited (429) responses |
d(tag, message, throwable)| Log a DEBUG message |
i(tag, message, throwable) | Log an INFO message |
w(tag, message, throwable) | Log a WARN message |
e(tag, message, throwable) | Log an ERROR message |
| Level | Description |
|---|
DEBUG | All messages including verbose debug |
INFO | Informational messages and above |
WARN | Warnings and errors only |
ERROR | Errors only (default) |
NONE | No logging |
| Type | Created by | Freed by |
|---|
ZetaSdk_Client | ZetaSdk_buildZetaClient | ZetaSdk_clearZetaClient |
ZetaSdk_HttpClient | ZetaSdk_buildHttpClient | ZetaSdk_clearHttpClient |
ZetaSdk_WSSession | ZetaSdk_WSSession_create / ZetaSdk_Client_ws | ZetaSdk_WSSession_close |
ZetaSdk_WSMessage | ZetaSdk_WSSession_receiveNext | ZetaSdk_WSMessage_destroy |
ZetaSdk_HttpResponse | any ZetaHttpClient_* sync call | ZetaHttpResponse_destroy |
| Type | Key fields |
|---|
ZetaSdk_BuildConfig | resource, productId, productVersion, clientName, storageConfig, tpmConfig, authConfig, logVTable, proxyConfig, securityConfig |
ZetaSdk_AuthConfig | scopes, scopesCount, exp, aslProdEnvironment, smbConfig, requiredOid, smcbConfig (exactly one of smbConfig/smcbConfig) |
ZetaSdk_SmbConfig | keystoreFile, alias, password |
ZetaSdk_SmcbConfig | customSmcb (vtable) |
ZetaSdk_StorageConfig | aesB64Key, storagePath, customStorage (exactly one of aesB64Key/customStorage) |
ZetaSdk_TpmConfig | reserved, currently empty |
ZetaSdk_SecurityConfig | additionalCaPem, additionalCaPemCount, additionalCaFile, disableServerValidation, sslVerbose, revocationCacheDurationSeconds |
ZetaSdk_NetworkConfig | connectTimeoutMillis, requestTimeoutMillis, socketTimeoutMillis, maxRetries, retryOnlyIdempotent (0/zero-init = SDK defaults: 15000/30000/60000ms, no retries) |
ZetaSdk_ProxyConfig | host, port, username, password, type (0=HTTP, 1=SOCKS) |
ZetaSdk_LogVTable | context, log, logLevel |
ZetaSdk_HttpRequest | url, body, headers, headersCount |
ZetaSdk_HttpHeader | key, value |
| Function | Returns on failure | Description |
|---|
ZetaSdk_buildZetaClient | NULL | Builds a client instance |
ZetaSdk_clearZetaClient | no-op | Frees a client |
ZetaSdk_close | -1 | Closes client (keeps cache) |
ZetaSdk_status | -1 | Returns status code |
ZetaSdk_getLastError | NULL | Gets last error message (must free) |
ZetaSdk_freeLastError | no-op | Frees error string |
ZetaSdk_getVersion | NULL | Gets the SDK version (must free) |
ZetaSdk_freeVersion | no-op | Frees version string |
| Function | Returns on failure | Description |
|---|
ZetaSdk_discover | -1 | Runs discovery |
ZetaSdk_register | -1 | Runs client registration |
ZetaSdk_authenticate | -1 | Runs authentication |
ZetaSdk_logout | -1 | Clears tokens, ASL session |
ZetaSdk_clearRegistration | -1 | Clears registration only |
ZetaSdk_buildHttpClient |
| Creates an HTTP client |
ZetaSdk_clearHttpClient | Frees an HTTP client |
ZetaHttpClient_get/post/put/patch/delete/head/options | Performs the HTTP call |
ZetaHttpResponse_destroy | Frees a response |
| Function | Returns on failure | Description |
|---|
ZetaSdk_WSSession_create | no-op | Opens a session via an HTTP client |
ZetaSdk_Client_ws | no-op | Opens a session via the client |
ZetaSdk_WSSession_close | no-op | Closes a session |
ZetaSdk_WSSession_receiveNext | NULL | Reads next message |
ZetaSdk_WSSession_sendText | no-op | Sends a text frame |
ZetaSdk_WSSession_sendBinary | no-op | Sends a binary frame |
ZetaSdk_WSMessage_destroy | no-op | Frees a message |
| Jobs | MR to / push to develop | MR to staging / release | Push to staging / release | Tag |
|---|
check-copyright, test, lint, detekt, sonar, unit-test-csharp-*, build | ✓ | ✓ | ✓ | ✓ |
build-package-testdriver, build-package-nativetestdriver, build-image-testdriver, build-image-nativetestdriver (test driver images) | ✓ | ✓ | ✓ | ✓ |
trigger_helm (deploys the test driver images) | ✓ | |||
dependency-updates, build_dokka, sbom, publish, publish_to_dependencytrack | ✓ | ✓ | ✓ | |
build-sdk-linux, build-sdk-macos, build-sdk-windows, container_scan | ✓ | ✓ | ✓ | |
dependency-check-gradle, client-test-csharp-*, client-test-java | ✓ | ✓ | ||
publish_artifacts | ✓ | ✓ | ||
pack-nuget-*, test-nuget-*, publish-nuget, sbom-csharp, publish-sbom-csharp | ✓ | |||
android-testdriver-apk, build-android-testdriver-image, hellozeta-android | ✓ |
lintdetekttest and sonar. The C# SBOM upload (publish-sbom-csharp) and the Android test
driver image (build-android-testdriver-image) do not wait for them.unit-test-csharp-* start right away.Surfaced from shared tags and platforms — no rankings paid for.