This library helps with Zitadel tokens. It can create, read, and convert tokens to the JWT format.
The token holds data that you can then use further in other services.
-
Token Data: The token holds custom claims in addition to the standard JWT claims (
iat,exp,sub,iss). -
Claims Check: The library checks if the token has all the required claims. Some claims are optional.
-
Conversions: The library can change a JWT payload to a Zitadel token and back. It also converts the token to a JWT string.
-
Signing: It signs the token with a private key using RS256.
| Claim | Type | Description | |
|---|---|---|---|
homeserver |
opt | String |
Homeserver of the project as a single URL |
homeservers_list |
opt | Map<String, String> |
Map of project IDs to their homeserver URLs |
localpart |
opt | String |
Matrix localpart |
profession_oid |
req | String |
Profession oid |
telematik_id |
req | String |
TelematikId |
roles |
req | Map<UserRole, [String]> |
Map of roles to array of projects ids |
where UserRole is an arbitrary string, but some conventional values are: TimProviderApi, FederationlistApi, OrgAdmin, Provider, Admin, User.
localpart is optional because service accounts don't have it.
-
Parsing a Token: You can change a JWT payload into a Zitadel token like this:
// Convert a JwtPayload into a ZitadelJWT let jwt_payload = JwtPayload::new(); let token: ZitadelJWT = jwt_payload.try_into()?;
-
Signing a Token: You can sign your token with a private key to create a JWT string:
// Generate a private key and set a key id let mut private_key = Jwk::generate_rsa_key(2048)?; private_key.set_key_id("123456"); // Convert and sign the ZitadelJWT into a JWT string let jwt = token.to_jwt(&private_key)?;
cargo testcargo +nightly clippy --workspace --all-targets -- -D warnings- If not installed, install with your package manager, or
pip install --user pre-commit - Run
pre-commit autoupdateto update the pre-commit config to use the newest template - Run
pre-commit installto install the pre-commit hooks to your local environment
This project is part of the source code of Famedly.
We think that software for healthcare should be open source, so we publish most parts of our source code at github.com/famedly.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
For licensing information of this project, have a look at the LICENSE file within the repository.
If you compile the open source software that we make available to develop your own mobile, desktop or embeddable application, and cause that application to connect to our servers for any purposes, you have to agree to our Terms of Service. In short, if you choose to connect to our servers, certain restrictions apply as follows:
- You agree not to change the way the open source software connects and interacts with our servers
- You agree not to weaken any of the security features of the open source software
- You agree not to use the open source software to gather data
- You agree not to use our servers to store data for purposes other than the intended and original functionality of the Software
- You acknowledge that you are solely responsible for any and all updates to your software
No license is granted to the Famedly trademark and its associated logos, all of which will continue to be owned exclusively by Famedly GmbH. Any use of the Famedly trademark and/or its associated logos is expressly prohibited without the express prior written consent of Famedly GmbH.
For more information take a look at Famedly.com or contact us by info@famedly.com