mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2025-02-18 08:49:22 +01:00
Fix nullability of sop commands
This commit is contained in:
parent
eb712e6853
commit
c7a4087763
3 changed files with 21 additions and 26 deletions
|
@ -13,7 +13,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import sop.SOP;
|
import sop.SOP;
|
||||||
import sop.exception.SOPGPException;
|
import sop.exception.SOPGPException;
|
||||||
|
@ -57,25 +56,21 @@ public class SOPTest {
|
||||||
@Test
|
@Test
|
||||||
public void UnsupportedSubcommandsTest() {
|
public void UnsupportedSubcommandsTest() {
|
||||||
SOP nullCommandSOP = new SOP() {
|
SOP nullCommandSOP = new SOP() {
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public ValidateUserId validateUserId() {
|
public ValidateUserId validateUserId() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public CertifyUserId certifyUserId() {
|
public CertifyUserId certifyUserId() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public MergeCerts mergeCerts() {
|
public MergeCerts mergeCerts() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public UpdateKey updateKey() {
|
public UpdateKey updateKey() {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -15,60 +15,60 @@ import sop.operation.*
|
||||||
interface SOP : SOPV {
|
interface SOP : SOPV {
|
||||||
|
|
||||||
/** Generate a secret key. */
|
/** Generate a secret key. */
|
||||||
fun generateKey(): GenerateKey
|
fun generateKey(): GenerateKey?
|
||||||
|
|
||||||
/** Extract a certificate (public key) from a secret key. */
|
/** 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.
|
* 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.
|
* 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
|
* Sign a message using inline signatures. If you need to create detached signatures, use
|
||||||
* [detachedSign] instead.
|
* [detachedSign] instead.
|
||||||
*/
|
*/
|
||||||
fun inlineSign(): InlineSign
|
fun inlineSign(): InlineSign?
|
||||||
|
|
||||||
/** Detach signatures from an inline signed message. */
|
/** Detach signatures from an inline signed message. */
|
||||||
fun inlineDetach(): InlineDetach
|
fun inlineDetach(): InlineDetach?
|
||||||
|
|
||||||
/** Encrypt a message. */
|
/** Encrypt a message. */
|
||||||
fun encrypt(): Encrypt
|
fun encrypt(): Encrypt?
|
||||||
|
|
||||||
/** Decrypt a message. */
|
/** Decrypt a message. */
|
||||||
fun decrypt(): Decrypt
|
fun decrypt(): Decrypt?
|
||||||
|
|
||||||
/** Convert binary OpenPGP data to ASCII. */
|
/** Convert binary OpenPGP data to ASCII. */
|
||||||
fun armor(): Armor
|
fun armor(): Armor?
|
||||||
|
|
||||||
/** Converts ASCII armored OpenPGP data to binary. */
|
/** Converts ASCII armored OpenPGP data to binary. */
|
||||||
fun dearmor(): Dearmor
|
fun dearmor(): Dearmor?
|
||||||
|
|
||||||
/** List supported [Profiles][Profile] of a subcommand. */
|
/** List supported [Profiles][Profile] of a subcommand. */
|
||||||
fun listProfiles(): ListProfiles
|
fun listProfiles(): ListProfiles?
|
||||||
|
|
||||||
/** Revoke one or more secret keys. */
|
/** Revoke one or more secret keys. */
|
||||||
fun revokeKey(): RevokeKey
|
fun revokeKey(): RevokeKey?
|
||||||
|
|
||||||
/** Update a key's password. */
|
/** Update a key's password. */
|
||||||
fun changeKeyPassword(): ChangeKeyPassword
|
fun changeKeyPassword(): ChangeKeyPassword?
|
||||||
|
|
||||||
/** Keep a secret key up-to-date. */
|
/** Keep a secret key up-to-date. */
|
||||||
fun updateKey(): UpdateKey
|
fun updateKey(): UpdateKey?
|
||||||
|
|
||||||
/** Merge OpenPGP certificates. */
|
/** Merge OpenPGP certificates. */
|
||||||
fun mergeCerts(): MergeCerts
|
fun mergeCerts(): MergeCerts?
|
||||||
|
|
||||||
/** Certify OpenPGP Certificate User-IDs. */
|
/** Certify OpenPGP Certificate User-IDs. */
|
||||||
fun certifyUserId(): CertifyUserId
|
fun certifyUserId(): CertifyUserId?
|
||||||
|
|
||||||
/** Validate a UserID in an OpenPGP certificate. */
|
/** Validate a UserID in an OpenPGP certificate. */
|
||||||
fun validateUserId(): ValidateUserId
|
fun validateUserId(): ValidateUserId?
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,23 +12,23 @@ import sop.operation.Version
|
||||||
interface SOPV {
|
interface SOPV {
|
||||||
|
|
||||||
/** Get information about the implementations name and version. */
|
/** 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
|
* Verify detached signatures. If you need to verify an inline-signed message, use
|
||||||
* [inlineVerify] instead.
|
* [inlineVerify] instead.
|
||||||
*/
|
*/
|
||||||
fun verify(): DetachedVerify = detachedVerify()
|
fun verify(): DetachedVerify? = detachedVerify()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify detached signatures. If you need to verify an inline-signed message, use
|
* Verify detached signatures. If you need to verify an inline-signed message, use
|
||||||
* [inlineVerify] instead.
|
* [inlineVerify] instead.
|
||||||
*/
|
*/
|
||||||
fun detachedVerify(): DetachedVerify
|
fun detachedVerify(): DetachedVerify?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify signatures of an inline-signed message. If you need to verify detached signatures over
|
* Verify signatures of an inline-signed message. If you need to verify detached signatures over
|
||||||
* a message, use [detachedVerify] instead.
|
* a message, use [detachedVerify] instead.
|
||||||
*/
|
*/
|
||||||
fun inlineVerify(): InlineVerify
|
fun inlineVerify(): InlineVerify?
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue