Skip to content

feat: Adds Jwk::toPublicKey(array $jwk): PublicKey, the inverse of the existing Jwk::fromPublicKey().#2

Merged
ralflang merged 1 commit into
horde:FRAMEWORK_6_0from
jcdelepine:feat/OidcIntegration
Jun 14, 2026
Merged

feat: Adds Jwk::toPublicKey(array $jwk): PublicKey, the inverse of the existing Jwk::fromPublicKey().#2
ralflang merged 1 commit into
horde:FRAMEWORK_6_0from
jcdelepine:feat/OidcIntegration

Conversation

@jcdelepine

Copy link
Copy Markdown

Adds Jwk::toPublicKey(array $jwk): PublicKey, the inverse of the
existing Jwk::fromPublicKey().

Supports RSA keys (kty=RSA, parameters n/e) and EC keys on curves P-256,
P-384 and P-521 (kty=EC, parameters crv/x/y). Unknown key types and
missing required parameters throw InvalidArgumentException.

Typical use case: verifying JWTs signed by an external OIDC provider.
The provider's JWKS endpoint returns an array of JWK objects; pass each
one to this method to obtain a PublicKey suitable for Rs256Verifier or
Es256Verifier.

Includes unit tests covering: RSA round-trip, EC P-256/P-384/P-521
round-trips, extra fields ignored, wrong key detection, and all error
cases (missing kty, unsupported kty, missing n/e, missing crv, unsupported
curve).

@ralflang My OIDC login implementation is ready. This is PR 2 of 3 required to
continue the implementation.

@ralflang ralflang self-requested a review June 14, 2026 16:35
@ralflang

Copy link
Copy Markdown
Member

Required for horde/base#109

@ralflang ralflang self-assigned this Jun 14, 2026
@ralflang ralflang added the enhancement New feature or request label Jun 14, 2026
@ralflang ralflang merged commit 2b5d6eb into horde:FRAMEWORK_6_0 Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants