Fix User-ID format in documentation and note invalid user-id formats in tests

This commit is contained in:
Paul Schaub 2022-07-12 10:33:43 +02:00
parent 56abb51757
commit 223cf009fc
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
3 changed files with 6 additions and 4 deletions

View File

@ -8,11 +8,10 @@ However, it is agreed upon to use the
Below is a selection of possible User-IDs:
```
Firstname Lastname <email@address.tld> [Comment]
Firstname Lastname (Comment) <email@address.tld>
Firstname Lastname
Firstname Lastname [Comment]
Firstname Lastname (Comment)
<email@address.tld>
<email@address.tld> [Comment]
```
PGPainless comes with a builder class `UserId`, which can be used to safely construct User-IDs:
@ -29,5 +28,5 @@ UserId full = UserId.newBuilder()
.withEmail("peter@pgpainless.org")
.withComment("Work Address")
.build();
assertEquals("Peter Pattern <peter@pgpainless.org> [Work Address]", full.toString());
assertEquals("Peter Pattern (Work Address) <peter@pgpainless.org>", full.toString());
```

View File

@ -704,6 +704,8 @@ public class KeyRingInfoTest {
@Test
public void getEmailsTest() throws IOException {
// NOTE: The User-ID Format for the ID "Alice Anderson <alice@email.tld> [Primary Mail Address]" is incorrect.
// TODO: Fix?
String KEY = "-----BEGIN PGP PRIVATE KEY BLOCK-----\n" +
"Version: PGPainless\n" +
"Comment: B4A8 9FE8 9D59 31E6 BCF7 DC2F 6BA1 2CC7 9A08 8D73\n" +

View File

@ -119,6 +119,7 @@ public class SignatureUtilsTest {
"-----END PGP PUBLIC KEY BLOCK-----\n";
String aliceId = "Alice <alice@exmaple.com>";
// TODO: Fix wrong user-id format of pet name
String charliesPetNameForAlice = "Alice Example <alice@example.com> [from work]";
long aliceKeyId = 1059762964264170602L;