Fix nullability of sop commands

This commit is contained in:
Paul Schaub 2024-09-19 18:40:55 +02:00
parent eb712e6853
commit c7a4087763
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
3 changed files with 21 additions and 26 deletions

View file

@ -13,7 +13,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Test;
import sop.SOP;
import sop.exception.SOPGPException;
@ -57,25 +56,21 @@ public class SOPTest {
@Test
public void UnsupportedSubcommandsTest() {
SOP nullCommandSOP = new SOP() {
@NotNull
@Override
public ValidateUserId validateUserId() {
return null;
}
@NotNull
@Override
public CertifyUserId certifyUserId() {
return null;
}
@NotNull
@Override
public MergeCerts mergeCerts() {
return null;
}
@NotNull
@Override
public UpdateKey updateKey() {
return null;

View file

@ -15,60 +15,60 @@ import sop.operation.*
interface SOP : SOPV {
/** Generate a secret key. */
fun generateKey(): GenerateKey
fun generateKey(): GenerateKey?
/** Extract a certificate (public key) from a secret key. */
fun extractCert(): ExtractCert
fun extractCert(): ExtractCert?
/**
* Create detached signatures. If you want to sign a message inline, use [inlineSign] instead.
*/
fun sign(): DetachedSign = detachedSign()
fun sign(): DetachedSign? = detachedSign()
/**
* Create detached signatures. If you want to sign a message inline, use [inlineSign] instead.
*/
fun detachedSign(): DetachedSign
fun detachedSign(): DetachedSign?
/**
* Sign a message using inline signatures. If you need to create detached signatures, use
* [detachedSign] instead.
*/
fun inlineSign(): InlineSign
fun inlineSign(): InlineSign?
/** Detach signatures from an inline signed message. */
fun inlineDetach(): InlineDetach
fun inlineDetach(): InlineDetach?
/** Encrypt a message. */
fun encrypt(): Encrypt
fun encrypt(): Encrypt?
/** Decrypt a message. */
fun decrypt(): Decrypt
fun decrypt(): Decrypt?
/** Convert binary OpenPGP data to ASCII. */
fun armor(): Armor
fun armor(): Armor?
/** Converts ASCII armored OpenPGP data to binary. */
fun dearmor(): Dearmor
fun dearmor(): Dearmor?
/** List supported [Profiles][Profile] of a subcommand. */
fun listProfiles(): ListProfiles
fun listProfiles(): ListProfiles?
/** Revoke one or more secret keys. */
fun revokeKey(): RevokeKey
fun revokeKey(): RevokeKey?
/** Update a key's password. */
fun changeKeyPassword(): ChangeKeyPassword
fun changeKeyPassword(): ChangeKeyPassword?
/** Keep a secret key up-to-date. */
fun updateKey(): UpdateKey
fun updateKey(): UpdateKey?
/** Merge OpenPGP certificates. */
fun mergeCerts(): MergeCerts
fun mergeCerts(): MergeCerts?
/** Certify OpenPGP Certificate User-IDs. */
fun certifyUserId(): CertifyUserId
fun certifyUserId(): CertifyUserId?
/** Validate a UserID in an OpenPGP certificate. */
fun validateUserId(): ValidateUserId
fun validateUserId(): ValidateUserId?
}

View file

@ -12,23 +12,23 @@ import sop.operation.Version
interface SOPV {
/** Get information about the implementations name and version. */
fun version(): Version
fun version(): Version?
/**
* Verify detached signatures. If you need to verify an inline-signed message, use
* [inlineVerify] instead.
*/
fun verify(): DetachedVerify = detachedVerify()
fun verify(): DetachedVerify? = detachedVerify()
/**
* Verify detached signatures. If you need to verify an inline-signed message, use
* [inlineVerify] instead.
*/
fun detachedVerify(): DetachedVerify
fun detachedVerify(): DetachedVerify?
/**
* Verify signatures of an inline-signed message. If you need to verify detached signatures over
* a message, use [detachedVerify] instead.
*/
fun inlineVerify(): InlineVerify
fun inlineVerify(): InlineVerify?
}