Skip to content

Commit

Permalink
Clarify that CredentialRepository implementations MUST NOT return null
Browse files Browse the repository at this point in the history
  • Loading branch information
emlun committed Nov 9, 2023
1 parent e69d48f commit d386583
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public interface CredentialRepository {
*
* <p>After a successful registration ceremony, the {@link RegistrationResult#getKeyId()} method
* returns a value suitable for inclusion in this set.
*
* <p>Implementations of this method MUST NOT return null.
*/
Set<PublicKeyCredentialDescriptor> getCredentialIdsForUsername(String username);

Expand All @@ -51,6 +53,8 @@ public interface CredentialRepository {
*
* <p>Used to look up the user handle based on the username, for authentication ceremonies where
* the username is already given.
*
* <p>Implementations of this method MUST NOT return null.
*/
Optional<ByteArray> getUserHandleForUsername(String username);

Expand All @@ -60,6 +64,8 @@ public interface CredentialRepository {
*
* <p>Used to look up the username based on the user handle, for username-less authentication
* ceremonies.
*
* <p>Implementations of this method MUST NOT return null.
*/
Optional<String> getUsernameForUserHandle(ByteArray userHandle);

Expand All @@ -69,6 +75,8 @@ public interface CredentialRepository {
*
* <p>The returned {@link RegisteredCredential} is not expected to be long-lived. It may be read
* directly from a database or assembled from other components.
*
* <p>Implementations of this method MUST NOT return null.
*/
Optional<RegisteredCredential> lookup(ByteArray credentialId, ByteArray userHandle);

Expand All @@ -79,6 +87,8 @@ public interface CredentialRepository {
* <p>This is used to refuse registration of duplicate credential IDs. Therefore, under normal
* circumstances this method should only return zero or one credential (this is an expected
* consequence, not an interface requirement).
*
* <p>Implementations of this method MUST NOT return null.
*/
Set<RegisteredCredential> lookupAll(ByteArray credentialId);
}

1 comment on commit d386583

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mutation test results

Package Coverage Stats Prev Prev
Overall 81 % 🔹 1285 🔹 / 1575 🔺 81 % 1285 / 1573
com.yubico.fido.metadata 68 % 🔻 220 🔻 / 323 🔹 68 % 222 / 323
com.yubico.internal.util 47 % 🔹 57 🔹 / 120 🔹 47 % 57 / 120
com.yubico.webauthn 88 % 🔹 572 🔹 / 646 🔹 88 % 572 / 646
com.yubico.webauthn.attestation 92 % 🔹 13 🔹 / 14 🔹 92 % 13 / 14
com.yubico.webauthn.data 93 % 🔹 398 🔺 / 425 🔺 93 % 396 / 423
com.yubico.webauthn.extension.appid 100 % 🏆 13 🔹 / 13 🔹 100 % 13 / 13
com.yubico.webauthn.extension.uvm 50 % 🔹 12 🔹 / 24 🔹 50 % 12 / 24
com.yubico.webauthn.meta 0 % 🔹 0 🔹 / 10 🔹 0 % 0 / 10

Previous run: 2004327 - Diff

Detailed reports: workflow run #247

Please sign in to comment.