Skip to content

feat: add Config.configureFromPemStrings to load MQTT certificates from PEM strings - #193

Merged
andreasgrill merged 1 commit into
mainfrom
feat/configure-certificates-from-pem-strings
Sep 13, 2026
Merged

andreasgrill merged 1 commit into
mainfrom
feat/configure-certificates-from-pem-strings

Conversation

@andreasgrill

Copy link
Copy Markdown
Collaborator

Summary

Xesar provides the MQTT configuration (certificates and client key) via the endpoint /api/v1/user/mqtt-configuration. Loading it is up to the client application; this PR adds a helper to turn the returned PEM strings into Config.MqttCertificates.

  • New Config.configureFromPemStrings(caCertificate, clientCertificate, clientKey), next to configureFromZip / configureFromPaths
  • Blank or invalid values throw a ParsingException naming the affected value (CA certificate, client certificate, client key) with the original cause preserved; key material is never included in the message
  • Private key parsing strips the PEM boundaries and all whitespace, so CRLF line endings and keys without line breaks are accepted (zip/path loading shares this code, behavior for valid files is unchanged)
  • README section with a usage example

Test plan

  • New tests in ConfigTest: valid PEM strings, CRLF + surrounding whitespace, key without line breaks, blank values, invalid values
  • ./gradlew spotlessApply test (274 tests, all green)

🤖 Generated with Claude Code

…om PEM strings

Xesar provides the MQTT configuration via the endpoint
/api/v1/user/mqtt-configuration. Client applications can load it themselves
and pass the returned certificates and key as PEM strings.

Blank or invalid values throw a ParsingException naming the affected value
and preserving the original cause. The private key parsing now tolerates
CRLF line endings and keys without line breaks.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@andreasgrill
andreasgrill force-pushed the feat/configure-certificates-from-pem-strings branch from 4df8fd9 to 6cf317a Compare September 13, 2026 18:15
@andreasgrill
andreasgrill merged commit e617c36 into main Sep 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant