All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.fitko.fitconnect.api.domain.crypto.JWKPair Maven / Gradle / Ivy

Go to download

Library that provides client access to the FIT-Connect api-endpoints for sending, subscribing and routing

The newest version!
package dev.fitko.fitconnect.api.domain.crypto;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.nimbusds.jose.jwk.JWK;
import dev.fitko.fitconnect.api.domain.model.jwk.ApiJwk;
import lombok.Value;

@Value
public class JWKPair {

    JWK publicKey;
    JWK privateKey;

    private static final ObjectMapper MAPPER = new ObjectMapper();

    /**
     * Gets the pair's public key as {@link ApiJwk}.
     *
     * @return {@link ApiJwk}
     */
    public ApiJwk getPublicApiJwk() {
        try {
            return MAPPER.readValue(publicKey.toJSONString(), ApiJwk.class);
        } catch (JsonProcessingException e) {
            throw new RuntimeException(e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy