package com.atlassian.bitbucket.mesh.auth;

import javax.annotation.Nonnull;
import java.security.PrivateKey;
import java.security.PublicKey;

/**
 * Provides a composite (read: atomic) view of the node's public and private keys, and a fingerprint. This ensures,
 * for example, that when signing tokens while simultaneously rotating the local key, the fingerprint and key used
 * always match.
 */
public interface SigningKey {

    /**
     * @return a SHA-256-hashed fingerprint for the {@link #getPublic public key}
     */
    @Nonnull
    String getFingerprint();

    /**
     * @return the private key, used to sign tokens prior to sending
     */
    @Nonnull
    PrivateKey getPrivate();

    /**
     * @return the public key, which will be sent to the control plane when the node is provisioned
     */
    @Nonnull
    PublicKey getPublic();
}
