Interface PasskeyRepository
public interface PasskeyRepository
Port that reads and manages the passkeys users registered. Creating a credential and verifying its signatures belong
to the WebAuthn framework, so this port only lists, renames and deletes. It never returns
null.-
Method Summary
Modifier and TypeMethodDescriptionbooleanDeletes a passkey of a user.booleanexistsForAccount(UUID accountId) Tells whether an account has registered at least one passkey, in a single lookup.findByIdAndUserId(String id, String userId) Finds one passkey of a user.findByUserId(String userId) Lists the passkeys of a user, oldest first.findUserIdByUsername(String username) Finds the WebAuthn user handle of an account.booleanRenames a passkey of a user.
-
Method Details
-
findUserIdByUsername
Finds the WebAuthn user handle of an account.- Parameters:
username- name of the account, as the user entity of the credential store records it.- Returns:
- the user handle, or an empty optional when the account has no user entity (never registered a passkey).
-
findByUserId
Lists the passkeys of a user, oldest first.- Parameters:
userId- WebAuthn user handle of the owner.- Returns:
- the passkeys, possibly empty.
-
findByIdAndUserId
Finds one passkey of a user.- Parameters:
id- credential identifier.userId- WebAuthn user handle of the owner, so nobody can reach another user's passkey.- Returns:
- the passkey, or an empty optional when the user has no such passkey.
-
rename
Renames a passkey of a user.- Parameters:
id- credential identifier.userId- WebAuthn user handle of the owner.label- new label.- Returns:
truewhen a passkey was renamed.
-
delete
Deletes a passkey of a user.- Parameters:
id- credential identifier.userId- WebAuthn user handle of the owner.- Returns:
truewhen a passkey was deleted.
-
existsForAccount
Tells whether an account has registered at least one passkey, in a single lookup.- Parameters:
accountId- identifier of the account (theusersrow), not its WebAuthn user handle.- Returns:
truewhen the account has at least one passkey.
-