dev.fitko.fitconnect.api.services.keys.KeyService Maven / Gradle / Ivy
package dev.fitko.fitconnect.api.services.keys;
import com.nimbusds.jose.jwk.KeyOperation;
import com.nimbusds.jose.jwk.RSAKey;
import dev.fitko.fitconnect.api.domain.model.destination.Destination;
import dev.fitko.fitconnect.api.services.validation.ValidationService;
import java.util.UUID;
/**
* Service to retrieve and validate public keys from a {@link Destination} or the submission service well-known keys.
*
* @see ValidationService
*/
public interface KeyService {
/**
* Get the public encryption key for a given destination.
*
* @param destination the {@link Destination} the key is requested from
* @return validated {@link RSAKey} (@see {@link ValidationService#validatePublicKey(RSAKey, KeyOperation)}})
*/
RSAKey getPublicEncryptionKey(Destination destination);
/**
* Get the public signature key for a given destination.
*
* @param destinationId unique identifier of the {@link Destination}
* @param keyId unique identifier of the {@link RSAKey}
* @return validated {@link RSAKey} (@see {@link ValidationService#validatePublicKey(RSAKey, KeyOperation)}})
*/
RSAKey getPublicSignatureKey(UUID destinationId, String keyId);
/**
* Get a public signature key for a given key-id from the self-service portal well-known keys.
*
* @param keyId unique identifier of the {@link RSAKey}
* @return validated {@link RSAKey} (@see {@link ValidationService#validatePublicKey(RSAKey, KeyOperation)}})
*/
RSAKey getPortalPublicKey(String keyId);
/**
* Get a public signature key for a given key-id from the submission service well-known keys.
*
* @param keyId unique identifier of the {@link RSAKey}
* @return validated {@link RSAKey} (@see {@link ValidationService#validatePublicKey(RSAKey, KeyOperation)}})
*/
RSAKey getSubmissionServicePublicKey(String keyId);
/**
* Get a public signature key for a given key-id from a submission service instance url well known keys.
* The '/well-known/jkws.json' is added to the given url.
*
* @param url custom url to load the well known keys from
* @param keyId unique identifier of the {@link RSAKey} the well known keys are filtered by
* @return validated {@link RSAKey} (@see {@link ValidationService#validatePublicKey(RSAKey, KeyOperation)}})
*/
RSAKey getWellKnownKeysForSubmissionUrl(String url, String keyId);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy