From 021fd7846edf4cea985a3ee55feaceda9a1fbd6a Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Sat, 13 Nov 2021 16:05:55 +0100 Subject: [PATCH] Rename user-id deletion methods --- .../src/main/java/org/pgpainless/key/util/KeyRingUtils.java | 4 ++-- .../test/java/org/pgpainless/key/util/KeyRingUtilTest.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pgpainless-core/src/main/java/org/pgpainless/key/util/KeyRingUtils.java b/pgpainless-core/src/main/java/org/pgpainless/key/util/KeyRingUtils.java index 1c9980be..5ae789d4 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/key/util/KeyRingUtils.java +++ b/pgpainless-core/src/main/java/org/pgpainless/key/util/KeyRingUtils.java @@ -167,7 +167,7 @@ public final class KeyRingUtils { * @return modified secret keys */ @Deprecated - public static PGPSecretKeyRing deleteUserIdFromSecretKeyRing(PGPSecretKeyRing secretKeys, String userId) { + public static PGPSecretKeyRing deleteUserId(PGPSecretKeyRing secretKeys, String userId) { PGPSecretKey secretKey = secretKeys.getSecretKey(); // user-ids are located on primary key only PGPPublicKey publicKey = secretKey.getPublicKey(); // user-ids are placed on the public key part publicKey = PGPPublicKey.removeCertification(publicKey, userId); @@ -191,7 +191,7 @@ public final class KeyRingUtils { * @return modified secret keys */ @Deprecated - public static PGPPublicKeyRing deleteUserIdFromPublicKeyRing(PGPPublicKeyRing publicKeys, String userId) { + public static PGPPublicKeyRing deleteUserId(PGPPublicKeyRing publicKeys, String userId) { PGPPublicKey publicKey = publicKeys.getPublicKey(); // user-ids are located on primary key only publicKey = PGPPublicKey.removeCertification(publicKey, userId); if (publicKey == null) { diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/util/KeyRingUtilTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/util/KeyRingUtilTest.java index d1384e40..8312bd28 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/util/KeyRingUtilTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/util/KeyRingUtilTest.java @@ -32,7 +32,7 @@ public class KeyRingUtilTest { .done(); assertEquals(2, CollectionUtils.iteratorToList(secretKeys.getPublicKey().getUserIDs()).size()); - secretKeys = KeyRingUtils.deleteUserIdFromSecretKeyRing(secretKeys, "Bob"); + secretKeys = KeyRingUtils.deleteUserId(secretKeys, "Bob"); assertEquals(1, CollectionUtils.iteratorToList(secretKeys.getPublicKey().getUserIDs()).size()); } @@ -49,7 +49,7 @@ public class KeyRingUtilTest { PGPPublicKeyRing publicKeys = PGPainless.extractCertificate(secretKeys); assertEquals(2, CollectionUtils.iteratorToList(publicKeys.getPublicKey().getUserIDs()).size()); - publicKeys = KeyRingUtils.deleteUserIdFromPublicKeyRing(publicKeys, "Alice"); + publicKeys = KeyRingUtils.deleteUserId(publicKeys, "Alice"); assertEquals(1, CollectionUtils.iteratorToList(publicKeys.getPublicKey().getUserIDs()).size()); } @@ -61,6 +61,6 @@ public class KeyRingUtilTest { .modernKeyRing("Alice", null); assertThrows(NoSuchElementException.class, - () -> KeyRingUtils.deleteUserIdFromSecretKeyRing(secretKeys, "Charlie")); + () -> KeyRingUtils.deleteUserId(secretKeys, "Charlie")); } }