From 84e554fc0d5561871ddbc8bf9ed2b6cbb18613f8 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Sun, 6 Aug 2023 14:38:38 +0200 Subject: [PATCH] Kotlin conversion: CertificateAuthority --- ...Authority.java => CertificateAuthority.kt} | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) rename pgpainless-core/src/main/java/org/pgpainless/authentication/{CertificateAuthority.java => CertificateAuthority.kt} (69%) diff --git a/pgpainless-core/src/main/java/org/pgpainless/authentication/CertificateAuthority.java b/pgpainless-core/src/main/java/org/pgpainless/authentication/CertificateAuthority.kt similarity index 69% rename from pgpainless-core/src/main/java/org/pgpainless/authentication/CertificateAuthority.java rename to pgpainless-core/src/main/java/org/pgpainless/authentication/CertificateAuthority.kt index 36bf9e5f..e510f48a 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/authentication/CertificateAuthority.java +++ b/pgpainless-core/src/main/java/org/pgpainless/authentication/CertificateAuthority.kt @@ -4,11 +4,8 @@ package org.pgpainless.authentication; -import org.pgpainless.key.OpenPgpFingerprint; - -import javax.annotation.Nonnull; -import java.util.Date; -import java.util.List; +import org.pgpainless.key.OpenPgpFingerprint +import java.util.* /** * Interface for a CA that can authenticate trust-worthy certificates. @@ -17,7 +14,7 @@ import java.util.List; * @see PGPainless-WOT * @see OpenPGP Web of Trust */ -public interface CertificateAuthority { +interface CertificateAuthority { /** * Determine the authenticity of the binding between the given fingerprint and the userId. @@ -33,11 +30,11 @@ public interface CertificateAuthority { * 60 = partially authenticated...) * @return information about the authenticity of the binding */ - CertificateAuthenticity authenticateBinding(@Nonnull OpenPgpFingerprint fingerprint, - @Nonnull String userId, - boolean email, - @Nonnull Date referenceTime, - int targetAmount); + fun authenticateBinding(fingerprint: OpenPgpFingerprint, + userId: String, + email: Boolean, + referenceTime: Date, + targetAmount: Int): CertificateAuthenticity; /** * Lookup certificates, which carry a trustworthy binding to the given userId. @@ -50,10 +47,10 @@ public interface CertificateAuthority { * 60 = partially authenticated...) * @return list of identified bindings */ - List lookupByUserId(@Nonnull String userId, - boolean email, - @Nonnull Date referenceTime, - int targetAmount); + fun lookupByUserId(userId: String, + email: Boolean, + referenceTime: Date, + targetAmount: Int): List /** * Identify trustworthy bindings for a certificate. @@ -65,7 +62,7 @@ public interface CertificateAuthority { * 60 = partially authenticated...) * @return list of identified bindings */ - List identifyByFingerprint(@Nonnull OpenPgpFingerprint fingerprint, - @Nonnull Date referenceTime, - int targetAmount); + fun identifyByFingerprint(fingerprint: OpenPgpFingerprint, + referenceTime: Date, + targetAmount: Int): List }